Conceptual Overview

A debugger is a program that lets you run a second program, which we will call the debuggee. The debugger lets you examine and change the state of the debuggee, and control its execution. In particular, you can single-step the program, executing one statement or instruction at a time, in order to watch the program’s behavior.

Debuggers come in two flavors: instruction-level debuggers, which work at the level of machine instructions, and source-level debuggers, which operate in terms of your program’s source code and programming language. The latter are considerably easier to use, and usually can do machine-level debugging if necessary. GDB is a source-level debugger; it is probably the most widely applicable (portable to the largest number of architectures) of any current debugger.

GDB itself provides two user interfaces: the traditional command-line interface (CLI) and a text user interface (TUI). The latter is meant for regular terminals or terminal emulators, dividing the screen into separate “windows” for the display of source code, register values, and so on.

GDB provides support for debugging programs written in C, C++, Objective C, Java™,[1] and Fortran. It provides partial support for Modula-2 programs compiled with the GNU Modula-2 compiler and for Ada programs compiled with the GNU Ada Translator, GNAT. GDB provides some minimal support for debugging Pascal programs. The Chill language is no longer supported.

When working with C++ and Objective C, GDB provides ...

Get GDB Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.