【部分解决】emacs下gdb调试时scanf无返回的问题

Vim、Emacs配置和使用
回复
waynedou
帖子: 27
注册时间: 2007-06-06 11:42

【部分解决】emacs下gdb调试时scanf无返回的问题

#1

帖子 waynedou » 2010-04-14 21:36

问题如题,在shell下直接运行或gdb均没有问题,eshell下gdb也没有问题,但emacs下运行gdb,r之后就会停留在scanf语句处等待输入,不管输入多少次回车都没有反应。比较奇怪的是,9.04下没有这个问题,到9.10后突然出现的。

此外,M-x gdb RET后输入gdb,出现如下错误:
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) Undefined command: "1-inferior-tty-set". Try "help".
(gdb) Undefined command: "2-gdb-set". Try "help".
(gdb) Undefined command: "3-gdb-set". Try "help".
(gdb) Undefined command: "4-file-list-exec-source-files". Try "help".
(gdb) Undefined command: "5-file-list-exec-source-file". Try "help".
(gdb) Undefined command: "6-gdb-show". Try "help".
(gdb) Undefined command: "7-stack-info-frame". Try "help".
(gdb) Undefined command: "8-thread-info". Try "help".
(gdb) Undefined command: "9-break-list". Try "help".
敬请高人指教!
上次由 waynedou 在 2010-04-17 12:24,总共编辑 1 次。
davyzhu
帖子: 109
注册时间: 2009-12-06 21:23

Re: emacs下gdb调试时scanf无返回的问题

#2

帖子 davyzhu » 2010-04-15 9:44

I think it doesn't matter whether Emacs run on Ubuntu 904 or 910. It's does matter what version of Emacs you use? 23.1 or others?

You can run Emacs on Shell indicate the gdb works well. But Emacs require gud/comint to filter gdb output, and the output is different from what you see in Shell.

So, after M-x gdb, do you
Run gdb: gdb -annotate=3, which means gdb will output string that can be parsed by Emacs?
waynedou
帖子: 27
注册时间: 2007-06-06 11:42

Re: emacs下gdb调试时scanf无返回的问题

#3

帖子 waynedou » 2010-04-17 12:13

感谢davyzhu,确实是emacs版本的问题,9.10下安装的emacs-snapshot是23.1,我后来安装了emacs22,虽然可以接收输入,但对\n的显示还是有问题。所以现在只能等待新版本中会解决了。
waynedou
帖子: 27
注册时间: 2007-06-06 11:42

Re: emacs下gdb调试时scanf无返回的问题

#4

帖子 waynedou » 2010-04-17 12:18

最新的解决方法是emacs --daemon在后台运行,emacs-client -c开启客户端就完全没有问题了。

不过貌似起作用的还是gdb -annotate=3
回复