GNU Debugger

From Canonica AI

Overview

The GNU Debugger (GDB) is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, C, C++, Objective-C, Free Pascal, Fortran, Go and partially others. GDB was first written by Richard Stallman in 1986 as part of his GNU system, after his GNU Emacs was "reasonably stable". GDB is free software released under the GNU General Public License (GPL). It was modeled after the DBX debugger, which came with Berkeley Unix distributions.

Features

GDB offers extensive facilities for tracing and altering the execution of computer programs. The user can monitor and modify the values of programs' internal variables, and even call functions independently of the program's normal behavior.

GDB targets many programming languages, including C, C++, Java, Rust and more. GDB can debug programs written in Ada, C, C++, Objective-C, Pascal (and the GNU variants of these languages), and Fortran. GDB can be used to debug code that is running on the same machine as GDB (native) or on another machine (remote). Remote debugging is useful when the target machine is not capable of running GDB, for example in embedded systems environments.

A screenshot of a terminal window running the GNU Debugger, showing a debugging session of a C program.
A screenshot of a terminal window running the GNU Debugger, showing a debugging session of a C program.

Usage

GDB offers a 'command line interface' and a 'graphical user interface' in addition to a version that interfaces with the Eclipse IDE. In addition, the debugger supports a mode which allows the debugger to be used as a remote debugger on a target system while command line commands are input from the host system.

Extensions

GDB offers a 'Python API' that allows the debugger's functionality to be extended using Python scripts. The Python API allows scripts to control GDB, define new commands, and implement new types of breakpoints, among other things.

See Also