Generated by GPT-5-mini| GDB | |
|---|---|
| Name | GDB |
| Developer | Free Software Foundation |
| Released | 1986 |
| Programming language | C (programming language) |
| Operating system | Unix, Linux, Microsoft Windows, macOS |
| License | GNU General Public License |
GDB The GNU Debugger is a source-level debugger for programs written in languages such as C (programming language), C++, Fortran (programming language), Ada (programming language), and Go (programming language). It allows developers to inspect and control execution of programs compiled for x86, ARM architecture, PowerPC, and other processor families, and to examine state in environments ranging from Linux servers to Embedded systems and macOS workstations. GDB is widely used in conjunction with toolchains and projects such as GCC, GNU Binutils, Make (software), Valgrind, and Eclipse (software).
GDB provides breakpoints, watchpoints, stack backtraces, variable inspection, and remote debugging interfaces for interaction with programs under test on targets like x86-64, ARM64, MIPS architecture, and RISC-V. It integrates with development environments such as GNU Emacs, Visual Studio Code, NetBeans, CLion, and IDEs supporting the Debug Adapter Protocol to facilitate source-level debugging for projects built with Autotools, CMake, or Bazel (software).
GDB originated within the GNU Project as part of the effort led by Richard Stallman and contributors to create a free toolchain alongside GCC. Initial development in the mid-1980s produced a debugger leveraging symbol formats like a.out and later ELF (file format). Over its evolution, GDB absorbed contributions from maintainers and projects associated with Red Hat, Debian, Ubuntu, SUSE, and academic groups at institutions such as Massachusetts Institute of Technology, Stanford University, and University of California, Berkeley. Major milestones include adding support for DWARF debugging information, remote serial debugging used in embedded contexts like ARM Cortex-M, integration with Python (programming language) for scripting, and support for modern architectures such as RISC-V.
GDB’s architecture separates a command interpreter from its target access and symbol handling subsystems. Key internal components include the inferior control layer, the symbol resolver that reads DWARF and STABS formats, and remote protocol adapters such as the GDB Remote Serial Protocol used with OpenOCD and QEMU. Notable features include breakpoints and conditional breakpoints, data watchpoints using hardware debug registers on processors like Intel 80386 and ARM9, post-mortem debugging via core dumps produced on Linux and FreeBSD, record-and-replay facilities inspired by projects like rr (software), and scripting hooks using Python (programming language) or Guile for automation and extensions. GDB interacts with object formats produced by GNU Binutils and uses symbol resolution compatible with linkers such as GNU ld and Gold (linker).
Users invoke the debugger via its Command-Line Interface, graphical front-ends, or IDE integrations. Common commands include "run", "break", "continue", "next", "step", "finish", "backtrace", "info registers", "print", and "set variable", which operate on processes launched locally or controlled remotely through stubs like gdbserver. Typical workflows involve compiling with GCC or Clang (compiler) using the "-g" option to emit DWARF symbols, launching under GDB, setting breakpoints at functions such as those declared in libraries like glibc, and inspecting stack frames referencing calls into frameworks like POSIX or Win32 API when debugging on Microsoft Windows. GDB supports conditional expressions using language semantics of C++ or Fortran (programming language) and can display complex data types including STL containers from C++ Standard Library.
Standard techniques with GDB include interactive source-step debugging for isolating logic errors in codebases such as Linux kernel modules or embedded firmware for ARM Cortex-M microcontrollers, core dump analysis to diagnose crashes in services like systemd or Apache HTTP Server, and remote debugging over TCP/IP for applications running inside Docker (software) containers or virtual machines hosted on QEMU. Advanced workflows use GDB scripting in Python (programming language) to implement automated bisecting, stack unwinding for mixed C++ and assembly language frames, and integration with continuous integration systems such as Jenkins (software), Travis CI, or GitHub Actions to capture regression traces.
GDB is available on a wide range of platforms including GNU/Linux, FreeBSD, NetBSD, OpenBSD, Android (operating system), and Microsoft Windows via ports like MinGW and Cygwin. It integrates with emulators and instrumentation tools such as QEMU, Valgrind, OpenOCD, and tracing tools like SystemTap and DTrace. Graphical front-ends and IDE integrations include Eclipse (software), Visual Studio Code, GNU Emacs, KDevelop, and vendor tools from companies like ARM Ltd. and Intel Corporation. Cross-debugging workflows leverage toolchains from projects such as Linaro and use remote stubs embedded in firmware or bootloaders like U-Boot.
GDB is distributed under the GNU General Public License and developed by contributors organized around the GDB mailing list, the GNU Project, and repository hosting platforms used by maintainers and downstream packagers from organizations including Red Hat, SUSE, Canonical (company), and independent contributors from companies like Google and ARM Ltd.. Community activities include bug reporting, patch submission, participation in events such as FOSDEM, Linux Plumbers Conference, and collaboration with projects like GCC and GNU Binutils to coordinate support for new architectures and debugging formats.
Category:Debuggers