6

I'm checking out a segfault in one of our apps. A short time after starting the app, the main gdb status bar changes to:

(Debugger:run [signal-received])

A (gdb) prompt appears but the contents of all other windows remain unchanged (empty). Typing anything at the prompt does nothing - gdb appears to be hanging. Running the same steps on the command line results in the expected output from gdb with a complete and correct backtrace.

This is my first time debugging with the -i=mi integration between emacs and gdb. I'm using emacs 24.2 and gdb 7.5.

Are there any suggestions on how I can debug this further?

Is it possible to reduce the level of integration? Would that allow me to determine which area is causing the problem?

A final point is that the initial loading of the app takes around 70s compared with around 3s from the command line.

Richard Corden
  • 21,389
  • 8
  • 58
  • 85

3 Answers3

8

You can use M-x gud-gdb to use the old gud mode (i.e. without the mi interaction). Less fancy but more reliable.

Stefan
  • 27,908
  • 4
  • 53
  • 82
  • Thanks for the response. Did you mean 'without' the `mi` interaction? Maybe I'm doing something wrong, but the `gud-gdb` mode appears to be quite a jump back from '--annotate=3' support. Particularly the link between debug location and the source. Is there a way to address this? When it stops at a break point I get `^Z^Z/home/richard/.../main.cpp:235:5568:beg:0x80a17d3`. – Richard Corden Dec 20 '12 at 08:59
  • You shouldn't see things like `^Z^Z/home/richard/.../main.cpp:235:5568:beg:0x80a17d3`, so I suspect GDB is not in the right annotation mode. For `gud-gdb`, GDB should be started as `gdb --fullname ...` IIUC. – Stefan Dec 20 '12 at 14:14
8

Load time can be reduced by setting gdb-create-source-file-list to nil (use customize). See the documentation for what this does and why it substantially increases load times in some instances.

Alastair
  • 4,475
  • 1
  • 26
  • 23
4

It appears that gdb-ui from emacs 23 will still work in emacs 24:

  • Find a copy of gdb-ui (In my case gdb-ui.el.gz and gdb-ui.elc from a backup)
  • Place these into a directory (I have added ~/emacs-modes)

Then add the following to your .emacs:

(add-to-list 'load-path "~/emacs-modes")
(require 'gdb-ui)

Running gdb will now use the old --annotate=3 mode rather than -i=mi.

Richard Corden
  • 21,389
  • 8
  • 58
  • 85