[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gud/gdb

From: Daniel R. Grayson
Subject: Re: gud/gdb
Date: Fri, 28 Sep 2007 07:50:13 -0500

Sorry, we've already fixed the bug in our program that caused it to crash at
that spot.  I should have mentioned that we have commands in .gdbinit, so
apparently the work-around (using M-x gdba instead) that you suggest below
would have worked, and you've encountered the bug/issue before (seeminly, emacs
switches to gdb-ui.el too late, after the first source location marker has
arrived).  This explains other behavior I noticed, which is that we can work
around the problem by breaking the program in a different spot first, and then
when it gets to the troublesome part (of our program to be debugged), it works.

Is there a reason that M-x gdba hasn't simply replaced M-x gdb?

Thank you for all your efforts in connection with gdb.


> From: Nick Roberts <address@hidden>
> Date: Fri, 28 Sep 2007 18:04:46 +1200
> To: address@hidden
> Cc: address@hidden, address@hidden
> Subject: Re: gud/gdb
>  > 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 via email to

[Prev in Thread] Current Thread [Next in Thread]