GNU bug report logs - #39408
Breakpoints don't work with M-x gdb under TRAMP

Previous Next

Package: emacs;

Reported by: Timo Lilja <timo.lilja <at> iki.fi>

Date: Mon, 3 Feb 2020 19:11:01 UTC

Severity: normal

Tags: patch

Fixed in version 27.3

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39408 in the body.
You can then email your comments to 39408 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39408; Package emacs. (Mon, 03 Feb 2020 19:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Timo Lilja <timo.lilja <at> iki.fi>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 03 Feb 2020 19:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Timo Lilja <timo.lilja <at> iki.fi>
To: bug-gnu-emacs <at> gnu.org
Subject: Breakpoints don't work with M-x gdb under TRAMP
Date: Mon, 3 Feb 2020 21:07:05 +0200
[Message part 1 (text/plain, inline)]
*** 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 <at> 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 <at> 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.

Relates to bug #23608.

*** Affected functions
(gdb-place-breakpoints)
(gdb-get-location)
(gdb-goto-breakpoint)
(gdb-frame-handler)
(gud-file-name)

*** References
- https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23608
[Message part 2 (text/html, inline)]
[gdb-tramp-fix.diff (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39408; Package emacs. (Fri, 21 Aug 2020 11:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 39408 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Timo Lilja <timo.lilja <at> iki.fi>
Cc: 39408 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re: bug#39408: Breakpoints don't work with M-x gdb under TRAMP
Date: Fri, 21 Aug 2020 13:48:12 +0200
Timo Lilja <timo.lilja <at> iki.fi> writes:

[...]

> 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 <at> 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

Michael, there's tramp-related patch for gdb-mi/gud in this bug report
that I think looks reasonable, if I'm reading it correctly.  Do you have
any opinions on this?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 21 Aug 2020 11:49:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39408; Package emacs. (Fri, 21 Aug 2020 14:09:02 GMT) Full text and rfc822 format available.

Message #13 received at 39408 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 39408 <at> debbugs.gnu.org, Timo Lilja <timo.lilja <at> iki.fi>
Subject: Re: bug#39408: Breakpoints don't work with M-x gdb under TRAMP
Date: Fri, 21 Aug 2020 16:08:35 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

Hi Lars,

> Michael, there's tramp-related patch for gdb-mi/gud in this bug report
> that I think looks reasonable, if I'm reading it correctly.  Do you have
> any opinions on this?

Somehow, I've missed that bug report :-(

I have no objection to apply the patch, but wouldn't it be better to
understand, why bindat-get-field returns file names like
/ssh:vagrant <at> debug:/vagrant/"/vagrant/hello.c" ? Just patching the
obscure result doesn't look error prone to me.

Furthermore,

-  (setq f (concat (or (file-remote-p default-directory) "") f))
+  (unless (file-remote-p f)
+    (setq f (concat (or (file-remote-p default-directory) "") f)))

could be simplified to

   (setq f (concat (file-remote-p default-directory) f))

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39408; Package emacs. (Fri, 16 Apr 2021 07:12:02 GMT) Full text and rfc822 format available.

Message #16 received at 39408 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: 39408 <at> debbugs.gnu.org
Subject: Re: bug#39408: Breakpoints don't work with M-x gdb under TRAMP
Date: Thu, 15 Apr 2021 22:02:01 -0700
[Message part 1 (text/plain, inline)]
This is already fixed in Emacs 28 thanks to bug#44173 (a78c614), which
replaces the old GDB/MI parser (that converted the data to JSON first)
with a more-robust parser. Attached is a patch to fix this under Emacs
27.

The problem is that in `gdb-jsonify-buffer', when replacing the
"fullname" with a Tramp path, the wildcard was greedy, resulting in
only one "fullname" being replaced in the buffer. This had the effect
of rendering it impossible to have more than one breakpoint, as all
but the first breakpoint would have unmodified "fullname"s.

(Note: I have a couple of patches in Tramp already that put me at the
limit for patches without copyright assignment paperwork. However,
I've already requested the form.)
[0001-Emacs-27-Fix-setting-breakpoints-in-M-x-gdb-for-remote-files.patch (application/octet-stream, attachment)]

Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Sat, 01 May 2021 10:00:05 GMT) Full text and rfc822 format available.

Notification sent to Timo Lilja <timo.lilja <at> iki.fi>:
bug acknowledged by developer. (Sat, 01 May 2021 10:00:05 GMT) Full text and rfc822 format available.

Message #21 received at 39408-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 39408-done <at> debbugs.gnu.org
Subject: Re: bug#39408: Breakpoints don't work with M-x gdb under TRAMP
Date: Sat, 01 May 2021 11:59:07 +0200
Version: 27.3

Jim Porter <jporterbugs <at> gmail.com> writes:

> This is already fixed in Emacs 28 thanks to bug#44173 (a78c614), which
> replaces the old GDB/MI parser (that converted the data to JSON first)
> with a more-robust parser. Attached is a patch to fix this under Emacs
> 27.
>
> The problem is that in `gdb-jsonify-buffer', when replacing the
> "fullname" with a Tramp path, the wildcard was greedy, resulting in
> only one "fullname" being replaced in the buffer. This had the effect
> of rendering it impossible to have more than one breakpoint, as all
> but the first breakpoint would have unmodified "fullname"s.

Pushed to the emacs-27 branch. Closing the bug.

Note: I don't know, whether there will be an Emacs 27.3. So the patch is
pushed just in case of.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 29 May 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 325 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.