Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Debug shared object on remote device with QtCreator?



  • I created a simple hello world application and link a shared object. Now I want to debug but I can't step into the library code.

    My environment is a Ubuntu 14.04 connected with a Raspberry Pi 2 with Qt5.6 Libraries. Qt works successfully but I can't find some setting I have to add to the .pro file to get this work.

    Any ideas?


  • Lifetime Qt Champion

    Does the library contain debug symbols?
    You need a debug build of that library.



  • @jsulm yes both are enabled for debug target.


  • Lifetime Qt Champion

    What happens if you try to step into the library?
    Do you see assembler code?
    And does your app link against the debug build of that library?



  • @fl0mll I tried the same application on desktop build and this works.



  • @jsulm If I step into the QtCreator wait for some seconds and returns at the next line. If I try the same on Desktop it steps into the library code.



  • @jsulm

    Do you see assembler code?
    no
    And does your app link against the debug build of that library?
    yes, because the build folder includes name debug.

    I checked the output again and I get some console outputs:

    Could not load shared library symbols for 2 libraries, e.g. /usr/bin/QSettingsDemo.
    Use the "info sharedlibrary" command to see the complete listing.
    Do you need "set solib-search-path" or "set sysroot"?File "/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libstdc++.so.6.0.19-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
    

  • Lifetime Qt Champion

    You should check with ldd whether your app really links against debug build of that library. Being built in the debug directory does not mean it is linked against debug build of a library.


  • Lifetime Qt Champion

    "Could not load shared library symbols for 2 libraries, e.g. /usr/bin/QSettingsDemo" - that says that these two libraries do not contain symbols (release build).



  • @jsulm I got this output with ldd

    ldd /usr/lib/libDemoLibrary.so.1.0.0
    checking sub-depends for '/usr/lib/libQtNetwork.so.4'
    checking sub-depends for '/usr/lib/libQtCore.so.4'
    checking sub-depends for '/lib/libpthread.so.0'
    	ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb6f02000)
    	libdl.so.0 => /lib/libdl.so.0 (0xb6ef6000)
    	libc.so.0 => /lib/libc.so.0 (0xb6ea8000)
    checking sub-depends for '/usr/lib/libstdc++.so.6'
    checking sub-depends for '/lib/libm.so.0'
    	libc.so.0 => /lib/libc.so.0 (0xb6f54000)
    	ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb6fa2000)
    checking sub-depends for '/lib/libgcc_s.so.1'
    checking sub-depends for '/lib/libc.so.0'
    	ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb6f52000)
    checking sub-depends for '/lib/libdl.so.0'
    	libc.so.0 => /lib/libc.so.0 (0xb6f77000)
    	ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb6fc5000)
    checking sub-depends for '/lib/librt.so.0'
    	libc.so.0 => /lib/libc.so.0 (0xb6f3e000)
    	libdl.so.0 => /lib/libdl.so.0 (0xb6f32000)
    	libpthread.so.0 => /lib/libpthread.so.0 (0xb6f17000)
    	ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb6f8c000)
    	libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0x00000000)
    	libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00000000)
    	libpthread.so.0 => /lib/libpthread.so.0 (0x00000000)
    	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00000000)
    	libm.so.0 => /lib/libm.so.0 (0x00000000)
    	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00000000)
    	libc.so.0 => /lib/libc.so.0 (0x00000000)
    	libdl.so.0 => /lib/libdl.so.0 (0x00000000)
    	librt.so.0 => /lib/librt.so.0 (0x00000000)
    	/lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000)
    	/lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000)
    

  • Lifetime Qt Champion

    I actually meant to use ldd with the executable.
    Is /usr/lib/libDemoLibrary.so.1.0.0 the library you want to debug?
    Is it built in debug or release mode?
    What does "nm /usr/lib/libDemoLibrary.so.1.0.0" say?



  • @jsulm I found a nice information http://visualgdb.com/gdbreference/commands/set_solib-search-path

    Now I set the solib-search-path on the gdb Additional Startup Commands and it works. It takes some seconds before it could step into but it works.

    This way is not comfortable so is there a way to add this to the .pro file?


Log in to reply