3

I have a setup at hand where target device has only stripped libraries and binaries . Target has gdbserver. On host I am using gdb-multiarch. Host has a directory that contains respective ".debug" directories. This directory on host does not contain the unstripped libraries/binaries, only .debug directories

   <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

I tried following options, but I have not been able to point gdb-multiarch to local tree that contains the .debug

Option-1

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

Issue observed is that gdb thinks it will find .debug on remote target

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

Option-2

    set sysroots <local-host-dir>

Issue observed is that does not have the binary

Which gdb commands I must use that will allow me to load the symbol files from local-host and use the corresponding libraries/binaries from target?

1 Answer 1

1

It's not a working answer for me, but these are the three lines that should have a significant effect on your debugging experience.

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

So I use linaros compiler for ARM at work and part of the build process includes reference the sysroot-glibc-linaro directory for your standard libraries.

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

Your build environment should generate a directory that is very very close to what the root directory is on your ARM remote. For example when I ll my root directory above I get the usual stuff you'd see like usr/ lib/ bin/ etc/...etc. That way when gdb looks locally for 1 to 1 matches, your directory structure lines up for that to be achieved.

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

So if your binaries are also stripped of debug information and put somewhere else it should be as simple as using the command above. But I'm also having issues the same issues as you depending on which combination of commands I use.

(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.

The impression I'm getting is that you either set sysroot or you set the debug-file-directory, but never both. sysroot just seems to expect everything to be present locally and I'm thinking it works best if debugging symbols aren't stripped into seperate .debug files.

I'm just word vomiting all this because I know I have all the pieces of the puzzle but it's just not working, I too get the...

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)

Messages, but for me you can see I'm getting an extra / on my path, I just don't know if it's expecting something else in between the //

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .