Fact-checked by Grok 2 weeks ago

GNU Debugger

The GNU Debugger (GDB) is a free and open-source debugger developed as part of the GNU Project, enabling programmers to inspect and control the execution of computer programs written in various languages, including C, C++, Fortran, Ada, and Rust. Originally authored by Richard Stallman around 1985, GDB allows users to set breakpoints, examine variables, step through code, and analyze program state during execution or after a crash on native, remote, or simulated systems. It was first publicly released in 1986 and has since evolved into a powerful tool under the GNU General Public License (GPL), granting freedoms to copy, modify, and distribute it with source code access. GDB supports debugging on most popular UNIX-like systems, Microsoft Windows, and macOS, with capabilities for both hosted and embedded environments. It accommodates a wide range of programming languages such as , D, Go, Objective-C, OpenCL C, and Pascal, making it versatile for across diverse architectures. Key contributors over the years include Michael Tiemann for C++ support, John Gilmore for early releases and architectural redesigns like the BFD library in 1990, and Stan Shebs for later versions, with ongoing maintenance by a collaborative team using public repositories. Among its notable features are watchpoints for monitoring variable changes, reversible debugging for replaying execution backward, and integration with scripting via a API, alongside support for the Debugger Adapter Protocol to enhance compatibility with integrated environments. GDB's has grown from a few thousand lines of C code to over half a million, incorporating advanced elements like explicit frame objects for stack analysis introduced in 2002 and extensive testing with over 18,000 cases as of its early phase. The latest stable release, version 16.3, was issued on April 20, 2025, with the GDB 17 branch created in September 2025 to address ongoing enhancements and bug fixes.

Overview

Purpose and Core Functionality

The GNU Debugger (GDB) is a portable and extensible source-level debugger designed for inspecting and controlling the execution of programs at the source code level. As part of the GNU Project, it enables developers to observe a program's internal behavior during runtime or analyze its state at the point of a , facilitating the identification and diagnosis of software bugs. GDB supports in languages such as and C++, allowing users to interact with programs compiled from these sources. At its core, GDB provides functionality to attach to running processes, load files, and examine key elements of program state, including contents, CPU registers, and traces. This is achieved by leveraging debugging information embedded in the , which maps low-level machine instructions back to high-level constructs. GDB commonly utilizes the debugging format for this purpose, as it offers expressive support for describing structure, variables, and execution flow in a compiler-independent manner. GDB can be invoked in several basic ways to initiate a debugging session, such as running gdb [program](/page/Program) to load and start an directly, or gdb [program](/page/Program) [core](/page/Core_dump) to analyze a file generated from a crashed . Additionally, it supports attaching to an already running using gdb [program](/page/Program) [pid](/page/PID), where pid is the process identifier, enabling non-intrusive inspection without restarting the . These methods ensure flexibility in scenarios, from live executions to post-mortem analysis.

Importance in Software Development

The GNU Debugger (GDB) plays a pivotal role in by accelerating the detection and resolution of bugs, enabling developers to efficiently trace execution paths and inspect program states in real-time or post-mortem scenarios. As a source-level debugger, it supports the analysis of complex codebases, including those with millions of symbols, by leveraging symbolic information to map low-level machine instructions back to high-level , enabling startup times for symbol loading to be reduced from minutes to seconds in large projects like Emacs or Firefox. Furthermore, GDB's free and open-source nature under the GNU General Public License (GPL) ensures widespread accessibility, allowing developers worldwide to modify, extend, and distribute it without licensing barriers, fostering in open-source ecosystems. GDB is particularly valuable in diverse use cases, such as debugging crashes in systems via remote connections with tools like , optimizing performance bottlenecks in applications on multicore architectures, and identifying logic errors in desktop software written in compiled languages like and C++. In environments, it facilitates cross-debugging between and architectures, crucial for resource-constrained devices, while in contexts, it aids in analyzing multithreaded behaviors and core dumps from production failures. For desktop applications, GDB's ability to handle optimized code helps uncover subtle issues that might otherwise require extensive or printf-style . Compared to non-source-level debuggers, which operate directly on machine code and demand expertise in assembly language, GDB's symbolic approach is preferred for languages supporting debug symbols, as it provides intuitive views of variables, functions, and without delving into hexadecimal disassembly, thereby lowering the skill barrier and improving productivity in modern development workflows. This advantage is amplified through its integration with compilers like , where the -g flag embeds debug information during compilation, enabling GDB to correlate executable binaries with original source files for precise inspections.

History

Origins and Early Development

The GNU Debugger (GDB) originated in 1986 as a key component of the GNU Project, initiated by Richard Stallman to develop a free software symbolic debugger for the emerging GNU operating system. This effort was motivated by the need for an open-source alternative to proprietary debugging tools prevalent in commercial Unix environments, such as dbx from Sun Microsystems, ensuring that developers could freely inspect and control program execution without licensing restrictions. Stallman, already known for GNU Emacs, prioritized GDB after stabilizing Emacs, viewing it as essential for debugging the growing suite of GNU tools. Written primarily in , GDB's early implementation focused on systems, leveraging low-level s for process control. Development began around 1985–1986, with the initial codebase emphasizing portability and source-level capabilities for languages like . The first public release appeared in 1988, though changes before are not well documented, reflecting rapid iteration in the project's nascent phase. GDB drew conceptual influences from established Unix mechanisms, including the for tracing and manipulating processes, as well as command syntax from BSD-derived debuggers like dbx, adapting these for a more extensible, machine-independent design. Key early contributors shaped GDB's foundation, with Stallman leading the core implementation and releases through version 2.8, assisted by collaborators such as Peter TerMaat, Chris Hanson, and Richard Mlynarik. John Gilmore played a pivotal role in the late 1980s and early 1990s, redesigning the target interface for better cross-platform support and integrating the Binary File Descriptor (BFD) library in 1990 to handle diverse object formats. These efforts also facilitated tight integration with the , enabling seamless debugging of code compiled with GCC's output, which was crucial for the GNU ecosystem's cohesion during its formative years up to the 1990s.

Major Releases and Milestones

GDB follows an annual major release cadence on a slip-for-slip schedule, where delays in branching propagate to release dates to accommodate essential fixes and features. In 1999, GDB's development shifted to a public repository hosted on Sourceware.org, a collaborative platform established in 1998 to manage open-source projects including binutils and , enhancing community-driven maintenance while retaining FSF stewardship. Significant milestones include GDB 6.0, released on October 6, 2003, which marked the start of the 6.x series with improvements in multi-architecture support and remote debugging capabilities. GDB 7.0, released on October 6, 2009, introduced full scripting integration via a new , enabling users to extend GDB with custom commands, pretty-printers, and automation scripts. GDB 10.1, released on October 24, 2020, enhanced handling of debug information format, including support for indexed strings and new attributes, improving compatibility with modern compilers. More recently, GDB 14.1, released on December 3, 2023, bolstered architecture support with better vector extension handling and multi-core debugging features. GDB 16.1, released on January 18, 2025, added watchpoint support for tagged data pointers, facilitating of tagging extensions in architectures like . The latest milestone, GDB 16.3, released on April 20, 2025, focused on bug fixes and stability enhancements as a corrective update over 16.2, addressing regressions in scripting and target descriptions. In September 2025, the GDB 17 branch was created for ongoing development and enhancements.

Supported Languages and Platforms

Programming Languages

The GNU Debugger (GDB) provides comprehensive support for debugging programs written in C and C++, including advanced handling of language-specific constructs such as templates and the Standard Template Library (STL). In C++, GDB demangles names, supports pretty-printing for STL containers like std::vector and std::map, and allows inspection of template instances through commands like ptype and print. For Fortran, GDB offers built-in support for array slicing and intrinsic functions, enabling users to display and manipulate multi-dimensional arrays directly in expressions, though variable names may require a trailing underscore depending on the compiler. Ada receives full semantic support in GDB, particularly for tasking features, with dedicated commands like info tasks to list and switch between concurrent tasks, and catchpoints for Ada exceptions. Beyond these primary languages, GDB supports debugging by disassembling code and examining registers at the machine level. For , integration is provided through the rust-gdb wrapper, which loads Rust-specific pretty-printers for types like enums and traits, though some value-printing behaviors differ from native Rust tools due to GDB's expression parser. Go programs can be debugged with support for goroutines and channels, while D and receive parsing for their object-oriented features, including Objective-C's method calls and categories. GDB also supports OpenCL C for debugging, Pascal, and Modula-2. support is limited to scripting and extending GDB itself via embedded Python code, rather than full source-level debugging of Python applications, which typically requires tools like the Python Debugger (pdb). GDB handles language-specific runtime behaviors, such as C++ exceptions, through catchpoints that pause execution on throw, catch, or unhandled exceptions, accessible via the catch throw command. To enable these features, programs must be compiled with debugging information, usually by passing the -g flag to compilers like or , which generates or STABS symbol tables for GDB to parse. Platform dependencies may influence the completeness of language support, such as Ada tasking availability in core dumps.

Operating Systems and Architectures

GDB is primarily designed for operating systems, with extensive native support on distributions, where it serves as the standard debugger integrated into development toolchains like . It also provides robust compatibility with BSD variants, including , , and , enabling native debugging on these platforms across various hardware configurations. macOS, based on , has native support, allowing debugging of executables, though it requires codesigning the GDB binary for process control due to macOS security policies. On Windows, GDB operates via emulation layers such as , , or the (WSL), facilitating debugging of native Windows applications or cross-compiled binaries without requiring a full Unix environment. Furthermore, GDB extends to embedded real-time operating systems (RTOS) like , supporting debugging of microcontroller-based applications on platforms such as , often in conjunction with hardware interfaces. In terms of processor architectures, GDB offers comprehensive support for widely used instruction sets, including x86 and for general-purpose computing, in both 32-bit (AArch32) and 64-bit () modes for mobile and embedded devices, for initiatives, PowerPC for legacy and high-performance systems, and for networking and embedded applications. Support for LoongArch, a Chinese-developed architecture, was introduced in GDB 13.1, including floating-point debugging capabilities on targets, broadening its applicability in diverse global hardware ecosystems. This multi-architecture capability is achieved through configurable builds that include architecture-specific backends, ensuring accurate symbol resolution and register handling across targets. Cross-debugging is a core strength of GDB, facilitated by , a lightweight companion program that runs on the target system to communicate with the host GDB instance over or connections using the GDB remote . This setup allows developers to debug executables compiled for one on a host machine of a different , such as examining an application running on an embedded device from an x86-64 desktop. gdbserver's portability makes it suitable for resource-constrained environments, supporting multi-process execution and attachment to running programs without embedding debug stubs in the target binary. Despite its broad portability, GDB has certain limitations tied to host and target environments; for instance, it lacks a built-in native on Windows, requiring third-party frontends like or for visual debugging. GDB's functionality depends on standard executable formats, including for and systems, Mach-O for macOS, and /COFF for Windows via or , with debug information typically in format to ensure compatibility across these platforms. Language support, such as for C++ or , may further depend on OS-specific debug info extensions within these formats.

Core Debugging Features

Stepping and Execution Control

The GNU Debugger (GDB) provides essential commands for controlling program execution, enabling users to start, resume, or advance through code line by line or function by function. These mechanisms form the foundation for interactive debugging, allowing precise navigation of program flow without full automation. The primary commands include run, which initiates program execution from the beginning or resumes from the last stop if already running, creating an inferior process and passing any specified arguments or environment settings. Similarly, continue (or c) resumes execution from the point of interruption until completion, a breakpoint, or a signal, with an optional ignore-count to bypass initial hits at the current location. For granular control, GDB offers stepping commands that advance execution incrementally. The step (or s) command executes the program until the next source line, entering function calls if debug information is available, while next (or n) steps over function calls to the subsequent line in the current function, treating called functions as single units. The finish (or fin) command runs the program until the current function returns, displaying the return value upon completion, which is particularly useful for tracing subroutine behavior. These commands support a count argument to repeat the action multiple times, and execution halts at breakpoints or watchpoints as needed. GDB supports two execution modes: synchronous (foreground), where the debugger waits for the program to stop before accepting further input, and asynchronous (background), enabled by appending & to commands like continue& or step&, allowing immediate prompting for additional commands during ongoing execution. Asynchronous mode requires target support and is ideal for multi-threaded debugging, with interruptions handled via the interrupt command to stop threads selectively or globally. Signal handling integrates seamlessly with execution control, enabling resumption after interruptions like SIGINT (keyboard interrupt) or SIGSEGV (segmentation fault). By default, GDB stops on erroneous signals such as SIGSEGV and prints details, but users can continue with signal 0 to ignore the signal and proceed, or use handle to configure behaviors like passing the signal to the program without stopping. For SIGINT, GDB typically halts execution, but continue resumes normally unless reconfigured. Watchpoints enhance conditional stepping by pausing execution when a watched expression changes, effectively creating data-dependent flow control during step or continue operations. Conditions can be added to watchpoints (e.g., for specific threads), triggering stops only under defined circumstances, which complements stepping by avoiding unnecessary pauses in complex code paths. Software watchpoints achieve this via single-stepping with value checks, though hardware watchpoints offer faster performance by monitoring memory access directly.

Breakpoints and Watchpoints

Breakpoints in the GNU Debugger (GDB) allow users to pause program execution at specified points, such as lines of or entries, facilitating detailed examination of program behavior. The primary command to set a breakpoint is break, which can target a name, like break main to halt at the start of the main , or a specific line, such as break file.c:42. Temporary breakpoints, set with tbreak, similarly but are automatically deleted after the first hit, useful for one-time pauses without manual cleanup. Conditional breakpoints extend this functionality by pausing execution only when a specified Boolean expression evaluates to true, invoked via break with an if clause, for example, break loop.c:10 if i > 5 to stop when variable i exceeds 5. This enables targeted debugging of rare events or specific states without repeated manual intervention. Watchpoints monitor changes to variables or memory locations, pausing execution upon read, write, or access. Hardware-assisted watchpoints, set with watch, leverage processor debug registers for efficient monitoring of simple variables, such as watch counter to detect modifications to counter. For more complex expressions or when hardware resources are exhausted, GDB falls back to software watchpoints, which insert breakpoints at potential modification sites in the code, though this approach is slower and less precise for large programs. Breakpoint and watchpoint management in GDB includes commands like info breakpoints to list all active points with details such as location, status, and hit counts; delete to remove specific ones by number; and disable or enable to toggle them without deletion. A notable enhancement in GDB 16.1 introduced support for tagged data watchpoints, allowing monitoring of memory regions with associated metadata tags, which aids in systems with tagged architectures such as ARM's Memory Tagging Extension (MTE). Hardware watchpoints are limited by the number of available debug registers on the target architecture; for instance, x86 processors typically support only four such slots, restricting simultaneous watchpoints to that count unless software emulation is used. Upon hitting a breakpoint or watchpoint, GDB enters a stopped state from which stepping commands can resume controlled execution.

Variable Inspection and Modification

In the GNU Debugger (GDB), variable inspection allows users to examine the current state of program variables, expressions, and memory during a debugging session, providing insights into data values, types, and structures without altering execution flow. This is typically performed after the program has paused, such as at a breakpoint, enabling developers to verify logic and identify issues like incorrect values or overflows. Core inspection features support both simple scalars and complex data types, with commands that output formatted results for clarity. The primary command for inspecting variables is print, abbreviated as p, which evaluates and displays the value and type of an expression. For example, print x prints the value of variable x, while print /d x formats it as a signed decimal integer; other formats include /x for hexadecimal, /f for floating-point, /a for addresses, and /s for strings. To automatically display expressions on each stop (e.g., during stepping), the display command is used, such as display x, which lists the expression in subsequent outputs until removed with undisplay. For local variables and function arguments in the current stack frame, info locals lists all locals with their values, and info args does the same for arguments, facilitating quick overviews of scope-specific state. Handling complex data types is supported through formatted printing and syntax extensions. Arrays can be inspected with print /a array to show elements in array format, or using the artificial array operator @, as in print *array@10 to display the first 10 elements starting from array. Structures and C++ objects are accessed via member notation, e.g., print struct_var.member or print object->method(), with options like set print pretty on enabling indented output for nested types to improve readability. Stack frames, which represent function call contexts, are examined using backtrace (or bt), which prints a summary of the call stack with one line per frame, including function names and arguments; bt 5 limits to the innermost five frames. Selecting a frame with frame n (where n is the frame number) allows inspection of its locals and args via the aforementioned info commands. For low-level memory inspection, the x (examine) command displays contents at a specified in various formats and sizes. Its syntax is x/nfu addr, where n is the repeat count, f the format (e.g., x for , s for , i for machine instructions), u the unit size (b for byte, h for halfword, w for word), and addr the starting . An example is x/4xw $sp, which examines four words in from the pointer $sp. Convenience variables like $_ (last examined ) aid iterative inspection. Variable modification alters state directly in the current using expressions via the set command, which avoids ing the result unlike print. The syntax is set var = expression, such as set var x = 42 to assign 42 to x; this evaluates the expression in the 's and updates accordingly. For convenience variables (starting with $), set $foo = *object stores a value without affecting the . Modifications take effect immediately upon resumption, allowing tests of boundary conditions or fixes during . GDB also supports postmortem analysis of crashed programs through core dump files, which capture the memory image at termination. To load a core dump, invoke gdb program core, where program is the executable and core the dump file; this enables inspection of variables, stack frames, and memory using the same commands as live sessions, such as print, backtrace, and info locals, without executing the program. This feature is essential for diagnosing segmentation faults or other failures in production environments where rerunning is impractical.

Advanced Debugging Capabilities

Remote and Cross-Debugging

The GNU Debugger (GDB) supports remote debugging, allowing users to debug programs executing on a separate machine or device from the host running GDB, which is particularly useful for resource-constrained or inaccessible targets. This capability extends to cross-debugging, where the host and target architectures differ, such as debugging binaries from an x86_64 host. GDB achieves this through lightweight stubs like on the target, which communicate with the host GDB instance using the Remote Serial Protocol (RSP). To set up remote debugging, gdbserver is run on the target system to launch or attach to the program, while a multi-architecture variant of GDB, such as gdb-multiarch, is used on the host to handle cross-architecture symbols and binaries. For example, on the target, the command gdbserver :2345 /path/to/program starts the program and listens on TCP port 2345; on the host, GDB connects via target remote target-host:2345 after loading the executable with file /path/to/program. For cross-debugging, the host specifies the target's system root or library paths using set sysroot to resolve shared libraries correctly. Serial connections are also supported, such as gdbserver /dev/ttyS0 program on the target and target remote /dev/ttyS0 on the host. The RSP serves as the underlying , enabling packet-based communication over lines, TCP/IP, or USB for controlling execution, reading memory, and managing registers without requiring a full GDB on the . It uses checksums for error detection and supports commands like stepping, breakpoints, and data transfer, making it suitable for low-bandwidth links. Common use cases include devices via serial or TCP connections, where 's small is advantageous, and native applications, which can be debugged by running gdbserver on the device and from a GDB instance. Cross-compilation scenarios, such as an x86 targets, leverage this setup to inspect binaries built for the remote architecture. Security is a critical concern, as gdbserver lacks built-in or , providing full access to the target's memory and potentially other resources upon connection. Users must restrict access using host firewalls to allow only trusted IP addresses on the chosen and avoid exposing gdbserver to public networks; for added protection, connections can be tunneled over SSH.

Reversible Debugging

Reversible in the GNU Debugger (GDB) enables users to record the execution trace of a and replay it forward or backward, facilitating the inspection of states at any point in the execution . This feature, also known as record-and-replay or time-travel , is particularly valuable for analyzing complex behaviors without restarting from the beginning each time. The mechanism operates by first activating recording mode, which logs the effects of each machine instruction executed by the inferior process. Users initiate recording with commands such as record full start, which employs software to capture a complete including modifications and changes, or record btrace, which leverages branch tracing for more efficient logging of control-flow events on supported processors like Intel's Processor Trace. Once recording begins—typically after starting the program with run or start—GDB maintains an execution log that can be navigated during replay. Key commands for backward execution include reverse-step (or reverse-stepi for instructions), which executes the program backward one step at a time, and reverse-continue, which runs the program backward until a or watchpoint is hit. Additional navigation is possible via record goto to jump to specific points in the log, such as the beginning (begin) or end (end), or by instruction number. This integration allows seamless use alongside standard stepping commands for bidirectional control. Built-in support for reversible debugging was introduced in GDB 7.0 in 2009 through the initial process record and replay target, providing foundational software-based recording. Subsequent enhancements include the addition of hardware-assisted btrace recording in GDB 7.12, which reduces overhead by focusing on branch traces rather than full instruction emulation, and further improvements like API support for clearing trace data in GDB 11.1. For scenarios requiring even greater efficiency or scalability, extensions such as UDB (from Undo.io) build upon GDB's framework to offer optimized record-and-replay capabilities, though these are not part of the core GDB distribution. Common use cases for reversible debugging include diagnosing non-deterministic bugs, such as those arising from race conditions in multithreaded applications, where replaying and rewinding execution allows developers to isolate the exact sequence leading to a failure. By recording a session once and then exploring it iteratively, users can set breakpoints in the past or step backward from a to pinpoint root causes that might otherwise require multiple reruns with varied inputs. This approach is especially effective for intermittent issues that are difficult to reproduce in forward-only . Despite its utility, reversible debugging has notable limitations, primarily high resource consumption in software-based modes. The record full method, for instance, can consume significant —defaulting to a limit of about 200,000 instructions (configurable via set record full insn-number-max)—as it stores detailed state changes, making it impractical for long-running or memory-intensive programs. btrace mitigates this by using processor ring buffers (e.g., 64KB default for Intel BTS), but it only captures branches, omitting data accesses, and requires compatible hardware. Platform support is restricted to architectures like x86, ARM, AArch64, PowerPC, , and others primarily on /Linux, with no native support on Windows or macOS. Recording also pauses or alters execution timing, which may affect timing-sensitive bugs.

Multi-Process and Thread Support

The GNU Debugger (GDB) provides comprehensive support for debugging multi-threaded programs, allowing users to manage and inspect within a single process or inferior. in GDB are identified by unique per-inferior IDs and global IDs, sharing the same but maintaining separate registers and stacks. The designates a "current " for focused , while enabling observation of all during execution. Key commands facilitate thread management. The info threads command lists all threads, displaying their IDs, global IDs, system tags, names, and current frames, with options to filter by stopped or running state. To switch the current thread, users employ thread thread-id, where thread-id is the local ID from the info threads output. For applying commands across multiple threads, thread apply [thread-id-list | all] command executes the specified command on selected or all threads, supporting flags like -c for continuing on errors and -s for silent operation. Thread naming via thread name [name] and searching with thread find [regexp] further aid in organization. GDB operates in all-stop mode by default, where the entire halts when any hits a or receives a signal, simplifying but potentially slowing execution. In contrast, non-stop allows individual to continue running independently, enabling examination of stopped while others proceed, which is useful for asynchronous or applications. To control scheduling, the set scheduler-locking [mode](/page/Mode) command restricts which resume during execution: off permits all , on limits to the current (halting new at entry), step behaves like on only during stepping to avoid preemption, and replay applies on in replay . Thread-specific breakpoints enhance targeted debugging by triggering only for designated threads. Set using break locspec thread thread-id, where locspec is the location and thread-id the target thread's ID, these breakpoints ignore hits from other threads and are automatically deleted if the specified thread exits. Conditional variants, such as break locspec thread thread-id if condition, further refine control, for example, break frik.c:13 thread 28 if bartab > lim. GDB also supports thread-local storage (TLS) access, such as inspecting errno per thread on GNU/Linux and FreeBSD platforms. For multi-process debugging, GDB treats each as an "inferior," supporting attachment to multiple processes within a session. The info inferiors command lists all inferiors, showing their GDB-assigned numbers, system IDs, connection types, and executables. Switching occurs via inferior inf-no, while add-inferior creates new entries and remove-inferiors deletes non-running ones. Attachment to a running uses attach pid, and detachment employs detach inferior inf-no, leaving the inferior entry intact but disconnected. Killing is handled by kill inferiors inf-no-list. When programs fork child processes, GDB's set follow-fork-mode directs debugging focus: parent (default) continues with the parent, while child switches to the child. The set detach-on-fork setting determines handling of the non-followed process: on (default) detaches it to run freely, and off maintains control over both, allowing management via info inferiors and inferior commands. This support is available on GNU/Linux kernels from version 2.5.46 onward, in both native and gdbserver modes. Variable inspection in GDB can span threads by switching the current or using thread-specific commands, revealing per-thread values like TLS variables. Since GDB 12, enhancements to non-stop mode and asynchronous event handling have improved support for debugging threads involved in async I/O operations, reducing interruptions in concurrent environments.

User Interfaces

Command-Line Interface

The GNU Debugger's command-line interface (CLI) serves as the primary mode for text-based interaction, where users enter commands at a prompt indicated by (gdb) to control program execution and examine state. This interface leverages the GNU Readline library for enhanced usability, allowing seamless input editing and navigation. Command history enables recalling prior inputs efficiently; pressing the up arrow key cycles through previously entered commands, while the history is saved to a file such as .gdb_history upon exit if configured with set history save on. Tab completion further streamlines operation by suggesting and auto-filling command names, subcommands, program symbols, and filenames when the Tab key is pressed, with repeated presses displaying available options. The built-in help system provides comprehensive guidance directly within the CLI. The help command, abbreviated as h, lists all command classes such as "aliases" or "breakpoints" when invoked without arguments; help class details commands in a specific category, and help command offers syntax and usage for individual commands. Complementing this, info help outlines categories of the info subcommands, which query the program's current state, such as breakpoints or registers. Customization enhances the CLI's flexibility through initialization files. The user's ~/.gdbinit file, executed automatically at startup unless disabled with options like -nx, allows defining command aliases via the define directive—for instance, define adder followed by a sequence of commands and end creates a shorthand for common operations, accessible by name thereafter. Local .gdbinit files in the current support project-specific setups and are auto-loaded by default, controlled by set auto-load local-gdbinit on and secured via set auto-load safe-path to prevent loading from untrusted locations. Output formatting options tailor display for clarity and efficiency. The set print elements 0 command disables the default limit of 200 elements, allowing unlimited to avoid truncation and provide fuller views without additional prompts.

