Subject: bug#5404: 23.1.91; Nextstep port: M-x gdb hangs in tab completion of symbols

From: Steve Revilak <[email-masked]>
Date: Mon, 18 Jan 2010 10:50:10 -0500

>> The release announcement for emacs 23.1.91 noted a major change in M-x
>> gdb (<http://lists.gnu.org/archive/html/emacs-devel/2009-12/msg01109.html>)
>> and this seems to be new behavior in 23.1.91.

>Do you mean it worked before this reversion?  That earlier GDB/MI code is the
>future and I'd like to put it back on a branch in the Emacs repository but I
>don't know if there are branches or how to list them using bzr.  I don't
>really want my own branch as it probably wouldn't get checked out by anybody
>else but a shared experimental branch would be good.

Nick,

Thanks for writing back.

I tried the "steps to reproduce" with emacs 23.1.1.  23.1.1 has the
same behavior as 23.1.91 (i.e., hangs on step 7).  So in that sense,
the reversion did restore the earlier behavior.

The hanging behavior did not occur in the last major revision of emacs
(22.3.1).  But I realize that the emacs gdb interface has undergone a
lot of changes since then.

>> ...
>>   6) At the (gdb) prompt, type "b add_", then TAB
>>
>>   7) After pressing TAB, emacs becomes unresponsive.
>>
>>      Emacs stays unresponsive until Ctrl-G is pressed.

>On GNU/Linux this works fine for me with just one completion.

Agreed.  On my OpenSUSE 11.2 system (with gdb 6.8.91.20090930-2.4),
step 7 works fine, with just one completion.  I've observed the
hanging on three different versions of Mac OS X (10.4.11, 10.5.7,
10.6.2), but not on GNU/Linux.

>> Observations from edebug
>> ------------------------
>>
>> I've used M-x edebug-defun to instrument different functions in
>> gud.el, so that I could step through them with emacs debugger.
>>
>> Emacs seems to hang when evaluating the expression
>>
>>    (get-buffer-process gud-comint-buffer)

>More likely it hangs on accept-process-output.

>Emacs uses the special purpose gdb command "complete".  I have noticed that it
>can appear to hang when there are too many completions then typing C-c C-c
>causes all these to spill into the GUD buffer.  On the command line you get
>something like:
>
>(top-gdb) b <TAB>
>Display all 20671 possibilities? (y or n)
>
>but that doesn't seem to be the case here.

Agreed.  Using gdb directly from the command line on Mac OS X 10.4.11,
there are three completions.

---------------------------------
$ gdb foo
GNU gdb 6.3.50-20050815 (Apple version gdb-696) (Sat Oct 20 18:20:28 GMT 2007)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...
warning: --arch option not supported in this gdb.
Reading symbols for shared libraries .. done

(gdb) complete b add_
b add_fdes
b add_one
b add_profil
(gdb)
---------------------------------

Steve Revilak