Automatically download missing dynamic lib debug symbols in gdb and debian
🔗TL;DR
Set
export DEBUGINFOD_URLS
=
"https://
debuginfod
.
debian
.
net"
to automatically download missing debug symbols in gdb
.
Found this in the Debian
wiki: You can configure gdb
, elfutils
and
binutils
to automatically download debug symbols from
debian’s official debuginfod
server. This can save you time by not needing to separately
download debug symbol packages.
🔗Configuration
Set the environment variable $DEBUGINFOD_URLS
:
export DEBUGINFOD_URLS="https://debuginfod.debian.net"
And whenever you launch gdb etc with missing debug symbols in
libraries, it will query the server for debug symbols. On gdb startup,
you should see lines like
Downloading separate debug info for /lib
/x86_64-linux-gnu
/liblz4.so.1...
for each dynamically linked library. Beware that this can cause a large
number of symbols to be downloaded if the transitive linked dependencies
are too many.
You can check approximately how many separate symbol packages it
would download in a fresh run for a specific binary by using
ldd
to list dependencies:
$ ldd a.out
You can also set the server URL in your .gdbinit
configuration instead. Example values taken from the GDB
online documentation:
set debuginfod enabled on
#set debuginfod enabled off
#set debuginfod enabled ask
# space separated URL list
set debuginfod urls https://debuginfod.debian.net
# inspect settings:
#show debuginfod enabled
#show debuginfod urls
Location of the symbol cache is:
- if
DEBUGINFOD_CACHE_PATH
is set, then the files are saved in the directory pointed by it. - Otherwise, if
XDG_CACHE_HOME
is set, then files are saved into$XDG_CACHE_HOME/debuginfod_client
. - Otherwise, the files will be saved into
$HOME
/.cache
/debuginfod_client
.
Can I delete the cache directory? Yes.