emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: gdb-ui and Mac OS X


From: Nick Roberts
Subject: Re: gdb-ui and Mac OS X
Date: Sun, 28 Mar 2004 11:45:22 +0100

Stefan Monnier writes:
 > 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?
 > 

pre-prompt is issued just before the gdb prompt.
prompt is issued straight after the gdb prompt.
post-prompt is issued after gdb has received a command and before it produces
output for that command.

Thats probably not very helpful but I can see from the transcript below what
has gone wrong. The log you have generated is a great idea for future bug
reports, so I'll commit it to the repository as an option. Incidentally when
I run it on GNU/Linux I get similar output (with important differences) but
in the *reverse* order.

 > 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")

So far so good. The next command (server interpreter mi -var-update *) generates
an error on GNU/Linux if gdb is pre 6.0. This isn't a problem and Emacs just
ignores it. For 6.0 onwards it is used for watch expressions (expressions and
their values displayed in the speedbar). On Mac OS X, it appears that gdb knows
*something* about this command and swithes gdb from annotations to GDB/MI (or
at least tries to) and the post-prompt annotation disappears.

 >  (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"))

I don't know exactly why this happens but the gdb command "interpreter mi" was
added to the FSF repository by Jim Ingham at Apple. They have their own version
of gdb and their own repository which they use for an application called
Project Builder. Does Darwin mean Apple or open source?

Anyway to get gdb-ui to work on Mac OS all you should need to do is is remove
gdb-var-update from gdb-post-prompt as watch expressions don't work with this
version of gdb anyway. The dolist below won't be needed either:

> (dolist (frame (frame-list))
>  (when (string-equal (frame-parameter frame 'name) "Speedbar")
>    (setq gdb-var-changed t)    ; force update
>    (dolist (var gdb-var-list)
>      (setcar (nthcdr 5 var) nil))))

If this works, then I guess I can add the following to gdb-ui.el (at least
until Mac OS ships GDB 6.0):

(unless (eq window-system 'mac) (...))


Nick


PS For completeness here is what I get on GNU/Linux (hopefully this works for
you too)

((recv . "\npre-prompt\n(gdb) \nprompt\n")
 (recv . "\npost-prompt\n\nbreakpoints-headers\n\nfield 0\nNum \nfield 
1\nType           \nfield 2\nDisp \nfield 3\nEnb \nfield 4\nAddress    
\nfield 5\nWhat\n\nbreakpoints-table\n\nrecord\n\nfield 0\n1   
\nfield 1\nbreakpoint     \nfield 2\nkeep \nfield 3\ny   \nfield 
4\n0x080e8906 \nfield 5\nin abort at emacs.c:424\n\nrecord\n\nfield 0\n2  
 \nfield 1\nbreakpoint     \nfield 2\nkeep \nfield 3\ny   \nfield 
4\n0x080caad0 \nfield 5\nin x_error_quitter at 
xterm.c:7775\n\nbreakpoints-table-end\n")
 (send "server info breakpoints\n" gdb-info-breakpoints-handler)
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (recv . "\npost-prompt\n\nerror-begin\nUndefined command: \"interpreter\". 
 Try \"help\".\n\nerror\n")
 (send "server interpreter mi \"-var-update *\"\n" gdb-var-update-handler)
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (recv . "\npost-prompt\n\nerror-begin\nNo stack.\n\nerror\n")
 (send "server info frame\n" gdb-frame-handler)
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (recv . "\npost-prompt\nCurrent source file is emacs.c\nCompilation 
directory is /home/nick/emacs/src\nLocated in 
/home/nick/emacs/src/emacs.c\nContains 2421 lines.\nSource language is 
c.\nCompiled with DWARF 2 debugging format.\n")
 (send "server info source\n" gdb-source-info)
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (recv . "\npost-prompt\n\nerror-begin\nFunction \"MAIN__\" not 
defined.\n\nerror\n")
 (send "server list MAIN__\n" ignore)
 (recv . "\npre-prompt\n(gdb) \nprompt\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 . "\npost-prompt\n")
 (send "server list main\n" ignore)
 (recv . "\npre-prompt\n(gdb) \nprompt\n")
 (recv . "\npost-prompt\n")
 (send "set height 0\n" ignore))




reply via email to

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