Introduction to 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. Note that GDB is most effective when tracing programs and libraries that were built with debugging symbols and not stripped.

This package is known to build and work properly using an LFS 12.1 platform.

Package Information

  • Download (HTTP):

  • Download MD5 sum: 4a084d03915b271f67e9b8ea2ab24972

  • Download size: 23 MB

  • Estimated disk space required: 966 MB (add 805 MB for docs; add 710 MB for tests)

  • Estimated build time: 2.1 SBU (add 0.4 SBU for docs; add 18 SBU for tests; all using parallelism=4)

GDB Dependencies

Recommended Runtime Dependency


Doxygen-1.10.0, GCC-13.2.0 (ada, gfortran, and go are used for tests), Guile-3.0.9, rustc-1.76.0 (used for some tests), Valgrind-3.22.0, and SystemTap (run-time, used for tests)

Installation of GDB

Install GDB by running the following commands:

mkdir build &&
cd    build &&

../configure --prefix=/usr          \
             --with-system-readline \
             --with-python=/usr/bin/python3 &&

Optionally, to build the API documentation using Doxygen-1.10.0, run:

make -C gdb/doc doxy

To test the results, issue:

pushd gdb/testsuite &&
make  site.exp      &&
echo  "set gdb_test_timeout 120" >> site.exp &&

See gdb/testsuite/README and TestingGDB. There are many problems with the test suite:

  • Clean directories are needed if re-running the tests. For that reason, make a copy of the compiled source code directory before the tests in case you need to run the tests again.

  • Results depend on installed compilers.

  • A test run of the test suite had 51 unexpected failures out of the over 106000 tests.

  • On some systems, the test suite will fail if running over SSH.

  • On some AMD-based systems, over 200 additional tests may fail due to a difference in the threading implementation on those CPUs.

Now, as the root user:

make -C gdb install &&
make -C gdbserver install

If you have built the API documentation, it is now in gdb/doc/doxy. You can install it (as the root user):

install -d /usr/share/doc/gdb-14.1 &&
rm -rf gdb/doc/doxy/xml &&
cp -Rv gdb/doc/doxy /usr/share/doc/gdb-14.1

Command Explanations

--with-system-readline: This switch forces GDB to use the copy of Readline installed in LFS.

--with-python=/usr/bin/python3: This switch forces GDB to use Python 3.


Installed Programs: gcore, gdb, gdbserver, and gdb-add-index
Installed Library:
Installed Directories: /usr/{include,share}/gdb and /usr/share/doc/gdb-14.1

Short Descriptions


generates a core dump of a running program


is the GNU Debugger


is a remote server for the GNU debugger (it allows programs to be debugged from a different machine)


Allows adding index files to ELF binaries. This speeds up gdb start on large programs.

contains functions for the in-process tracing agent. The agent allows for installing fast tracepoints, listing static tracepoint markers, probing static tracepoints markers, and starting trace monitoring.