Graphical User Interfaces

The GNU Debugger (GDB) supports a range of third-party graphical user interfaces (GUIs) that enhance usability by providing visual tools for tasks, often built atop GDB's (CLI) via its machine interface (MI) . These GUIs abstract complex CLI commands into intuitive point-and-click interactions, making them particularly valuable for developers seeking integrated within development environments. One of the most established standalone GUIs is the Data Display Debugger (), developed under the GNU Project, which offers advanced visualization of data structures as interactive graphs alongside viewing and execution control. supports GDB (version 4.16 and later) as its primary backend, enabling features like visual breakpoints, expression watches, and navigation through graphical representations. It also accommodates other debuggers such as DBX and JDB, though for non-GDB interfaces has been inactive since version 3.4. Integrations within integrated development environments (IDEs) further extend GDB's graphical capabilities. , the C/C++ Development Tooling plugin for , embeds GDB for full-featured debugging, including visual breakpoint setting in the editor margin, real-time variable inspection in a dedicated watch window, and graphical traces. Similarly, Code::Blocks IDE incorporates GDB via its built-in plugin, supporting watch expressions, memory views, and disassembly alongside source-level stepping. provides GDB integration through configurable preferences, allowing users to set visual breakpoints, monitor threads, and examine locals in a multi-pane interface tailored for and C++ projects. For , the official C/C++ extension provides robust GDB integration, enabling features such as inline variable hovers, conditional editors, and visualizations directly in the editor. Another option is the third-party Native Debug extension, which also leverages GDB to deliver browser-like debugging with similar capabilities. users benefit from the built-in GDB mode, invoked via M-x gdb, which creates a multi-buffer layout for , breakpoints, stack frames, and locals, supporting mouse-driven interactions like clicking to set breakpoints. These tools collectively provide graphs (prominent in and VS Code) and persistent variable watches, streamlining common workflows without leaving the . Despite their advantages, GDB GUIs generally act as wrappers around the CLI backend, inheriting its strengths while introducing limitations such as incomplete support for advanced or platform-specific features—like stepping into dynamic libraries on certain systems—requiring users to fall back to direct GDB commands for full control.

Machine Interface for Integration

The GNU Debugger's Machine Interface () provides a structured, line-based for programmatic interaction with GDB, enabling seamless into external applications such as integrated development environments () and automated testing frameworks. This interface is activated by invoking GDB with the --interpreter=mi option, transforming its output into a machine-readable format rather than human-oriented console responses. Designed primarily for embedding GDB as a backend component, facilitates control over debugging sessions, including execution, breakpoint management, and variable inspection, without relying on parseable text from the . GDB/MI has evolved through three major versions to enhance reliability and expressiveness. , introduced in GDB 5.3, offered basic synchronous command-response interactions. , available since GDB 6.0, added asynchronous event reporting, allowing notifications for events like stop or running states without blocking command execution. The current MI Version 3 (MI3), implemented starting with GDB 9.1, incorporates annotations for complex outputs, such as multi-location breakpoints, and refines syntax for more robust parsing by frontends. Earlier versions like and remain supported for compatibility but are deprecated in favor of MI3. The protocol's output is organized into result records prefixed with tokens like ^done for successful completions, ^error for failures, or ^running for asynchronous starts, followed by key-value pairs in a format resembling name="value". Commands are issued with a leading hyphen, such as -exec-run to initiate program execution or -break-insert -f main to set a breakpoint at the main function, each eliciting structured responses that include details like thread states or stack frames. Out-of-band records, marked with ~ for console output or @ for logs, interleave with results to provide contextual notifications, ensuring frontends can synchronize events accurately. Common use cases for GDB/MI center on IDE backends, where it powers debugging features in tools like Eclipse CDT, which leverages the protocol to visualize variables, control execution, and handle multi-threaded sessions. Similarly, extensions in and other editors use GDB/ to automate remote debugging and integrate with build pipelines for / (CI/CD) environments, allowing scripted analysis of crashes without manual intervention. This integration supports cross-platform development by abstracting GDB's core functionality into extensible APIs, reducing the need for custom parser implementations in frontend applications.

Scripting and Extensions

Built-in Command Scripting

The GNU Debugger (GDB) provides built-in command scripting capabilities through user-defined commands and command files, enabling users to automate sequences of debugging tasks without relying on external scripting languages. This facility allows for the creation of macros that encapsulate repetitive operations, such as setting multiple breakpoints or inspecting variables in a loop, directly within GDB's command-line interface. These features are particularly useful for streamlining workflows in batch or interactive debugging sessions. User-defined commands are created using the define command, which assigns a new name to a sequence of existing GDB commands. The syntax is define command-name followed by the commands to execute, terminated by end. For example, to define a command that prints the values of two variables, one might use:
define print_vars
print var1
print var2
end
This command can then be invoked simply as print_vars. If the command name already exists, GDB prompts for confirmation before redefining it. Documentation for user-defined commands can be added with the document command, using similar syntax, and viewed via help command-name. User-defined commands support arguments, allowing dynamic behavior. Arguments are passed as whitespace-separated tokens and accessed via $arg0 through $argN, with $argc indicating the number of arguments. For instance, a command to add numbers could be defined as:
define adder
if $argc == 0
  echo No arguments provided\n
else
  set $sum = 0
  set $i = 0
  while $i < $argc
    set $sum = $sum + $arg$i
    set $i = $i + 1
  end
  print $sum
end
end
This example demonstrates argument handling combined with control structures. Command files extend scripting by allowing sequences of commands to be stored in text files, with lines starting with # treated as comments. These files are executed using the source command, with syntax source filename, where filename typically ends in .gdb. Options include -s to search the source path and -v for verbose execution, displaying each command as it runs. GDB searches for the file in the current directory first, then along the source path set by the directory command. This mechanism supports batch automation, such as loading symbols for multiple shared libraries via repeated add-symbol-file commands in a single file. GDB's scripting includes basic control flow for loops and conditionals. The while command implements loops with syntax while expression followed by commands and end, repeating as long as the expression evaluates to nonzero. Within loops, loop_continue skips to the next iteration, and loop_break exits early. The if command handles conditionals: if expression executes commands if true, optionally followed by else for the alternative branch, all ending with end. Stepping commands can be conditional, such as step if expression, which advances only when the condition holds. These constructs enable scripts to iterate over data structures or perform repetitive inspections, like printing array elements until a sentinel value is reached. Logging captures session transcripts for review or automation verification. The set logging enabled on command starts logging GDB's output to a file, defaulting to gdb.txt, while set logging enabled off stops it. By default, output appends to the file and appears both on the terminal and in the log; set logging redirect on sends output solely to the file, and set logging overwrite on replaces the file instead of appending. The set logging file filename command specifies a custom log path. This feature is valuable for recording scripted sessions, such as automated symbol loading or variable inspections, to analyze results offline. Common use cases include batch loading of symbols for complex programs with many shared libraries, achieved by scripting multiple add-symbol-file invocations in a command file sourced at startup. Repetitive inspections, such as monitoring a variable across loop iterations in the debugged program, leverage while loops to execute print commands conditionally until a breakpoint or exit condition. For more advanced needs, such as full programmatic control, GDB offers integration with .

Python and Guile Integration

