0
votes

I'm using Qt Creator 3.2.1 and gdb 7.6.2 (powerpc64-fsl-linux-gdb from QorIQ SDK 1.8) for debugging cross compiled applications.

On my ppc64 test machine (Yocto) I run gdbserver: gdbserver :666 /path/to/myapp

Then I connect using Qt Creator on my x86_64 dev machine (Debian) to gdbserver. I've specified Kit (sysroot is /opt/fsl-networking/QorIQ-SDK-V1.8/sysroots/ppc64e6500-fsl-linux), the toolchain gdb, etc... This works so far. I can debug any application.

But if my application links dynamically to a library and I want to debug this library (/path/to/libmylib.so), gdb within Qt Creator fails to step into the breakpoints of mylib.

What I want to do with Qt Creator is like this:

  1. Yocto: start the gdbserver
  2. Debian: run powerpc64-fsl-linux-gdb /path/to/myapp and enter
    • set solib-search-path /path/to/mylib/
    • target remote 192.168.120.211:666
    • break MyLibraryFunctionIWantToDebug
    • run
    • c

Log:

GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-fslsdk-linux --target=powerpc64-fsl-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /path/to/myapp...done.
(gdb) show solib-search-path
The search path for loading non-absolute shared library symbol files is .
(gdb) set solib-search-path /path/to/mylib/
(gdb) show solib-search-pat
The search path for loading non-absolute shared library symbol files is /path/to/mylib/.
(gdb) target remote 192.168.120.211:666
Remote debugging using 192.168.120.211:666
(gdb) break MyLibraryFunctionIWantToDebug
Breakpoint 1 at 0x10001088: file /path/to/myapp/myapp.c, line 196.
(gdb) run
The "remote" target does not support "run".  Try "help target" or "continue".
(gdb) c
...

Research so far:

  • gdb has a bug in version 7.4 (I'm using 7.6.2 right now)
  • I can put the set solib-search-path /path/to/mylib/ command into .gdbinit. In Qt Creator every .gdbinit file is ignored. I've tried multiple locations, e.g. ~/.gdbinit, /path/to/myapp/.gdbinit, command line arguments option in Qt creator: -x ~/.gdbinit, Tools > Options > Debuggers putting the command into every additional field. None works :-(
  • I'm not alone with my question, see here or here

Any ideas how to cross debug with gdb in Qt Creator when using shared libraries?

1
try to 'gdb attach pid' stackoverflow.com/questions/2308653/…qknight

1 Answers

0
votes

Maybe it's changed with QtCreator 3.6 (what I'm using), but if I put the set solib-search-path command in the "Additional Attach Commands" fiend and only that field, I got it to work.

Granted, my case may not be fully applicable to yours as it's not a full cross-compilation, but a case of running GDB on a different version of Linux than my remote target runs.