# 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 debugging session as normal by typing M-x gdb.

2. Edit the command line to replace gdb with udb, for example:

udb -i=mi examples/cache


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. Use the run command to run the program as usual. You can use execution, and reverse-execution commands to run forward and backward through the program’s execution history.

## 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”.