Debuginfod
Debuginfod is a service providing debug information over an HTTP API.
Installation
gdb automatically tries to download debug files from servers specified in the DEBUGINFOD_URLS
environment variable, which is a string of space separated URLs.
libelf, a dependency of gdb, ships with /etc/profile.d/debuginfod.sh
and /etc/profile.d/debuginfod.csh
scripts that set the variable on login, so there is no need to install additional packages. The scripts parse .urls files in /etc/debuginfod/
and set the environment variable to https://debuginfod.archlinux.org
by default.
https://debuginfod.elfutils.org/
which works as a federated server and queries all available debuginfod servers.You can optionally install the debuginfod package which provides the debuginfod-find(1) utility. This package is required for debuginfod support in delve.
Usage
Manual download
If one wants to manually retrieve the debug symbols for zstd, along with some source files, one can utilize debuginfod-find:
$ debuginfod-find debuginfo /usr/bin/zstd
/home/user/.cache/debuginfod_client/70e1b456c5813658df6436a3deb71812e75a0267/debuginfo
$ debuginfod-find source /usr/bin/zstd /usr/src/debug/zstd-1.5.2/programs/fileio.c
/home/user/.cache/debuginfod_client/70e1b456c5813658df6436a3deb71812e75a0267/source##usr##src##debug##zstd-1.5.2##programs##fileio.c
Disabling
The debuginfod client service can be disabled by clearing DEBUGINFOD_URLS
:
$ unset DEBUGINFOD_URLS
If one wants to use a local cache, with no attempt to contact any server, one can set DEBUGINFOD_URLS
to a non-empty string, e.g. /dev/null
.
Debugger support
Several debuggers support utilizing debuginfod to find debug symbol and source code listing.
Package | Status | Notes |
---|---|---|
gdb | Supported | |
delve | Supported | |
KDE Crash Report | Supported | |
valgrind | Supported |
Cache
The cache for debuginfod is stored at the location specified by $DEBUGINFOD_CACHE_PATH
if set. Otherwise, it will use $HOME/.cache/debuginfod_client/
or $XDG_CACHE_HOME/debuginfod_client/
if $XDG_CACHE_HOME
is set. The cache size can grow quite fast, depending on how many debugging sessions you have and which packages are involved.
There are 3 parameters that configure the cache behavior, as described in the man page of debuginfod(8) § CACHE:
-
cache_clean_interval_s
: interval between each automatic clean (default is 86400, i.e. 1 day) -
max_unused_age_s
: how long unused data is retained (default is 604800, i.e. one week) -
cache_miss_s
: how long to remember failed queries (default is 600, i.e. 10 minutes)
Each parameter is defined by a number in a file of the same name in the cache folder.
If you rarely use debuginfod, one can manually delete all directories in the cache (keeping the parameters files), or the complete cache directory.