Greg
Greg

Reputation: 51

Debugging with GDB in Emacs remote

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

Upvotes: 4

Views: 6548

Answers (2)

Sam King
Sam King

Reputation: 113

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.

Upvotes: 3

zev
zev

Reputation: 3590

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

Upvotes: 2

Related Questions