The GNU Debugger (GDB) integrates Python scripting starting with version 7.0, allowing users to extend its functionality through the gdb Python module, which provides access to GDB's internals for creating custom commands, automating tasks, and enhancing data visualization. This integration requires GDB to be configured with the --with-python option during compilation and enables importing the gdb module within Python scripts to interact with debugging sessions. Key features include pretty-printers, which customize the display of complex data types, and event hooks via the gdb.events module, which allow scripts to respond to debugging events such as stops or continuations. Pretty-printers in GDB's Python API enable tailored output for specific types, such as improving the readability of Standard Template Library (STL) containers or user-defined structures by overriding default printing behavior. For instance, a pretty-printer can be implemented as a subclass of gdb.DefaultPrettyPrinter to parse and format a custom linked list structure, displaying its nodes recursively without manual traversal commands. Event hooks, accessed through gdb.events, facilitate reactive scripting; an example is registering a callback on gdb.events.Stop to automatically inspect variables upon breakpoint hits, enhancing workflow automation. Custom commands can be defined by subclassing gdb.Command, providing a way to encapsulate logic for parsing intricate data structures directly in GDB's command-line interface. For example, a Python script might define a dump_struct command that takes a variable name as input, dereferences pointers in a custom binary tree structure, and prints node values with indentation to reflect hierarchy:
class DumpStruct (gdb.Command):
    def __init__ (self):
        super (DumpStruct, self).__init__ ("dump_struct", gdb.COMMAND_DATA)

    def invoke (self, arg, from_tty):
        # Parse arg as gdb.Value and traverse structure
        val = gdb.parse_and_eval (arg)
        # Custom logic to print tree nodes
        print_tree (val)

DumpStruct ()
This approach integrates seamlessly with GDB, allowing invocation like dump_struct my_tree during a session. Python scripts support auto-loading, where modules placed in GDB's data directory (e.g., data-directory/python) are automatically imported upon startup or when relevant object files are loaded, streamlining extension deployment. GDB also supports Guile, an implementation of the Scheme programming language, for scripting since version 7.8, offering a functional paradigm for extensions that complements Python's imperative style. This requires configuration with --with-guile and Guile version 2.0 or later (including 3.0), with scripts installed in data-directory/guile for automatic path inclusion. Users interact via the guile command to evaluate Scheme expressions or guile-repl for an interactive REPL, enabling concise functional scripts for tasks like data transformation during debugging. For example, a Guile script could define a procedure to filter and display inferior process variables matching a pattern, leveraging Scheme's list-processing primitives for elegant extensions. Starting with GDB 13, Python 2 support has been fully removed, mandating Python 3 and enhancing compatibility with modern versions like 3.8 and above for improved scripting performance and security features. These updates include refined auto-loading mechanisms and API stability, ensuring robust integration for contemporary development environments.

Customization and Plugins

GDB supports customization through initialization files that allow users to configure the debugger's behavior upon startup. The primary user-specific file is .gdbinit, located in the user's home directory ($HOME/.gdbinit), which executes GDB commands automatically when the debugger starts. System-wide configurations are handled by /etc/gdbinit and the directory /etc/gdbinit.d/, where additional script files can be placed for global settings on Red Hat-based systems and similar distributions. For security, GDB disables automatic loading of local .gdbinit files by default; users must enable it explicitly with set auto-load local-gdbinit on or configure safe paths using set auto-load safe-path to specify trusted directories for auto-loading scripts. GDB extends its functionality via plugins, primarily through auto-loading mechanisms that integrate external scripts when object files are read. One key method is the objfile-gdb.ext file, where objfile matches the name of the binary being debugged (e.g., program-gdb.py for a Python extension); GDB automatically loads this script if it exists in a safe path, enabling application-specific commands without manual intervention. Popular community plugins built on this system include GEF (GDB Enhanced Features), a Python-based extension that enhances the command-line interface with contextual information, memory visualization, and exploit development tools like heap analysis. Another example is Pwndbg, a Python module designed for exploit development and reverse engineering, which adds utilities for register visualization, disassembly enhancements, and compatibility with emulators like QEMU. Users can further customize GDB's appearance and interactions through themes, aliases, and Text User Interface (TUI) bindings defined in initialization files. Custom prompts can be set with commands like set prompt "$$\033[01;32m$$\u@\h$$\033[00m$$:\w\$ ", enabling colored or context-aware displays. Aliases simplify complex commands via define, such as define pq\nprintf "%#x", $pc\nend, for quick disassembly lookups. In TUI mode, key bindings can be remapped (e.g., using Ctrl+X A to toggle the interface), and styling options like set style tui-border normal control colors and borders for better readability. Recent community extensions have incorporated AI for debugging assistance, leveraging plugins to provide intelligent hints. For instance, gdb-ollama integrates local large language models via Ollama into GDB, offering real-time insights on code states, variable analysis, and bug suggestions directly within the debugger session as of 2025. Similarly, the GDB Debugger MCP Server enables AI-driven workflows for C++ debugging, allowing assistants to query and manipulate GDB states through natural language interfaces. These tools build on as a base for plugin development, enhancing GDB's extensibility for modern, AI-augmented debugging.

Internals

Architectural Components

The GNU Debugger (GDB) employs a layered architecture that separates concerns into symbol handling, target interaction, and expression evaluation to facilitate debugging across diverse platforms and languages. At its core, GDB's symbol side manages debugging information from object files, interpreting formats to build symbol tables that map program elements like functions and variables to memory addresses. This layer includes the symtab-and-line mapping mechanism, which uses partial and full symbol tables along with line number tables to enable efficient source code correlation with execution points, supporting lookups from addresses to source lines and vice versa. The value and expression parser forms another foundational layer, processing user-specified expressions in supported languages such as C and C++ through a Yacc-generated grammar that constructs abstract syntax trees. These trees are evaluated to compute values from the inferior process's memory, assuming flexible typing to handle operations like dereferencing pointers or array slicing without strict type enforcement during parsing. Inferior management, handled via the target subsystem, oversees the debugged program's lifecycle using a stack of target vectors—over 40 implementations for hosts like Linux or embedded systems such as Xilinx MicroBlaze—allowing layered operations from high-level process control (e.g., starting execution) down to low-level register access. Key modules integrate with these layers to support file I/O and operations. The Binary File Descriptor (BFD) library provides a uniform interface for reading and writing object files in formats like ELF and COFF, enabling GDB to load executables and libraries regardless of the underlying binary structure, a capability introduced in 1990 for cross-development tools. GDB's event loop, restructured in 1999 to an event-driven model, processes asynchronous events such as signals from the inferior or responses from the Machine Interface (MI) through queues and the wait_for_inferior function, ensuring responsive handling without blocking the main thread. GDB's build system relies on Autotools, generating a configure script that detects host and target configurations to enable or disable features like threading support or specific target backends via options such as --enable-tui for terminal user interface. This setup produces Makefile fragments and customized headers, allowing compilation for over 20 host architectures and numerous targets while integrating dependencies like BFD from the Binutils suite.

Data Formats and Symbol Handling

The GNU Debugger (GDB) primarily relies on the DWARF format for processing debugging information, supporting versions 2 through 5 as generated by modern compilers like . DWARF provides a structured, extensible representation of symbols, types, and source-level mappings embedded in executables and shared objects. Legacy support includes the STABS format, which encapsulates debugging data as symbol table strings within object files like a.out, COFF, or ELF, though it is largely superseded by DWARF due to its less efficient structure. For Windows environments, GDB offers limited handling of Microsoft's PDB format through extensions or third-party integrations, enabling symbol resolution in cross-platform scenarios but without full native parity to DWARF. GDB manages symbol tables in a multi-tiered approach to balance startup speed and detail access for large programs. Partial symbol tables (psymtabs) are loaded first, containing minimal symbols such as global functions, variables, and source file names, which allow quick lookups without parsing the entire debug data. Full symbol tables, with complete type information and local symbols, are expanded on demand from these partials when commands like breakpoints or variable inspections require them; this lazy loading is crucial for executables with millions of symbols. For massive files, partial symtabs mitigate memory overhead by deferring full reads, with options like set symbol-loading off or -readnever to skip even partial loading if needed. Symbol handling begins with reading debug sections from executables and dynamic shared objects (DSOs) using the Binary File Descriptor (BFD) library to access diverse binary formats like ELF or PE. GDB scans the debug info incrementally: for DWARF, it processes compilation units in .debug_info to build symtabs, while automatically adding symbols from loaded DSOs via add-symbol-file or during execution with set auto-solib-add on. Line number tables, typically from DWARF's .debug_line section, map instruction addresses to source lines and files, enabling accurate stack traces and stepping; these are indexed during partial symtab creation for efficient queries. In GDB 14 and later, optimizations enhance DWARF 5 processing, including better support for compressed debug sections using zlib (for .zdebug_* variants) and improved indexing to reduce parsing time for large, compressed inputs. These updates leverage DWARF 5's native compression features, such as skeleton units and address ranges, to minimize memory use while maintaining full symbol resolution.

Practical Usage

Essential Commands

