# Emacs¶

GNU Emacs is an extensible, customizable, free/libre text editor, bundled with most Linux distros.

Emacs ships with support for C and C++ debugging via GDB, and can be configured to use UDB.

## Using UDB in Emacs¶

1. Start a debugger session as normal by typing:

M-x gdb

2. Edit the command line to replace gdb with udb, e:g:

udb -i=mi ./myprogram

This assumes that udb is installed or is otherwise on your path. If it isn’t then supply the full path to the udb executable.

3. Type run to run your program as normal. You can use GDB’s standard set of navigation commands, plus UDB’s reverse navigation commands to navigate forwards and backwards through your program’s execution.

## Using UDB by default¶

To avoid having to edit the command line on every invocation customize the Emacs variable gud-gdb-command-name, set it to udb -i=mi, and “Save for Future Sessions”.