16 Debugging your application

You can set up in the project file a command to use to debug your application. Emacs is compatible with a lot of debuggers, and provide an easy interface to them.

This selection will focus on the gdb debugger, and two of the graphical interfaces that exist for it.

In all cases, the main window in Emacs will be split in two: in the upper buffer, the source code will appear, whereas the debugger input/output window is displayed at the bottom. You can enter the debugger commands as usual in the command window. Every time a new source file is selected by the debugger (for instance as a result of a frame command), the appropriate source file is displayed in the upper buffer.

The source window is interactive: you can click on an identifier with the right mouse button, and print its value in the debugger window. You can also set a breakpoint simply by right-clicking on a line.

You can easily use Emacs as the source window when you are using a graphical interface for the debugger. The interesting thing is that, whereas you still have the graphical nifties, you can also you the cross-references features that the ada-mode provides to look at the definition for the identifiers,...

Here is how you can set up gdbtk and ddd for use with Emacs (These are the commands you should setup in the project file):