Next: Version Control System, Previous: Source Browsing, Up: Top

## 11 Debugging

GPS is also a graphical front-end for text-based debuggers such as GDB. A knowledge of the basics of the underlying debugger used by GPS will help understanding how GPS works and what kind of functionalities it provides.

Please refer to the debugger-specific documentation - e.g. the GDB documentation (gdb.html) - for more details.

Debugging is tightly integrated with the other components of GPS. For example, it is possible to edit files and navigate through your sources while debugging.

To start a debug session, go to the menu `Debug->Initialize`, and choose either the name of your executable, if you have specified the name of your main program(s) in the project properties, or start an empty debug session using the `<no main file>` item. It is then possible to load any file to debug, by using the menu `Debug->Debug->Load File...`

Note that you can create multiple debuggers by using the `Initialize` menu several times: this will create a new debugger each time. All the debugger-related actions (e.g. stepping, running) are performed on the current debugger, which is represented by the current debugger console. To switch between debuggers, simply select its corresponding console.

After the debugger has been initialized, you have access to two new windows: the data window (in the top of the working area), and the debugger console (in a new page, after the Messages and Shell windows). All the menus under `Debugger` are now also accessible, and you also have access to additional contextual menus, in particular in the source editor where it is possible to easily display variables, set breakpoints, and get automatic display (via tool tips) of object values.

When you want to quit the debugger without quitting GPS, go to the menu `Debug->Terminate Current`, that will terminate your current debug session, or the menu `Debug->Terminate` that will terminate all your debug sessions at once.