I am following the tutorial Open GDB (within Emacs for added functionality) on Emacs 25.2.1 with Evil Spacemacs and Ivy (the commands gud-gdb and gdb get the same results):

SPC f f (counsel-find-file) Find file: tutorial/foo.c
SPC c C (compile) Compile command: gcc -g -o foo foo.c
SPC SPC M-x gud-gdb foo (match required)
SPC SPC M-x gud-gdb
Run gud-gdb (like this): gud-gdb foo

Here are the screen shots: enter image description here enter image description here

What does "like this" mean?

It opens GUD interaction buffer *gud-avg*. avg is the name of a previous program I was trying to debug.

Update: the GUD interaction buffer now opens to *gud-foo*.

Here are the screen shot: enter image description here

Any how, the GUD interaction buffer did open, but it's broken:

(gdb) list
Undefined command: "-interpreter-exec".  Try "help".
(gdb) help
Undefined command: "-interpreter-exec".  Try "help".
  • At kb.iu.edu/d/aqsy they use M-x gdb and not M-x gud-gdb. Note, that the grand unified debugger is not that grand. You could also try realgud.
    – Tobias
    Jun 28, 2017 at 20:58
  • M-x gud-gdb and M-x gdb get the same results. I was using GUD because it came with Spacemacs and is described in the Emacs manual. I will try realgud.
    – wolfv
    Jun 29, 2017 at 1:21
  • realgud worked on the first try. That was easy. Thanks Tobias!
    – wolfv
    Jun 29, 2017 at 2:03
  • I am always using gdb. For gdb the source of the error is pretty clear if you only use the command line gdb foo. You are missing the command line argument -i=mi. That argument says that gdb should provide the line based machine oriented text interface. It is unclear however why the emacs-command gdb does not include that command line argument in its default input. Did you edit the command line? The command line should read gdb -i=mi foo instead of gdb foo.
    – Tobias
    Jun 29, 2017 at 3:50
  • Thanks Tobias. "Run gdb (like this): gdb -i=mi foo" worked. I may have edited the command line the first time I tried the debugger, to match the command line shown in the tutorial. The Emacs manual and GDB tutorial don't mention anything like GDB/MI or RealGUD. gnu.org/software/emacs/manual/html_node/emacs/…
    – wolfv
    Jun 29, 2017 at 16:34

1 Answer 1


Open file and compile:

SPC f f (counsel-find-file) Find file: tutorial/foo.c
SPC c C (compile) Compile command: gcc -g -o foo foo.c

There are several debuggers that Emacs can use.

For GDB/MI https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html

Run gdb (like this): gdb -i=mi foo

For RealGUD, install RealGUD from https://github.com/realgud/realgud

SPC SPC load-library ENT realgud ENT
SPC SPC realgud:gdb
Run gdb (like this): gdb foo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.