2
votes

I run a cross debug session with GDB. GDB is configured with option --with-sysroot, how described in the docs. My Application uses shared libraries like the following.

Code:

    libpthread.so.0 => /lib/libpthread.so.0 (0x40026000)
    libm.so.6 => /lib/libm.so.6 (0x40046000)
    libdl.so.2 => /lib/libdl.so.2 (0x400b9000)
    librt.so.1 => /lib/librt.so.1 (0x400c4000)
    libts-0.0.so.0 => /usr/lib/libts-0.0.so.0 (0x400d3000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4015f000)
    libz.so.1 => /usr/lib/libz.so.1 (0x401d3000)
    libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x401ee000)

The libraries pthread, libdl, ... are found in my toolchain, declared by set sysroot, --with-sysroot and set solib-absolute-path The libraries libts, libz, ... are available in my additional path for shared libraries, declared in session with set solib-search-path

For the libraries libfreetype, libjpeg the following error occurs:

102,416 &"warning: `/usr/lib/libfreetype.so.6': Shared library architecture unknown is not compatible with target architecture arm.\n"
102,416 =library-loaded,id="/usr/lib/libfreetype.so.6",target-name="/usr/liblibfreetype.so.6",host-name="/usr/lib/libfreetype.so.6",symbols-loaded="0",thread-group="i1"

The reason GDB still takes libraries of host rootfs, once not found in the toolchain, and available in host rootfs. It doesn't care about my additional path declared with set solib-search-path

I configured GDB with --with-sysroot, declared additional set sysroot, set solib-search-path, set solib-absolute-path (nevermind alias of set sysroot).

In the docu, --prefix configures GDB to take the sysroot autmatically, but why this is higher prior than --with-sysroot?

Is GDB using the order sysroot, host-sysroot, solib-search-path?

What i missed to tell GDB, not to use the host rootfs?

1
"I'm guessing this use case wasn't originally considered, because it doesn't look like how set sysroot/solib-search-path are meant to be used. (gdb) help set solib-search-path Set the search path for loading non-absolute shared library symbol files. This takes precedence over the environment variables PATH and LD_LIBRARY_PATH. ... IOW, make the sysroot wholly self contained (you can use symlinks though), and forget about solib-search-path." - sourceware.org/bugzilla/show_bug.cgi?id=13989user1108078

1 Answers

0
votes

There is a gdb bug tracking the very same issue http://sourceware.org/bugzilla/show_bug.cgi?id=13989

It is not fixed until version gdb-7.4. So, I think this behavior is expected with previous versions.