I built a new version of GDB and it works properly from terminal. Now I want it to be executed when I run M-x gdb from emacs.

1 Answer 1


When you M-x gdb, Emacs will present you with a command-line in the minibuffer, like:

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

You can edit this to supply a path to gdb, like:

~/my/install/bin/gdb -i=mi something
  • Yes I was able to run gdb but the problem is it does not integrate as the way the old gdb did. So i cannot see the breakpoint symbol being hit, navigate the source code by stepping, etc. Is there a way to do that, may be something in .emacs file
    – SujanKh
    Jul 7, 2015 at 20:12
  • Note that you can customize gud-gbd-command-name to set the default command rather than changing the path every time. You do need to include the -i=mi argument, though.
    – glucas
    Jul 7, 2015 at 20:47
  • If it doesn't work with a new gdb, I would start by making sure that gdb is working ok; maybe running it with -i=mi to make sure MI mode is working -- just a smoke test. After that maybe I would make sure Emacs is using MI correctly. Maybe there's been some bug fixes or whatever.
    – Tom Tromey
    Jul 7, 2015 at 21:00
  • By using your answer I was able to run the new gdb in emacs but it did not allow me to navigate through the source file. It is just like running gdb in a terminal. For example with the default gdb in emacs, I can step through the source code visually.
    – SujanKh
    Jul 7, 2015 at 22:03

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.