solib绝对前缀与GDB中的solib搜索路径

solib绝对前缀与GDB中的solib搜索路径,gdb,kgdb,Gdb,Kgdb,我读了这两个的描述,但我还不明白其中的区别。有人能帮我理解这些区别吗 set solib-absolute-prefix - Specifies the local directory that contains copies of target libraries in the corresponding subdirectories. This option is useful when debugging with gdbserver. 谢谢。措辞很不清楚:-( 假设您的目标加载了/

我读了这两个的描述,但我还不明白其中的区别。有人能帮我理解这些区别吗

set solib-absolute-prefix -
Specifies the local directory that contains copies of target libraries in the 
corresponding subdirectories. This option is useful when debugging with gdbserver.


谢谢。

措辞很不清楚:-(

假设您的目标加载了
/usr/lib/libfoo.so
,并且在主机(GDB正在运行的地方)上,您在
/tmp/host
中有整个目标树的副本。也就是说,目标的
/usr/lib/libfoo.so
在主机上的
/tmp/host/usr/lib/libfoo.so
中找到

然后,以下命令几乎是等效的:

set solib-absolute-prefix /tmp/host
set solib-search-path /tmp/host/usr/lib

现在考虑如果你也有了<代码> /Ur/Posial/LIb/LIbBar。那么,在目标上,它的副本在<代码> /TMP/主机/Ur/Prime/LIb/LIbBar中。所以

上面设置的
solib绝对前缀
仍然适合定位
libbar。因此
,但是
solib搜索路径
必须进行如下修改:

set solib-search-path /tmp/host/usr/lib:/tmp/host/usr/local/lib
总而言之,如果在单个主机下有整个目标树
$ROOT
,那么只需将
solib绝对前缀
设置为
$ROOT
,就可以了

但是如果您必须从多个不相交的树中“组装”目标路径,那么使用多个路径的
solib搜索路径
将允许GDB仍然找到正确的库

set solib-search-path /tmp/host/usr/lib:/tmp/host/usr/local/lib