GDB 不断下载调试信息
GDB keeps downloading debug info
有时,当我启动调试过程时,GDB 首先下载所有依赖项的所有调试信息,这是不可忽略的。鉴于依赖项不会经常添加,我怀疑这是因为我使用的是滚动发行版,所以每次我执行发行版升级时,GDB 都会在下次启动时重新下载调试信息(可能是完全错误的) , 我不知道)
查看文档后,我尝试了:
...
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>
如何下载和存储并调整 GDB 以使用相同的调试信息?
如果这很重要,我正在使用 openSUSE Tumbleweed
GDB 使用 debuginfod_find_debuginfo()
查找和下载调试信息文件。 Documentation 说:
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.
看来您的清洁频率太高,或者 max_unused_age_s
设置太低。
并且在环境中取消设置 DEBUGINFOD_URLS
应该会阻止 GDB 下载任何东西。
此问题已在 gdb 中修复,请参阅 https://sourceware.org/bugzilla/show_bug.cgi?id=27532. In particular from https://sourceware.org/bugzilla/show_bug.cgi?id=27532#c5 :
Hi Sergio. Since commit 7811fa5995 gdb will print a notice when
debuginfod is enabled and give the user a chance to opt out. Closing
this bug as FIXED.
从 7811fa5995 版本开始,gdb 有一个新命令 set debuginfod
。在 gdb 的未来版本中,您可以使用以下命令完全禁用 debuginfod:
set debuginfod off
有时,当我启动调试过程时,GDB 首先下载所有依赖项的所有调试信息,这是不可忽略的。鉴于依赖项不会经常添加,我怀疑这是因为我使用的是滚动发行版,所以每次我执行发行版升级时,GDB 都会在下次启动时重新下载调试信息(可能是完全错误的) , 我不知道)
查看文档后,我尝试了:
...
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>
如何下载和存储并调整 GDB 以使用相同的调试信息?
如果这很重要,我正在使用 openSUSE Tumbleweed
GDB 使用 debuginfod_find_debuginfo()
查找和下载调试信息文件。 Documentation 说:
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.
看来您的清洁频率太高,或者 max_unused_age_s
设置太低。
并且在环境中取消设置 DEBUGINFOD_URLS
应该会阻止 GDB 下载任何东西。
此问题已在 gdb 中修复,请参阅 https://sourceware.org/bugzilla/show_bug.cgi?id=27532. In particular from https://sourceware.org/bugzilla/show_bug.cgi?id=27532#c5 :
Hi Sergio. Since commit 7811fa5995 gdb will print a notice when debuginfod is enabled and give the user a chance to opt out. Closing this bug as FIXED.
从 7811fa5995 版本开始,gdb 有一个新命令 set debuginfod
。在 gdb 的未来版本中,您可以使用以下命令完全禁用 debuginfod:
set debuginfod off