[Top][All Lists]

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

Re: gdb-ui and Mac OS X

From: Stefan Monnier
Subject: Re: gdb-ui and Mac OS X
Date: 27 Mar 2004 21:21:18 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> A post-prompt annotation is being lost somewhere. It happens after "set height
> 0" is sent to gdb. I would have said that it happened when the process filter
> was switched from gud-gdb-marker-filter to gud-gdba-marker-filter but Ken had
> a similar problem with M-x gdba.

> If you instrument gud-gdba-marker-filter with Edebug and start gdb as before,
> then when you reach the variable `string' (in the first expression), in the
> mini-buffer, you should get:

> Result: "\npost-prompt\n"

> If you get:

> Result: "\npre-prompt\n(gdb) \nprompt\n"

> then perhap you can instrument gud-gdb-marker-filter and find out where the
> post-prompt annotation is lost.

I've tried to step through the code, but it's longer than you describe:
a whole bunch of commands are sent: `set height 0' goes through, then
several `server foo bar' commands, and only after a while did I get into
the above state.
As a matter of fact when I reach the error, gdb-input-queue is nil.

Could you give me some quick description of what is the difference between
pre-prompt, post-prompt, prompt, and how they relate to the
various commands?

Here are the interactions between gdb-send-item and
gud-gdba-marker-filter, as I tried to capture them in a debug-var:

((send "set height 0\n" ignore)
 (recv . "\n")
 (recv . "post-prompt\n")
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (send "server list main\n" ignore)
 (recv . "\npost-prompt\n")
 (recv . "782        int argc;\n783          char **argv;\n784  #ifdef VMS\n785 
     char **envp;\n786  #endif\n787     {\n788  #if GC_MARK_STACK\n789    
Lisp_Object dummy;\n790       #endif\n791       char stack_bottom_variable;\n")
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (send "server list MAIN__\n" ignore)
 (recv . "\npost-prompt\n")
 (recv . "\nerror-begin\nFunction \"MAIN__\" not defined.\n\nerror\n")
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (send "server info source\n" gdb-source-info)
 (recv . "\npost-prompt\nCurrent source file is emacs.c\nCompilation 
directory is /Users/monnier/src/emacs/trunk/src/\nLocated in 
/Users/monnier/src/emacs/trunk/src/emacs.c\nContains 2421 lines.\nSource 
language is c.\nCompiled with stabs debugging format.\nDoes not include 
preprocessor macro info.\n")
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (send "server info frame\n" gdb-frame-handler)
 (recv . "\npost-prompt\n\nerror-begin\nNo stack.\n\nerror\n")
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (send "server interpreter mi \"-var-update *\"\n" gdb-var-update-handler)
 (recv . "\npost-prompt\n^done,changelist={}\n(gdb) \nSwitching to 
interpreter \"console\".\n")
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (send "server info breakpoints\n" gdb-info-breakpoints-handler)
 (recv . "\npre-prompt\n(gdb) \nprompt\n"))

The patch I used to log this is attached.

> PS What about gdbmi.el. Does that work? (GDB 6.1 is almost out)

I wouldn't know.  I'm using the GDB version that comes with the system.


--- gdb-ui.el.~1.1.~    Wed Mar 24 15:39:37 2004
+++ gdb-ui.el   Sat Mar 27 21:15:31 2004
@@ -120,6 +120,7 @@
 (defun gdb-ann3 ()
+  (setq gud-debug-log nil)
   (set (make-local-variable 'gud-minor-mode) 'gdba)
   (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
@@ -380,7 +381,7 @@
           (setq ,name val))))))
 (def-gdb-var buffer-type nil
-  "One of the symbols bound in gdb-buffer-rules")
+  "One of the symbols bound in `gdb-buffer-rules'.")
 (def-gdb-var burst ""
   "A string of characters from gdb that have not yet been processed.")
@@ -407,7 +408,7 @@
             for subsequent processing by a command.  This is the
             disposition of output generated by commands that
             gdb mode sends to gdb on its own behalf.
-    post-emacs -- ignore input until the prompt annotation is
+    post-emacs -- ignore output until the prompt annotation is
                  received, then go to USER disposition.
@@ -667,6 +668,7 @@
   (setq gdb-view-source t))
 (defun gdb-send-item (item)
+  (push (cons 'send item) gud-debug-log)
   (gdb-set-current-item item)
   (if (stringp item)
@@ -784,8 +786,11 @@
       (gdb-set-output-sink 'user)
       (error "Phase error in gdb-post-prompt (got %s)" sink)))))
+(defvar gud-debug-log nil)
 (defun gud-gdba-marker-filter (string)
   "A gud marker filter for gdb. Handle a burst of output from GDB."
+  (push (cons 'recv string) gud-debug-log)
   ;; Recall the left over gud-marker-acc from last time
   (setq gud-marker-acc (concat gud-marker-acc string))
   ;; Start accumulating output for the GUD buffer

reply via email to

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