ターゲットに削除されたライブラリとバイナリがあり、ホストに ".debug"ディレクトリを持つ対応するツリーがある場合、使用するgdb設定コマンドは何ですか?

ターゲットに削除されたライブラリとバイナリがあり、ホストに

ターゲットデバイスには、ライブラリとバイナリのみが削除された設定があります。ターゲットにgdbserverがあります。ホストシステムはgdb-multiarchを使用します。ホストには、それぞれの「.debug」ディレクトリを含むディレクトリがあります。ホスト上のこのディレクトリには削除されていないライブラリ/バイナリは含まれておらず、.debugディレクトリのみが含まれています。

   <host/dir/path>/bin/.debug
   <host/dir/path>/lib/.debug
   <host/dir/path>/usr/bin/.debug
   <host/dir/path>/usr/lib/.debug
   <host/dir/path>/usr/sbin/.debug
   <host/dir/path>/sbin/.debug

次のオプションを試しましたが、gdb-multiarchは.debugを含むローカルツリーをポイントできませんでした。

オプション1

    set debug-file-directory <local-host-dir>

観察された問題は、gdbがリモートターゲットで.debugを見つけると思うことです。

    Reading symbols from target:/usr/sbin/helloworld...Reading /usr/sbin/.debug/helloworld from remote target...
    (no debugging symbols found)...done.

オプション2

    set sysroots <local-host-dir>

観察された問題はバイナリがないことです。

localhostからシンボルファイルをロードし、ターゲットでそのライブラリ/バイナリを使用するには、どのgdbコマンドを使用する必要がありますか?

ベストアンサー1

これは私にとって有効な答えではありませんが、これらの3行はデバッグ経験に大きな影響を与えます。

set solib-search-path /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib

したがって、私は職場でARMのlinarosコンパイラを使用し、ビルドプロセスの一部には標準ライブラリのsysroot-glibc-linaroディレクトリを参照することが含まれます。

set sysroot ../build/_arm-linux-gnueabihf/root

ビルド環境は、ARMリモートのルートディレクトリに非常に近いディレクトリを作成する必要があります。たとえば、上記のルートディレクトリを一覧表示すると、usr/lib/bin/etc/...etcなどの一般的な内容が表示されます。これにより、gdbがローカルで1:1の一致を見つけるときにディレクトリ構造がそれを達成するように配置されます。

set debug-file-directory ../arm-linux-gnueabihf/debug-syms

したがって、バイナリでもデバッグ情報が削除され、他の場所に配置されている場合は、上記のコマンドを使用するのと同じくらい簡単でなければなりません。しかし、私が使用したコマンドの組み合わせに応じて、私もあなたと同じ問題に遭遇しました。

(gdb) show sysroot
The current system root is "/home/user/ws3/code/mcdocker1604/build_IXM150_arm-linux-gnueabihf/root/".    
(gdb) show solib-search-path 
The search path for loading non-absolute shared library symbol files is /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib.
(gdb) show debug-file-directory 
The directory where separate debug symbols are searched for is "/home/user/ws3/code/mcdocker1604/build_IXM150_arm-linux-gnueabihf/debug-syms".
(gdb) target remote 10.235.221.21
10.235.221.21: No such file or directory.
(gdb) target remote 10.235.221.21:123
Remote debugging using 10.235.221.21:123
No executable file now.
warning: Could not load vsyscall page because no executable was specified
0xb43f7916 in ?? ()
(gdb) set sysroot ""
Error reading attached process's symbol file.
: No such file or directory.
warning: Could not load shared library symbols for 14 libraries, e.g. /lib/libpal.so.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Reading symbols from /home/user/ws3/code/build_IXM150_arm-linux-gnueabihf/root/app/lib/libFW.so...
(No debugging symbols found in /home/user/ws3/code/build_IXM150_arm-linux-gnueabihf/root/app/lib/libFW.so)
Reading symbols from /home/user/ws3/code/build_IXM150_arm-linux-gnueabihf/root/app/lib/libMCSvcClient.so...
(No debugging symbols found in /home/user/ws3/code/build_IXM150_arm-linux-gnueabihf/root/app/lib/libMCSvcClient.so)
Reading symbols from /home/user/ws3/code/build_IXM150_arm-linux-gnueabihf/root/app/lib/libMCSvcServer.so...
(No debugging symbols found in /home/user/ws3/code/build_IXM150_arm-linux-gnueabihf/root/app/lib/libMCSvcServer.so)
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libcrypt.so.1...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libpthread.so.0...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/librt.so.1...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libstdc++.so.6...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libm.so.6...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libgcc_s.so.1...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libc.so.6...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libnsl.so.1...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libresolv.so.2...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/ld-linux-armhf.so.3...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libdl.so.2...
Reading symbols from /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/lib/libnss_files.so.2...
Error reading attached process's symbol file.
: No such file or directory.
(gdb) set solib-search-path /usr/local/sysroot-glibc-linaro-2.25-2017.08-arm-linux-gnueabihf/
Error reading attached process's symbol file.
: No such file or directory.
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Error reading attached process's symbol file.
: No such file or directory.

私はsysrootまたはデバッグファイルディレクトリのいずれかを設定しましたが、どちらも設定しなかったという印象を受けました。 sysrootは、すべてがローカルに表示されると予想しているように見え、デバッグシンボルが別の.debugファイルとして削除されない場合は、最もうまく機能すると思います。

私はすべてのパズルを解いたが、うまくいかないことを知っているので、これについて叫んでいます。

Reading /home/user/ws3/code/mcdocker1604/build_IXM150_arm-linux-gnueabihf/debug-syms/lib//libunwind-arm.so.8.0.1.debug from remote target...
Reading target:/home/user/ws3/code/mcdocker1604/build_IXM150_arm-linux-gnueabihf/debug-syms/lib//libunwind-arm.so.8.0.1.debug from remote target...
(No debugging symbols found in target:/lib/libunwind-arm.so.8)

メッセージが表示されますが、パスに追加/が表示されることがわかります。 // 他に何か期待しているかどうかはわかりません。

おすすめ記事