UndoDB is the first reversible debugger for Linux fast enough, and with memory consumption low enough, to be used on complex code. In this screencast, we will show you how to set up UndoDB within Emacs.

Setting up UndoDB within emacs is simple.

1. Load the program in emacs. First, make sure undodb-gdb is in your path. Once undodb-gdb is in your path, as in our example, type

M-x gdb

You will get a prompt similar to the one displayed here. We need to modify the prompt so that it points to undodb.

2. Alter the prompt so that it reads

undodb-gdb -i=mi a.out

then the name of your program. Hit enter. There is a possibility that when you run the program, you will see an error message stating that non-stop mode is not supported, as shown here.

3. UndoDB doesn't currently support non stop mode, so we need to use all stop mode. To do this, we need to quit the debugger and go back to the program we are debugging.

- Type customize.

- Select programming.

- Select tools.

- Select gdb.

Scroll down and select gdb non stop. Click on the left-hand arrow beside gdb non stop setting and select 'toggle'. Apply and save the changes.

4. Let’s return to the program we are debugging. Enter the undodb-gdb prompt to fire up the debugger, and we are ready to run undodb within Emacs.

Let’s run the program in UndoDB. We can step forwards as usual, but with UndoDB we can now also reverse step.

To see how to set up UndoDB within DDD and Eclipse, please see our other screencasts, or watch an example debugging session with UndoDB.