c++gdb

GDB keeps downloading debug info


Every now and then, when I launch a debug process, GDB starts by downloading all debug info for all dependencies, which is not negligeable. Given the fact that dependencies don't get added THAT often, I suspect it's because I am using rolling distro, so every time I perform a distribution upgrade, GDB will re-downloads debug info upon next launch (might be completely wrong on that one, I don't know)

After looking into documentation, I tried:

...
Downloading separate debug info for /lib64/libFLAC.so.8...
Downloading separate debug info for /lib64/libspeex.so.1...
Downloading separate debug info for /lib64/libopus.so.0...
...
(gdb) show debug-file-directory
The directory where separate debug symbols are searched for is "/usr/lib/debug".
...

# Huh?
denis@localhost:~> file /usr/lib/debug
/usr/lib/debug: cannot open `/usr/lib/debug' (No such file or directory)

denis@localhost:/usr> sudo find . -name debug
./share/code/resources/app/out/vs/workbench/contrib/debug
./include/c++/10/debug
./include/c++/11/debug
./src/linux-5.13.13-1/arch/arm/include/debug
./src/linux-5.13.13-1/kernel/debug
./src/linux-5.13.13-1/tools/power/cpupower/debug
./src/linux-5.14.0-3.g501d1f1/arch/arm/include/debug
./src/linux-5.14.0-3.g501d1f1/kernel/debug
./src/linux-5.14.0-3.g501d1f1/tools/power/cpupower/debug
./lib64/node_modules/npm16/node_modules/debug
denis@localhost:/usr> 

How do I download and store, and adjust GDB to use the same debug info?

If that's of any importance, I am using openSUSE Tumbleweed


Solution

  • GDB uses debuginfod_find_debuginfo() to find and download the debug info files. Documentation says:

    debuginfod_find_debuginfo(), debuginfod_find_executable(), and debuginfod_find_source()
    query the debuginfod server URLs contained in $DEBUGINFOD_URLS
    (see below) for the debuginfo ...
    ...
    
    CACHE
    If the query is successful, the debuginfod_find_*() functions save the target
    file to a local cache. The location of the cache is controlled by the
    $DEBUGINFOD_CACHE_PATH environment variable (see below).
    Cleaning of the cache is controlled by the cache_clean_interval_s and
    max_unused_age_s files, which are found in the $DEBUGINFOD_CACHE_PATH directory.
    cache_clean_interval_s controls how frequently the cache is traversed for cleaning
    and max_unused_age_s controls how long a file can go unused
    (fstat(2) atime) before it's removed from the cache during cleaning.
    

    So it seems like you are suffering from either too frequent cleaning, or too low max_unused_age_s setting.

    And unsetting DEBUGINFOD_URLS in the environment should stop GDB from downloading anything.