unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: dan@math.uiuc.edu
Cc: bug-gnu-emacs@gnu.org, mike@math.cornell.edu
Subject: Re: gud/gdb
Date: Fri, 28 Sep 2007 18:04:46 +1200	[thread overview]
Message-ID: <18172.39294.436973.108728@kahikatea.snap.net.nz> (raw)
In-Reply-To: <200709271230.l8RCUeLo028440@u123.math.uiuc.edu>

 > It's totally reproducible for me.  I start emacs with -q, debug our (very
 > large) program with M-x gdb, run the program, give certain input to our
 > program that causes it to crash, and then gdb fails to show the source.  If
 > I say "up" to gdb, then it gets confused, as described before.

Does it work if you start with M-x gdba?

If yes then then please note that the current (in CVS) Emacs docs say:

  ...you can use `M-x gdba' to invoke GDB in graphical mode.  Moreover, this
  command succeeds where `M-x gdb' fails, such as when your `.gdbinit'
  file contains executable GDB commands.

If it still fails can you please do the following:

1) M-x gdb
2) Run gdb (like this): gdb --annotate=3 yourprog <RET>
3) Set the variable `gdb-enable-debug' to t using "M-x set-variable"
4) Run your program etc until Emacs gets confused.
5) Post the value of gdb-debug-log to bug-gnu-emacs (or privately to me if
   it's large (> 100K compressed).

 > How about instead if someone reading this message who knows gdb were to
 > verify that gdb doesn't put filenames directly after "\032\032" any longer
 > (in recent versions?), but always only after "\032\032source "?  This method
 > of communication between gdb and emacs must be documented somewhere.

Assuming that gdb is running with --annotate=3 and not --fullname, Emacs
switches to gdb-ui.el after gdb ouputs the first "prompt" annotation.

 > If that were verified, then this bit of emacs code from gud.el
 > 
 >     (while (string-match gud-gdb-marker-regexp gud-marker-acc)
 >       (setq
 > 
 >        ;; Extract the frame position from the marker.
 >        gud-last-frame (cons (match-string 1 gud-marker-acc)
 >        		      	        (string-to-number (match-string 2
 > 				gud-marker-acc)))
 > 
 > shows that emacs is picking up the file name with "source " prepended to it
 > and trying to use that as the file name.  Eventually it asks for the window
 > of the buffer containing the phony file name, and unexpectedly gets nil.

At this point Emacs should be using gud-gdba-marker-filter.

 > If no one understands the protocol (admittedly obsolete), then I can do more
 > work and get you the proof you need, but I was hoping someone understood that
 > all better than I so I could save some time.  Let me know!
 > 
 > Umm, wait a minute.  Take a look at this bit of code from gdb's annotate.c:

The file gdb-ui.el has been written with this code in mind.  See the
Annotations node of the GDB info manual.

 >...
 > This problem is correlated with the gdb command line that gud uses having the
 > option --annotate=3, as in this bit from emacs' gud.el:
 > 
 >     (defcustom gud-gdb-command-name "gdb --annotate=3"
 >       "Default command to execute an executable under the GDB debugger."
 >        :type 'string
 >        :group 'gud)
 > 
 > That's pretty convincing.  At least to me.  Setting the annotation level
 > higher than used to be done changes the syntax for sending source filenames,
 > and not all the code in emacs got upgraded when that change was made.

I'm sure there are bugs but the change is probably more deliberate than you
imagine.  Have you read the the node "GDB Graphical Interface" of the Emacs
manual?

-- 
Nick                                           http://www.inet.net.nz/~nickrob




  reply	other threads:[~2007-09-28  6:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26 17:32 gud/gdb Daniel R. Grayson
2007-09-27  5:21 ` gud/gdb Nick Roberts
2007-09-27 12:30   ` gud/gdb Daniel R. Grayson
2007-09-28  6:04     ` Nick Roberts [this message]
2007-09-28 12:50       ` gud/gdb Daniel R. Grayson
2007-09-29  0:57         ` gud/gdb Nick Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18172.39294.436973.108728@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=dan@math.uiuc.edu \
    --cc=mike@math.cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).