To use the GNU Debugger (GDB) effectively, programs must first be compiled with debugging information enabled. This is achieved using the with the -g flag, which embeds symbol tables and source line mappings into the executable without altering its functionality. The typical syntax is gcc -g source.c -o program, where source.c is the source file and program is the output executable name. Among the core commands for initiating and managing a debugging session, the file command specifies the executable to debug by loading its symbol table and memory layout. Its syntax is file filename, which searches the PATH environment variable if no directory is provided; omitting the argument discards prior file information. The set args command defines command-line arguments for the program, using the syntax set args arglist (or set args to clear them), which take effect on the next execution; show args displays the current settings. To start program execution, the run command is used with syntax run [arglist], creating a new process and passing arguments via the shell if available (default /bin/sh); it requires a prior file specification and stops at breakpoints or the program's end. Finally, the quit command exits , with syntax quit [expression] (abbreviated q), where an optional expression sets the exit status; alternatively, exit [expression] or an end-of-file character (e.g., Ctrl-D) achieves the same. For navigation during debugging, the list command displays source code context, defaulting to 10 lines around the current position or main if none exists. Syntax includes list linenum to center on a line number, list function to show around a function's start, list first,last for a range, or list to continue from the previous display; set listsize count adjusts the line count (unlimited with unlimited), and show listsize views the setting. The disassemble command outputs machine instructions for a memory range, using syntax disassemble [start[,end]] (defaulting to the function at the program counter); modifiers like /m or /s mix source and disassembly, /r shows raw hex in instruction order, and addresses can be expressions (e.g., $pc - 8). To inspect hardware state, info registers lists register names and values in the current stack frame, with syntax info registers [regname ...] for specifics or info all-registers to include floating-point and vector registers; values are frame-relative, and <not saved> indicates unsaved caller registers. Error handling commands allow control over runtime events. The handle command configures GDB's response to signals, with syntax handle signal [keywords ...] where signal can be a name (e.g., SIGINT), number (1-15), range (e.g., 1-5), or all (excluding SIGINT and SIGTRAP); keywords include stop/nostop to pause/resume on signal, print/noprint for messaging, and pass/nopass to propagate/ignore to the program—erroneous signals default to stop, print, pass, while others default to nostop, noprint, pass. For catching specific events like exceptions, the catch command sets catchpoints to halt execution on occurrences such as C++ throw/catch, exec, fork, vfork, library loads/unloads, or Ada assertions, using syntax catch event (e.g., catch throw); supported events vary by language and target.

Sample Debugging Session

To illustrate a practical debugging session with GDB, consider a simple C program that computes the sum of an array's elements but contains a bug in the loop condition, causing an array overflow and eventual segmentation fault when accessing invalid memory beyond the array bounds.
c
#include <stdio.h>

int main() {
    int arr[5] = {1, 2, 3, 4, 5};
    int sum = 0;
    int i;
    for (i = 0; i < 10; i++) {  // Bug: loop limit should be 5, not 10
        sum += arr[i];
    }
    printf("Sum: %d\n", sum);
    return 0;
}
First, compile the program with debugging symbols enabled using : gcc -g -o buggy buggy.c. This generates an named buggy with symbol information for GDB to use. Launch GDB on the : gdb ./buggy. GDB starts and displays its and , such as (gdb). Set a at the beginning of the loop for inspection: (gdb) break 8, where line 8 is sum += arr[i];. GDB confirms: Breakpoint 1 at 0x40113e: file buggy.c, line 8. Run the program: (gdb) run. Execution halts at the : Breakpoint 1, main () at buggy.c:8 followed by 8 sum += arr[i];. Step through iterations using (gdb) next or (gdb) step to observe the loop. After several steps, when i reaches 5, GDB reports: Program received signal SIGSEGV, [Segmentation fault](/page/Segmentation_fault). 0x0000555555555169 in main () at buggy.c:8 8 sum += arr[i];. This indicates the invalid memory access. Inspect the state with (gdb) print i, yielding &#36;1 = 5, and (gdb) print [sum](/page/Sum), yielding &#36;2 = 15, and (gdb) print arr@5, showing the valid elements {1, 2, 3, 4, 5}. The backtrace (gdb) bt confirms the fault occurred in main, with output like #0 0x0000555555555169 in main () at buggy.c:8. To temporarily skip the faulty access and exit the loop, use (gdb) set i = 10 then (gdb) continue. This sets i beyond the loop condition, allowing the program to the correct sum of 15 and . The session ends with (gdb) quit. This reveals the off-by-five error in the loop bound (should be i < 5). For postmortem analysis without rerunning the program, enable core dumps by setting ulimit -c unlimited in the shell, then execute ./buggy outside GDB, producing a core file upon segfault. Load it into GDB: gdb ./buggy core. GDB reads the dump and stops at the fault: Program terminated with signal SIGSEGV, Segmentation fault. Use the same inspection commands like bt and print i to diagnose the overflow at i=5. In remote debugging scenarios, such as on an embedded target, start gdbserver :1234 buggy on the remote machine, then connect from the host: gdb ./buggy followed by (gdb) target remote target-ip:1234 and (gdb) run. The session proceeds similarly, halting at the segfault for inspection.

