GNU bug report logs - #5172
23.1.90; M-x gdb no longer works in 23.1.90.1 under Mac OS X

Previous Next

Package: emacs;

Reported by: Steve Revilak <steve <at> srevilak.net>

Date: Wed, 9 Dec 2009 22:15:04 UTC

Severity: normal

Done: Steve Revilak <steve <at> srevilak.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Steve Revilak <steve <at> srevilak.net>
To: emacs-pretest-bug <at> gnu.org
Subject: bug#5172: 23.1.90; M-x gdb no longer works in 23.1.90.1 under Mac OS X
Date: Wed, 9 Dec 2009 17:10:23 -0500
[Message part 1 (text/plain, inline)]
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug <at> gnu.org mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug.  If you can, give
a recipe starting from `emacs -Q':

I often use Emacs to debug C programs (via M-x gdb).  The typical
workflow is (1) start C program, (2) start gdb via M-x gdb, (3) attach
gdb to running C program, and (4) debug.  With emacs 23.1.90.1, I can
no longer do this.

To give steps to reproduce, it will be helpful to have a C program to
debug.  Here is a C program:

----------- begin demo.c -------------
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main(void) {
  int counter = 0;
  pid_t pid = getpid();
  printf("pid=%d\n", (int) pid);
  while (1) {
    printf("%d\n", counter);
    sleep(1);
    counter++;
  }
  return 0;
}
----------- end demo.c -------------

STEPS TO REPRODUCE:
------------------

First, let me state my goal: I want to start "demo", attach a
debugger, "fin" a few times to get back to main, and then "next"
through one iteration of the while loop.

Below are the steps I took, and the responses I observed:

 (1) compile C program with the command-line
     gcc -g -o demo demo.c

 (2) Start Emacs as "Emacs -q".  Type C-x C-f ~/demo.c RET
     to open demo.c

 (3) from a shell prompt (outside of emacs), start "demo", like this

     $ ./demo 
     pid=19839
     0
     1
     2
     [... program continues ... ]

 (4) In emacs type M-x gdb
     Emacs offer the following in the minibuffer:
     Run gdb (like this): gdb -i=mi demo     

     Press RETURN to accept the gdb command line.

 (5) In the *gud-demo* buffer, emacs prints some preamble information,
     then a gdb prompt.  Normally the "(gdb)" prompt would appear in
     column zero.  Here, the "(gdb)" prompt appears around column 52.

 (6) Into the *gud-demo* buffer, I type "attach 19839 RETURN"

 (7) emacs responds with the following:
------------- begin reponse -------------------------
Attaching to program: `/Users/srevilak/demo', process 19839.
Reading symbols for shared libraries . done
0x90040df8 in mach_wait_until ()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (gdb) 
MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-1"},MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-2"},MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-3"},MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-4"},MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-5"},MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-6"},MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-7"},MI_HOOK_RESULT={HOOK_TYPE="breakpoint_delete",bkptno="-8"},MI_HOOK_RESULT={HOOK_TYPE="frame_changed",frame="0"},MI_HOOK_RESULT={HOOK_TYPE="stack_changed"}
------------- end response --------------------------

 (8) I type "fin RETURN", then "fin RETURN" again (trying to get back
     up into main()).

     The response to these commands are slightly garbled.  The
     minibuffer shows the message `error in process filter: Bad JSON
     object: ":", 44',

 (9) Eventually, I get back up to main.  Emacs does not show the
     source code being debugged.

     I will attach the contents of the *gud-demo* buffer as file
     gud-23.1.90.1.txt.  In this file, note that some lines contain
     several hundred whitespace characters.


STEPS TO REPRODUCE, TAKE 2:
--------------------------

Prior versions of Emacs would offer the debugger command "gdb
--annotate=3" (as opposed to "gdb -i=mi").  I made another attempt
using "gdb --annotate=3 demo".

With "gdb --annotate=3 demo", gdb and Emacs seem to get stuck in some
sort of dialog where neither program understands what the other is
saying.  I'll attach the contents of this *gud-demo* buffer as the
file "gud-23.1.90.1-annotate.txt".


STEPS TO REPRODUCE, TAKE 3:
--------------------------

Next, I'll try to start demo from the debugger, rather than attaching
to a running process.  Here are the results of that attempt (again,
running "Emacs -q" with demo.c open).

 (1) type M-x gdb RET
 
 (2) Accept the gdb command "gdb -i=mi demo"

 (3) at the GDB prompt type "b main RET"

 (4) at the gdb prompt type "run RET"

The *gud-demo* window buffer seems to hang, with "Debugger: run
[initializing ...]" shown in the mode line.

Attached is a picture of the results: gud-23.1.90.1-b-main.png.


WHAT I EXPECTED TO HAPPEN:
-------------------------

Emacs 23.1.1 DOES NOT exhibit the behavior described above.  When
trying the "steps to reproduce" with emacs 23.1.1, I get the results
shown in "23.1.1.png" (attached), and the *gud-demo* buffer contents
shown in gud-23.1.1.txt (also attached).  These files illustrate the
results I'd expect to see.


REPRODUCIBILITY NOTES:
---------------------

Most of this writeup was done with

 * GNU Emacs 23.1.90.1 (powerpc-apple-darwin8.11.0, NS apple-appkit-824.48)
   running on Mac OS X 10.4.11 

 * GDB version
$ gdb --version
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".

 * GCC version
$ gcc --version
powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The behavior IS reproducible with emacs 

  GNU Emacs 23.1.50.1 (powerpc-apple-darwin8.11.0, NS apple-appkit-824.48)
  (also running on Mac OS X 10.4.11)

The behavior IS reproducible with emacs

  GNU Emacs 23.1.90.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
  running on Mac OS X 10.5.8

As noted above, the behavior is NOT reproducible with 

  GNU Emacs 23.1.1 (powerpc-apple-darwin8.11.0, NS apple-appkit-824.48)

It is also NOT reproducible with 

  GNU Emacs 22.3.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)




If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/Applications/Emacs.app/Contents/Resources/etc/DEBUG.


In GNU Emacs 23.1.90.1 (powerpc-apple-darwin8.11.0, NS apple-appkit-824.48)
 of 2009-12-09 on spud.local
Windowing system distributor `Apple', version 10.3.824
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t - e m <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util
mail-prsvr gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash
mail-utils warnings emacsbug sendmail regexp-opt tooltip ediff-hook
vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)
[23.1.1.png (image/png, attachment)]
[gud-23.1.1.txt (text/plain, attachment)]
[gud-23.1.90.1-annotate.txt (text/plain, attachment)]
[gud-23.1.90.1-b-main.png (image/png, attachment)]
[gud-23.1.90.1.txt (text/plain, attachment)]
[Message part 7 (application/pgp-signature, inline)]

This bug report was last modified 15 years and 231 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.