在 Emacs 远程中使用 GDB 进行调试
我正在尝试在 emacs 中使用 gdb,我正在运行 gdb,但我需要输入的第一个命令是:
target remote 192.168.1.1:1234
来与目标进行沟通。当我从 gdb 获得有关版本的一些输出后,我在 (gdb) 中输入此内容。 由于某种原因,emacs 中的 gdb 不响应此命令,而是不执行任何操作。它在 shell 的命令行上运行良好,所以我认为它也可以在 emacs 中运行。 有人知道为什么这在 emacs 中不起作用吗?
感谢您的帮助
i am trying to use gdb within emacs, i have gdb running but the first command i need to input is for example;
target remote 192.168.1.1:1234
to communicate with the target. I type this in at (gdb) after I have some output from gdb about versions.
For some reason gdb in emacs does not respond to this command and instead does nothing. It works fine on the command line in a shell so i thought it would simply work in emacs aswell.
Does anybody have any ideas as to why this would not work in emacs?
Thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你真正想要的是像这样运行gdb:
Mx gdb ret
gdb --annotate=3 myprog
(gdb) target remote 192.168.1.1:1234
关键似乎是--annotate=3,我不确定tramp是什么或者为什么你想使用 ssh 来做任何事(gdb 将直接连接到你传递给它的主机),但这对我有用。我在连接到本地主机上运行的 qemu 时遇到同样的问题。
what you actually want is to run gdb like this:
M-x gdb ret
gdb --annotate=3 myprog
(gdb) target remote 192.168.1.1:1234
The key appears to be the --annotate=3, I am not sure what tramp is or why you would want to use ssh for anything (gdb will connect directly to the host you pass to it), but this works for me. I was having the same problem connecting to qemu running on localhost.
查看 tramp 文档的相关部分 - 您可以将 TRAMP 与 gdb 一起使用来远程调试。例如:
MxgdbRET
运行 gdb(如下所示): gdb --annotate=3 /ssh:host:~/myprog RET
Have a look at the relevant section of the tramp documentation - you can use Tramp together with gdb to debug remotely. For example:
M-xgdbRET
Run gdb (like this): gdb --annotate=3 /ssh:host:~/myprog RET