I read the description of both but I don't yet understand the difference. Can anyone help me understand the differences?
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-search-path command -
Specifies directories where GDB will search for shared libraries with symbols. This option
is useful when debugging with gdbserver.
Thanks.
The wording is quite unclear :-(
Assume that your target loaded
/usr/lib/libfoo.so, and that on the host (where GDB is running), you have a copy of the entire target tree in/tmp/host. That is, a copy of target's/usr/lib/libfoo.sois found on host in/tmp/host/usr/lib/libfoo.so.Then, the following commands are almost equivalent:
Now consider what happens if you also have
/usr/local/lib/libbar.soon target, and a copy of it in/tmp/host/usr/local/lib/libbar.so.The
solib-absolute-prefixas set above is still good to locatelibbar.so, butsolib-search-pathwould have to be modified like so:To summarize, if you have entire target tree under a single host
$ROOT, then just setsolib-absolute-prefixto$ROOTand you should be good.But if you have to "assemble" target paths from multiple disjoint trees, then
solib-search-pathwith multiple paths will allow GDB to still find correct libraries.