10

両方の説明を読みましたが、違いはまだわかりません。違いを理解するのを手伝ってくれる人はいますか?

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.

ありがとう。

4

1 に答える 1

25

言葉遣いはかなり不明確です:-(

ターゲットがロードさ/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

/usr/local/lib/libbar.so次に、ターゲットにもあり、そのコピーが にある場合にどうなるかを考えてみましょう/tmp/host/usr/local/lib/libbar.so

上記のsolib-absolute-prefixように設定しても、見つけるlibbar.soのには適していますが、solib-search-path次のように変更する必要があります。

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

要約すると、単一のホストの下にターゲット ツリー全体がある場合は、に設定するだけで問題ありません。$ROOTsolib-absolute-prefix$ROOT

ただし、複数のばらばらなツリーからターゲット パスを「組み立てる」必要がある場合solib-search-path、複数のパスを使用すると、GDB は正しいライブラリを見つけることができます。

于 2014-07-23T14:43:13.133 に答える