References

  1. [1]
    The Architecture of Open Source Applications (Volume 2)GDB
    GDB, the GNU Debugger, was among the first programs to be written for the Free Software Foundation, and it has been a staple of free and open source software ...
  2. [2]
    Debugging with GDB - Summary of GDB - MIT
    Richard Stallman was the original author of GDB, and of many other GNU programs. Many others have contributed to its development. This section attempts to ...
  3. [3]
    GDB News - Sourceware
    The latest version of GDB, version 14.2, is available for download. This is a minor corrective release over GDB 14.1, fixing the following issues.
  4. [4]
    GDB: The GNU Project Debugger
    ### Summary of GDB from https://sourceware.org/gdb/
  5. [5]
    Summary (Debugging with GDB) - Sourceware
    Summary of GDB​​ The purpose of a debugger such as GDB is to allow you to see what is going on “inside” another program while it executes—or what another program ...
  6. [6]
    Compilation (Debugging with GDB) - Sourceware
    You will have the best debugging experience if you use the latest version of the DWARF debugging format that your compiler supports. DWARF is currently the most ...
  7. [7]
    Invocation (Debugging with GDB)
    ### Summary of GDB Invocation Methods
  8. [8]
    Free Software (Debugging with GDB) - Sourceware
    GDB is free software, protected by the GNU General Public License (GPL). The GPL gives you the freedom to copy or adapt a licensed program.Missing: open | Show results with:open
  9. [9]
    Gnu Debugger - an overview | ScienceDirect Topics
    The GNU Debugger (GDB) is a powerful source-level debugging package widely used in computer science for debugging programs written in languages such as C and C ...
  10. [10]
    Top (Debugging with GDB) - Sourceware
    This file documents the GNU debugger GDB. This is the Tenth Edition, of Debugging with GDB: the GNU Source-Level Debugger for GDB (GDB)3 GDB Commands · 23 Extending GDB · 18 GDB Files · 1 A Sample GDB Session
  11. [11]
    GNU's Bulletin, vol. 1 no. 3 - GNU Project - Free Software Foundation
    GDB GDB is the source-level C debugger written for the GNU project in 1986. It offers many features not usually found in debuggers on Unix, such as a history ...Missing: origins | Show results with:origins
  12. [12]
    An update on GDB - LWN.net
    Apr 16, 2014 · Originally, there was a single maintainer for GDB; Richard Stallman was the first, and there were others, including Shebs, along the way. By ...
  13. [13]
    GDB - SEGGER Knowledge Base
    Jan 13, 2025 · GDB was modeled after the DBX debugger, which came with Berkeley Unix distributions. The initial GDB was written by Richard Stallman in 1986.Missing: origins | Show results with:origins
  14. [14]
    Debugging with GDB - Summary of GDB
    Richard Stallman, assisted at various times by Peter TerMaat, Chris Hanson, and Richard Mlynarik, handled releases through 2.8. Michael Tiemann is the author of ...Missing: 1986 | Show results with:1986<|control11|><|separator|>
  15. [15]
    Sourceware, one of the longest standing Free Software hosting ...
    May 15, 2023 · As a home for Free Software projects since 1998, Sourceware is a keystone in Free Software infrastructure. For almost 25 years Sourceware ...<|control11|><|separator|>
  16. [16]
    Release schedule for GDB - Sourceware
    GDB's schedule works on a slip-for-slip basis. If, for some reason, the branch date slips, the release date will slip by an equivalent amount.Missing: timeline | Show results with:timeline
  17. [17]
    GDB 6.0 Released! - GNU mailing lists
    Oct 6, 2003 · Version 6.0 of GDB, the GNU Debugger, is now available via anonymous FTP. GDB is a source-level debugger for C, C++, Pascal, Objective-C and ...
  18. [18]
  19. [19]
  20. [20]
  21. [21]
    GDB 16.1 released! - GNU mailing lists
    GDB 16.1 released! Release 16.1 of GDB, the GNU Debugger, is now available. GDB is a source-level debugger for Ada, C, C++, Fortran, Go, ...
  22. [22]
    GDB: The GNU Project Debugger
    ### Summary of GDB: The GNU Project Debugger
  23. [23]
    Debugging C Plus Plus (Debugging with GDB) - Sourceware
    The -qualified flag may be used to override this behavior, causing GDB to search for a specific function or type. The GDB command-line word completion facility ...
  24. [24]
    Special Fortran Commands (Debugging with GDB) - Sourceware
    GDB has some commands to support Fortran-specific features, such as displaying common blocks. When taking a slice from an array, a Fortran compiler can choose ...
  25. [25]
    Fortran Intrinsics (Debugging with GDB) - Sourceware
    Fortran provides a large set of intrinsic procedures. GDB implements an incomplete subset of those procedures and their overloads. Some of these procedures take ...
  26. [26]
    Ada (Debugging with GDB) - Sourceware
    Ada Tasks and Core Files: Tasking Support when Debugging Core Files. • Ravenscar Profile: Tasking Support when using the Ravenscar Profile. • Ada Source ...
  27. [27]
    Ada Tasks (Debugging with GDB) - Sourceware
    GDB provides the following task-related commands: This command shows a list of current Ada tasks, as in the following example.
  28. [28]
    Supported Languages (Debugging with GDB) - Sourceware
    GDB supports C, C++, D, Go, Objective-C, Fortran, OpenCL C, Pascal, Rust, assembly, Modula-2, and Ada. Some GDB features may be used in expressions regardless ...
  29. [29]
    Rust (Debugging with GDB) - Sourceware
    GDB supports the Rust Programming Language. Type- and value-printing, and expression parsing, are reasonably complete. However, there are a few peculiarities ...
  30. [30]
    Python (Debugging with GDB) - Sourceware
    You can extend GDB using the Python programming language. This feature is available only if GDB was configured using --with-python.
  31. [31]
    Set Catchpoints (Debugging with GDB) - Sourceware
    You can use catchpoints to cause the debugger to stop for certain kinds of program events, such as C++ exceptions or the loading of a shared library.
  32. [32]
    Symbols (Debugging with GDB) - Sourceware
    A non-debugging symbol is a symbol that comes from the executable's symbol table, not from the debug information (for example, DWARF) associated with the ...
  33. [33]
    Ada Tasks and Core Files (Debugging with GDB) - Sourceware
    When inspecting a core file, as opposed to debugging a live program, tasking support may be limited or even unavailable, depending on the platform being used.
  34. [34]
    List of supported systems in GDB - Sourceware
    Jan 26, 2019 · GDB should build and run most POSIX-like hosts. A default build of GDB will support targets with the same triple as the host.
  35. [35]
    Architectures (Debugging with GDB) - Sourceware
    This section describes characteristics of architectures that affect all uses of GDB with the architecture, both native and cross. • AArch64: • x86: • Alpha: • ...
  36. [36]
    GNU Debugger 13.1 Brings LoongArch & C-SKY Debugging On ...
    Feb 19, 2023 · GNU Debugger 13.1 adds new target support for GDB and GDB server for running under Linux on the LoongArch and C-SKY processor architectures.
  37. [37]
  38. [38]
    Server (Debugging with GDB) - Sourceware
    gdbserver is a control program for Unix-like systems, which allows you to connect your program with a remote GDB via target remote or target extended-remote.
  39. [39]
    Building GDB and GDBserver for cross debugging - Sourceware
    Apr 18, 2022 · Now run 'make all-gdb'. If you run just 'make', this will build all the top level components, including gdb, gdbserver, binutils, ld, gas, etc.Missing: flags | Show results with:flags
  40. [40]
    BuildingOnWindows - GDB Wiki - Sourceware
    Jun 16, 2025 · Building GDB on Windows. You can do this with either MinGW or Cygwin. You can also do it with MinGW in cygwin.
  41. [41]
    Separate Debug Files (Debugging with GDB) - Sourceware
    (This is supported only on some operating systems, when using the ELF or PE file formats for binary files and the GNU Binutils.) For more details about this ...<|separator|>
  42. [42]
    Starting (Debugging with GDB) - Sourceware
    4.2 Starting your Program. run; r. Use the run command to start your program under GDB. You must first specify the program name with an argument to GDB (see ...
  43. [43]
    Continuing and Stepping (Debugging with GDB) - Sourceware
    Continuing means resuming program execution until your program completes normally. In contrast, stepping means executing just one more “step” of your program.
  44. [44]
  45. [45]
    Background Execution (Debugging with GDB) - Sourceware
    To specify background execution, add a & to the command. For example, the background form of the continue command is continue& , or just c& . The execution ...Missing: manual | Show results with:manual
  46. [46]
    Signals (Debugging with GDB) - Sourceware
    GDB has the ability to detect any occurrence of a signal in your program. You can tell GDB in advance what to do for each kind of signal.
  47. [47]
    Set Watchpoints (Debugging with GDB) - Sourceware
    You can use a watchpoint to stop execution whenever the value of an expression changes, without having to predict a particular place where this may happen. ( ...
  48. [48]
    Debugging with GDB - Examining Data - MIT
    The usual way to examine data in your program is with the print command (abbreviated p ), or its synonym inspect. It evaluates and prints the value of an ...
  49. [49]
    Debugging with GDB - Examining the Stack - MIT
    A backtrace is a summary of how your program got where it is. It shows one line per frame, for many frames, starting with the currently executing frame.Missing: documentation | Show results with:documentation
  50. [50]
    Assignment (Debugging with GDB) - Sourceware
    To alter the value of a variable, evaluate an assignment expression. See Expressions. For example, print x=4 stores the value 4 into the variable x.
  51. [51]
    Debugging with GDB - Canned Sequences of Commands
    ### Summary on Core Dump Files in GDB
  52. [52]
    Connecting (Debugging with GDB) - Sourceware
    This section describes how to connect to a remote target, including the types of connections and their differences, how to set up executable and symbol files ...
  53. [53]
    Remote Protocol (Debugging with GDB) - Sourceware
    The GDB remote protocol includes standard replies, stop, general query, tracepoint, host I/O, interrupt, and notification packets.
  54. [54]
    Use debuggers | Android Open Source Project
    Feb 15, 2025 · Go to Settings > Developer options > Select debug app and choose your app from the list, then click Wait for debugger. · Start the app, either ...Prerequisites · Debug running apps or... · Debug app startup
  55. [55]
    Process Record and Replay (Debugging with GDB) - Sourceware
    GDB provides a special process record and replay target that can record a log of the process execution, and replay it later with both forward and reverse ...
  56. [56]
    Process Record and Replay - GDB Wiki - Sourceware
    Jun 17, 2013 · Process record and replay works by logging the execution of each machine instruction in the child process (the program being debugged), together with each ...
  57. [57]
  58. [58]
    [ANNOUNCEMENT] GDB 11.1 released! - Sourceware
    Sep 13, 2021 · [ANNOUNCEMENT] GDB 11.1 released! Joel Brobecker brobecker@adacore.com. Mon Sep 13 02:51:27 GMT 2021. Previous message (by thread): ...[ANNOUNCEMENT] GDB 12.1 released![ANNOUNCEMENT] GDB 10.1 released!More results from sourceware.org
  59. [59]
    Branch Trace Format (Debugging with GDB) - Sourceware
    The branch trace is a list of sequential code blocks connected by branches, obtained via the ‘qXfer:btrace:read’ packet as an XML document. GDB must be linked ...Missing: introduction | Show results with:introduction
  60. [60]
    Threads (Debugging with GDB) - Sourceware
    The GDB thread debugging facility allows you to observe all threads while your program runs—but whenever GDB takes control, one thread in particular is always ...Missing: documentation | Show results with:documentation
  61. [61]
    Non-Stop Mode (Debugging with GDB) - Sourceware
    GDB supports an optional mode of operation in which you can examine stopped program threads in the debugger while other threads continue to execute freely.Missing: GNU | Show results with:GNU
  62. [62]
    All-Stop Mode (Debugging with GDB) - Sourceware
    On some OSes, you can modify GDB's default behavior by locking the OS scheduler to allow only a single thread to run. set scheduler-locking mode. Set the ...
  63. [63]
    Thread-Specific Breakpoints (Debugging with GDB) - Sourceware
    Use the qualifier ' thread thread-id ' with a breakpoint command to specify that you only want GDB to stop the program when a particular thread reaches this ...
  64. [64]
    Inferiors Connections and Programs (Debugging with GDB)
    ### Summary of Multi-Process/Multi-Inferior Support in GDB
  65. [65]
    Forks (Debugging with GDB) - Sourceware
    On most systems, GDB has no special support for debugging programs which create additional processes using the fork function.
  66. [66]
    Command Line Editing (Debugging with GDB)
    ### Summary of GDB Command Line Editing Features
  67. [67]
    Command History (Debugging with GDB) - Sourceware
    GDB can keep track of the commands you type during your debugging sessions, so that you can be certain of precisely what happened.
  68. [68]
    Completion (Debugging with GDB) - Sourceware
    GDB uses TAB for command completion. If multiple options exist, pressing TAB again shows them. M-? shows all alternatives.Missing: interface history
  69. [69]
    Help (Debugging with GDB) - Sourceware
    You can always ask GDB itself for information on its commands, using the command help. You can use help (abbreviated h) with no arguments to display a short ...
  70. [70]
    Initialization Files (Debugging with GDB) - Sourceware
    This is a single system-wide initialization file. Its location is specified with the --with-system-gdbinit configure option (see System-wide configuration). It ...
  71. [71]
    Define (Debugging with GDB) - Sourceware
    A user-defined command is a sequence of GDB commands to which you assign a new name as a command. This is done with the define command.Missing: prompt | Show results with:prompt
  72. [72]
    Auto-loading (Debugging with GDB) - Sourceware
    GDB auto-loading automatically reads files and settings, which can be controlled using commands and options, and requires a configured safe-path.
  73. [73]
    Print Settings (Debugging with GDB) - Sourceware
    GDB provides the following ways to control how arrays, structures, and symbols are printed. These settings are useful for debugging programs in any language.Missing: summary | Show results with:summary<|control11|><|separator|>
  74. [74]
    DDD - Data Display Debugger - Free Software Foundation (FSF)
    GNU DDD is a graphical front end for the command-line debugger GDB and the variant CUDA-GDB. Besides usual frontend features such as viewing source texts, DDD ...
  75. [75]
    Debugging with Code::Blocks
    Nov 9, 2016 · As gdb 7. x support python pretty printer, so, it can also use gdb(with python support) to show some complex variable values.Build debug version of your... · Add Watches · Notes
  76. [76]
    GDB | Qt Creator Documentation
    To specify preferences for managing the GDB process, go to Preferences > Debugger > GDB. {GDB tab in Debugger preferences} The following table summarizes the ...
  77. [77]
    Native Debug - Visual Studio Marketplace
    Open your project and click the debug button in your sidebar. At the top right press the little gear icon and select GDB or LLDB. It will automatically generate ...
  78. [78]
    GDB Graphical Interface (GNU Emacs Manual)
    The command M-x gdb starts GDB in an IDE-like interface, with specialized buffers for controlling breakpoints, stack frames, and other aspects of the debugger ...
  79. [79]
    GDB/MI (Debugging with GDB) - Sourceware
    GDB/MI is a line based machine oriented text interface to GDB and is activated by specifying using the --interpreter command line option.
  80. [80]
    Mode Options (Debugging with GDB) - Sourceware
    GDB/MI version 2 ( mi2 ), included in GDB 6.0 and version 1 ( mi1 ), included in GDB 5.3, are also available. Earlier GDB/MI interfaces are no longer supported.<|separator|>
  81. [81]
    4.3.6. Alternative User Interfaces for GDB | Developer Guide
    MI allows IDE developers to create other user interfaces to GDB. Some examples of these interfaces are: Eclipse (CDT). A graphical debugger interface integrated ...
  82. [82]
    gdb/mi gdb server debugging - Stack Overflow
    Mar 5, 2013 · For local debugging you need neither MI or gdb server. You only need gdb. MI is used by various GUIs/IDEs to communicate with gdb.
  83. [83]
    Command Files (Debugging with GDB) - Sourceware
    23.1.3 Command Files. A command file for GDB is a text file made of lines that are GDB commands. Comments (lines starting with # ) may also be included.
  84. [84]
    Logging Output (Debugging with GDB) - Sourceware
    There are several commands to control GDB's logging. set logging enabled [on|off]. Enable or disable logging. set logging file file. Change the name of the ...
  85. [85]
    GDB_7.0_Release - GDB Wiki - Sourceware
    Jan 13, 2010 · This page has a partial list of issues which should be addressed before the 7.0 release. [NAME] at the beginning of each item is the name of ...
  86. [86]
    Python API (Debugging with GDB) - Sourceware
    You can get quick online help for GDB's Python API by issuing the command python help (gdb). Functions and methods which have two or more optional arguments
  87. [87]
    Pretty Printing (Debugging with GDB) - Sourceware
    10.10 Pretty Printing. GDB provides a mechanism to allow pretty-printing of values using Python code. It greatly simplifies the display of complex objects.Missing: documentation | Show results with:documentation
  88. [88]
    Guile Introduction (Debugging with GDB) - Sourceware
    GDB requires Guile version 3.0, 2.2, or 2.0. Guile scripts used by GDB should be installed in data-directory /guile , where data-directory is the data ...
  89. [89]
    Guile Commands (Debugging with GDB) - Sourceware
    GDB provides two commands for accessing the Guile interpreter: The guile command can be used to evaluate a Scheme expression.Missing: integration | Show results with:integration
  90. [90]
    GDB News
    Summary of each segment:
  91. [91]
    Get Started with our GNU Debugger Tutorial - Red Hat Developer
    Apr 30, 2021 · This article is the first in a series demonstrating how to use the GNU Debugger (GDB) effectively to debug applications in C and C++.
  92. [92]
  93. [93]
    pwndbg/pwndbg: Exploit Development and Reverse ... - GitHub
    Pwndbg is a Python module which can be loaded into GDB or run as a REPL interface for LLDB. It provides a suite of utilities and enhancements that fill the gaps ...Missing: examples | Show results with:examples
  94. [94]
    danielinux/gdb-ollama: Debugging assistant using local ... - GitHub
    gdb-ollama is a GDB extension that integrates Ollama AI into the GDB debugging workflow, allowing AI-powered debugging insights directly from within GDB.Gdb-Ollama · Features · Usage<|control11|><|separator|>
  95. [95]
    GDB Debugger MCP Server by Signal-Slot: The AI Engineer's Guide
    Oct 23, 2025 · Transform your AI assistant with the GDB Debugger MCP Server! Explore hands-on setup, features, and the future of AI-driven debugging in C++ ...
  96. [96]
    2 BFD Front End - Sourceware
    1 Introduction. BFD is a package which allows applications to use the same routines to operate on object files whatever the object file format.
  97. [97]
    Debugging Options (Using the GNU Compiler Collection (GCC))
    To tell GCC to emit extra information for use by a debugger, in almost all cases you need only to add -g to your other options.
  98. [98]
    Internals Debugging-File-Formats - GDB Wiki
    ### Summary of Supported Debugging Formats in GDB
  99. [99]
    Gabe Black - MSVC and DIA - Sourceware
    I would like to add PDB symbol support to GDB. I am fairly new to GDB but I ... PDB symbol support. I didn't find much about it in the gdb online ...
  100. [100]
    Files (Debugging with GDB) - Sourceware
    Use filename as the program to be debugged. It is read for its symbols and for the contents of pure memory. It is also the program executed when you use the ...
  101. [101]
    Internals Symbol-Handling - GDB Wiki
    ### Summary of Symbol Handling in GDB
  102. [102]
    Debugging Options (Using the GNU Compiler Collection (GCC))
    Version 5 requires GDB 8.0 or higher. GCC no longer supports DWARF Version 1, which is substantially different than Version 2 and later. For historical reasons, ...
  103. [103]
    Running (Debugging with GDB) - Sourceware
    4 Running Programs Under GDB. When you run a program under GDB, you must first generate debugging information when you compile it. You may start GDB with its ...Missing: gcc | Show results with:gcc
  104. [104]
    Arguments (Debugging with GDB)
    ### Summary of Setting Arguments in GDB
  105. [105]
    Quitting GDB (Debugging with GDB) - Sourceware
    2.2 Quitting GDB​​ To exit GDB, use the quit command (abbreviated q ), the exit command, or type an end-of-file character (usually Ctrl-d ). If you do not supply ...
  106. [106]
    List (Debugging with GDB) - Sourceware
    To print lines from a source file, use the list command (abbreviated l). By default, ten lines are printed. There are several ways to specify what part of the ...
  107. [107]
    Machine Code (Debugging with GDB) - Sourceware
    This specialized command dumps a range of memory as machine instructions. It can also print mixed source+disassembly by specifying the /m or /s modifier.
  108. [108]
    Registers (Debugging with GDB)
    ### Summary of `info registers` Command
  109. [109]
    3.1. Debugging with GDB - Dive Into Systems
    After discussing a few preliminaries about how to get started with GDB, we present two example GDB debugging sessions that introduce commonly used GDB commands ...