Debuginfod
Debuginfod is a service providing debug information over an HTTP API.
Installation
gdb automatically tries to download debug files if the DEBUGINFOD_URLS
environment variable is present.
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.
You can optionally install the debuginfod package which provides the debuginfod-find(1) utility. This package is required for debuginfod support in delve.
Usage
The tooling looks for debug symbols on the debuginfod servers specified in the DEBUGINFOD_URLS
environment variable. The value is a string of a space separated URLs.
It is set by default on archlinux to https://debuginfod.archlinux.org
because of /etc/profile.d/debuginfod.{c}sh
that sets that environnment variable by parsing *.urls
in /etc/debuginfod/
For example, one should get if no modification has been made:
$ echo $DEBUGINFOD_URLS https://debuginfod.archlinux.org/
https://debuginfod.elfutils.org/
which works as a federated server and queries all available debuginfod servers.See debuginfod-find(1) for usage.
Disabling
One can opt-out (you may have your reasons) from debuginfod service 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 like /dev/null
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
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.
It can grow quite fast, if you run a lot of different session.
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 unaccessed data is retained (deafult 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, mentionned previously.
If you rarely use debuginfod, one can manually delete all the folders in the cache (keeping the parameters files), or the complete cache folder.