GDB: The GNU Project Debugger
[bugs]
[GDB Maintainers]
[contributing]
[current git]
[documentation]
[download]
[home]
[irc]
[links]
[mailing lists]
[news]
[schedule]
[song]
[wiki]
GDB: The GNU Project Debugger
What is GDB?
GDB, the GNU Project debugger, allows you to see what is going on
`inside' another program while it executes -- or what another program
was doing at the moment it crashed.
GDB can do four main kinds of things (plus other things in support
of these) to help you catch bugs in the act:
- Start your program, specifying anything that might affect its behavior.
- Make your program stop on specified conditions.
- Examine what has happened, when your program has stopped.
- Change things in your program, so you can experiment with
correcting the effects of one bug and go on to learn about another.
Those programs might be executing on the same machine as GDB (native),
on another machine (remote), or on a simulator. GDB can run on most
popular UNIX and Microsoft Windows variants, as well as on Mac OS X.
What Languages does GDB Support?
GDB supports the following languages (in alphabetical order):
- Ada
- Assembly
- C
- C++
- D
- Fortran
- Go
- Objective-C
- OpenCL
- Modula-2
- Pascal
- Rust
GDB version 13.2
Version 13.2 of GDB, the GNU
Debugger, is now available for download. See the ANNOUNCEMENT for details
including changes in this release.
An errata list (PROBLEMS) and documentation
are also available.
News
- May 27th, 2023: GDB 13.2 Released!
-
The latest version of GDB, version 13.2, is available for download.
This is a minor corrective release over GDB 13.1, fixing the following
issues:
- PR testsuite/30158 (rustc testsuite fails with 13.1, apparently worked before with trunk 20230114 on i686-linux-gnu and powerpc64le-linux-gnu)
- PR gdb/30214 (GDB 13.1 does not compile on FreeBSD 13.1)
- PR gdb/30240 ((linux/aarch) thread.c:86: internal-error: inferior_thread: Assertion `current_thread_ != nullptr' failed)
- PR gdb/30249 ([13 regression] hookpost-extended-remote will not work)
- PR exp/30271 (Addresses of static thread_local fields are badly calculated sometimes)
- PR symtab/30357 (Segmentation fault for the 'start' command)
- PR symtab/30369 ([gdb/symtab] False match issue in skip_prologue_using_linetable)
- PR gdb/30423 (Build failures with clang 16)
- PR build/30450 (Build failure (linux-low.cc:5393:45: error: expected ':' before ')' token) with musl-1.2.4)
See the NEWS file for a more complete and detailed list of what this release includes.
- Feb 19th, 2023: GDB 13.1 Released!
-
The latest version of GDB, version 13.1, is available for download.
This version of GDB includes the following changes and enhancements:
- Support for the following new targets has been added in both GDB and GDBserver:
- GNU/Linux/LoongArch (gdbserver) loongarch*-*-linux*
- GNU/Linux/CSKY (gdbserver) csky*-*linux*
- The Windows native target now supports target async.
- FreeBSD:
- Arm and AArch64: Support for Thread Local Storage (TLS) variables
- Hardware watchpoint support on AArch64 FreeBSD
- Floating-point support has now been added on LoongArch GNU/Linux.
- New commands:
- set print nibbles [on|off]
show print nibbles
This controls whether the 'print/t' command will display binary values
in groups of four bits, known as "nibbles". The default is 'off'.
- Various styling-related commands. See the
gdb/NEWS file for more details.
- Various maintenance commands. These are normally aimed at GDB
experts or developers. See the
gdb/NEWS
file for more details.
- Python API improvements:
- New Python API for instruction disassembly.
The new attribute 'locations' of gdb.Breakpoint returns a list of
gdb.BreakpointLocation objects specifying the locations where the
breakpoint is inserted into the debuggee.
- New Python type gdb.BreakpointLocation.
- New function gdb.format_address(ADDRESS, PROGSPACE, ARCHITECTURE)
that formats ADDRESS as 'address '
- New function gdb.current_language that returns the name of the
current language. Unlike gdb.parameter('language'), this will
never return 'auto'.
- New function gdb.print_options that returns a dictionary of the
prevailing print options, in the form accepted by gdb.Value.format_string.
- New method gdb.Frame.language that returns the name of the
frame's language.
- gdb.Value.format_string now uses the format provided by 'print',
if it is called during a 'print' or other similar operation.
- gdb.Value.format_string now accepts the 'summary' keyword. This
can be used to request a shorter representation of a value, the
way that 'set print frame-arguments scalars' does.
- The gdb.register_window_type method now restricts the set of
acceptable window names. The first character of a window's name
must start with a character in the set [a-zA-Z], every subsequent
character of a window's name must be in the set [-_.a-zA-Z0-9].
- GDB/MI changes:
- MI version 1 is deprecated, and will be removed in GDB 14.
- The async record stating the stopped reason 'breakpoint-hit' now
contains an optional field locno.
- Miscellaneous improvements:
- gdb now supports zstd compressed debug sections (ELFCOMPRESS_ZSTD) for ELF.
- New convenience variable $_inferior_thread_count contains the number
of live threads in the current inferior.
- New convenience variables $_hit_bpnum and $_hit_locno, set to
the breakpoint number and the breakpoint location number of
the breakpoint last hit.
- The "info breakpoints" now displays enabled breakpoint locations
of disabled breakpoints as in the "y-" state.
- The format of 'disassemble /r' and 'record instruction-history /r'
has changed to match the layout of GNU objdump when disassembling.
A new format "/b" has been introduce to provide the old behavior
of "/r".
- The TUI no longer styles the source and assembly code highlighted
by the current position indicator by default. You can however
re-enable styling using the new "set style tui-current-position"
command.
- It is now possible to use the "document" command to document
user-defined commands.
- Support for memory tag data for AArch64 MTE.
- Support Removal notices:
- DBX mode has been removed.
- Support for building against Python version 2 has been removed.
It is now only possible to build GDB against Python 3.
- Support for the following commands has been removed:
set debug aix-solib on|off
show debug aix-solib
set debug solib-frv on|off
show debug solib-frv
Use the "set/show debug solib" commands instead.
See the NEWS file for a more complete and detailed list of what this release includes.
- Dec 18th, 2022: GDB 13 branch created
-
The GDB 13 branch (gdb-13-branch) has been created.
To check out a copy of the branch use:
git clone --branch gdb-13-branch https://sourceware.org/git/binutils-gdb.git
- Nov 28, 2006: Reversible Debugging
-
The GDB maintainers are looking for contributors interested
in reversible debugging.
Late breaking information, such as recently added features, can be
found in the NEWS file in the gdb source tree. Old announcements are in the
news archive.
[bugs]
[GDB Maintainers]
[contributing]
[current git]
[documentation]
[download]
[home]
[irc]
[links]
[mailing lists]
[news]
[schedule]
[song]
[wiki]
Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to
contact the FSF.
This page is maintained by the GDB
developers.
Copyright Free Software Foundation, Inc., 51 Franklin St - Fifth
Floor, Boston, MA 02110-1301 USA.
Verbatim copying and distribution of this entire article is
permitted in any medium, provided this notice is preserved.
Last modified 2023-05-27.