jdizzle
jdizzle

Reputation: 4164

Can I make emacs correctly load source files when using gdb over ssh?

I want to use emacs to remotely run gdb over ssh, then from that remote gdb, target a remote debug server. I really want to run gdb from within emacs, but x-forwarding emacs has too much latency so I run aquamacs locally on my mac. I run M-x gdb with the command line ssh work-host /path/to/my/gdb and then from the gdb prompt I can target my remote debug target.

This all works great, but no sources load when I try and step through files. I'm assuming emacs is getting confused at the remote paths the ssh gdb is returning. Is there a way to fix up the paths or at least manually map file paths to debug paths?

Upvotes: 4

Views: 870

Answers (2)

Employed Russian
Employed Russian

Reputation: 213935

x-forwarding emacs has too much latency

So don't. The simplest solution may be to ssh to work-host, and run emacs -nw there. Alternatively,

ssh work-host /path/to/my/gdb

Don't you want ssh work-host /path/to/my/gdb --annotate=3 /path/to/exe ?

You can tell gdb where to find sources with the dir command, but I think your initial problem might be that gdb isn't telling emacs about source at all (or else you have not told us the whole story).

Upvotes: 1

This worked for me (Emacs 23 under Linux and GDB 7.0.1; I don't see why this wouldn't work on OSX, and probably even on Windows with a bit of prodding):

M-x gdb --annotate=3 /remote.example.com:a.out

Then start at the (gdb) prompt opened /remote.example.com:a.c.

There is some brief mention of this in the Tramp manual, under “Running a debugger on a remote host”.

Upvotes: 1

Related Questions