*** Environment
- GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of
2019-09-23, modified by Debian
- The code looks identical on the relevant parts in Emacs git master
*** Steps to reproduce
1. Run emacs
$ emacs -q
2. Start remote debugging session
M-x gdb RET gdb -i=mi /ssh:vagrant@debug:/vagrant/hello
3. Set a breakpoint in *gud-hello* buffer
(gdb) break main
Breakpoint 1 at 0x1149: file hello.c, line 6.
4. Run the program to the breakpoint
(gdb) run
5. Switch back to source window
C-x b hello.c RET
6. Add another breakpoint
C-x C-a c-b
Emacs becomes unresponsive and the minibuffer is flooded with the
following error message:
~File /ssh:vagrant@debug:/vagrant/"/vagrant/hello.c" no longer exists!~
*** Fix
1. Apply patch gdb-tramp-fix.diff
$ zcat /usr/share/emacs/26.1/lisp/progmodes/gdb-mi.el.gz >gdb-mi.el
$ zcat /usr/share/emacs/26.1/lisp/progmodes/gud.el.gz >gud.el
$ patch <gdb-tramp-fix.diff
2. run emacs with modified gdb-mi.el and gud.el
$ emacs -q -l el/gdb-mi.el -l el/gud.el
3. Setting breakpoints with C-x C-a C-b should work now
The changes in ~gdb-mi.el~ fix the problem with the "no longer exist"
error message.
The change in ~gud.el~ makes the fringe mark work a bit better and also
the source buffer to pop up when a break point is hit.
The problem seems to be that not all filename information goes through
(gdb-jsonify-buffer) but gdb-mi.el and gud.el read them directly from
gdb's buffers. These patches check wheter a gdb buffer is remote, and
wrap the file names accordingly.
There is probably a better way to fix the problem, but my knowledge
of gdb-mi.el is limited.