#### Beyond Linux® From Scratch (systemd Edition) - Version 10.1

### Chapter 13. Programming

- Prev

  GC-8.0.4

- Next

  Git-2.30.1

- Up
- Home

# GDB-10.1

## 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-10.1 platform.

### Package Information

- Download (HTTP): https://ftp.gnu.org/gnu/gdb/gdb-10.1.tar.xz

- Download (FTP): ftp://ftp.gnu.org/gnu/gdb/gdb-10.1.tar.xz

- Download MD5 sum: 1822a7dd45e7813f4408407eec1a6af1

- Download size: 21 MB

- Estimated disk space required: 761 MB (add 750 MB for docs; add 633 MB for tests)

- Estimated build time: 1.7 SBU (Using parallelism=4; add 30 SBU for tests; add 0.5 SBU for docs)

### GDB Dependencies

#### Recommended Runtime Dependency

six-1.15.0 (Python 3 module, required at run-time to use GDB scripts from various LFS/BLFS packages with Python 3 installed in LFS)

#### Optional

Doxygen-1.9.1, GCC-10.2.0 (ada, gfortran, and go are used for tests), Guile-3.0.5, Python-2.7.18, rustc-1.47.0 (used for some tests), Valgrind-3.16.1, and SystemTap (run-time, used for tests)

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/gdb

## 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 &&
    make

Optionally, to build the API documentation using Doxygen-1.9.1, 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 &&
    runtest
    popd

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 few tests assume that the header file `<sys/sdt.h>`, part of SystemTap, is present.

- A test run of the test suite had 230 unexpected failures (out of over 70000 tests).

- On some systems, the gdb.tui 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

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-10.1 &&
    rm -rf gdb/doc/doxy/xml &&
    cp -Rv gdb/doc/doxy /usr/share/doc/gdb-10.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 in LFS. Remove this switch if you have installed Python-2.7.18 and want to use it instead of Python 3.

## Contents

Installed Programs: gcore, gdb and gdbserver
Installed Library: None
Installed Directories: /usr/{include,share}/gdb and /usr/share/doc/gdb-10.1

### Short Descriptions

gcore | generates a core dump of a running program
gdb | is the GNU Debugger
gdbserver | is a remote server for the GNU debugger (it allows programs to be debugged from a different machine)

Last updated on 2021-02-19 21:30:09 -0800

- Prev

  GC-8.0.4

- Next

  Git-2.30.1

- Up
- Home