From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Daniel R. Grayson" Newsgroups: gmane.emacs.bugs Subject: Re: gud/gdb Date: Fri, 28 Sep 2007 07:50:13 -0500 Message-ID: <200709281250.l8SCoD79013130@u123.math.uiuc.edu> References: <200709261732.l8QHWNMJ017163@u123.math.uiuc.edu> <18171.15854.668941.88316@kahikatea.snap.net.nz> <200709271230.l8RCUeLo028440@u123.math.uiuc.edu> <18172.39294.436973.108728@kahikatea.snap.net.nz> Reply-To: dan@math.uiuc.edu NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1190983885 30985 80.91.229.12 (28 Sep 2007 12:51:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Sep 2007 12:51:25 +0000 (UTC) Cc: dan@math.uiuc.edu, bug-gnu-emacs@gnu.org, mike@math.cornell.edu To: Nick Roberts Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 28 14:51:20 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IbFJ5-0005Lf-AV for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Sep 2007 14:50:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IbFJ1-0000zF-JB for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Sep 2007 08:50:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IbFIU-0000jV-5y for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2007 08:50:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IbFIT-0000iV-Nh for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2007 08:50:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IbFIT-0000iB-1P for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2007 08:50:21 -0400 Original-Received: from mail1.math.uiuc.edu ([130.126.108.26]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IbFIS-0005aK-Ih for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2007 08:50:20 -0400 Original-Received: from charisma.math.uiuc.edu (charisma.math.uiuc.edu [130.126.108.20]) by mail1.math.uiuc.edu (8.12.10/8.12.10) with ESMTP id l8SCoDZ4013569; Fri, 28 Sep 2007 07:50:13 -0500 Original-Received: from u123.math.uiuc.edu (u123.math.uiuc.edu [130.126.108.153]) by charisma.math.uiuc.edu (8.11.7p1+Sun/8.11.7) with ESMTP id l8SCoDc03693; Fri, 28 Sep 2007 07:50:13 -0500 (CDT) Original-Received: (from dan@localhost) by u123.math.uiuc.edu (8.12.10/8.12.10/Submit) id l8SCoD79013130; Fri, 28 Sep 2007 07:50:13 -0500 X-Authentication-Warning: u123.math.uiuc.edu: dan set sender to dan@math.uiuc.edu using -f In-reply-to: <18172.39294.436973.108728@kahikatea.snap.net.nz> (message from Nick Roberts on Fri, 28 Sep 2007 18:04:46 +1200) X-Detected-Kernel: Linux 2.4-2.6 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16641 Archived-At: 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. Dan > From: Nick Roberts > Date: Fri, 28 Sep 2007 18:04:46 +1200 > To: dan@math.uiuc.edu > Cc: bug-gnu-emacs@gnu.org, mike@math.cornell.edu > 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 > 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 >