Aleksei Petrenko
Aleksei Petrenko

Reputation: 7188

Debug external shared library in Qt Creator Android project

I have Qt Quick Android app which uses external C++ library.

I build this library by myself using CMake and CMAKE_BUILD_TYPE is set to Debug. When I launch app in Qt Creator debug mode I can stop on breakpoints in my Qt code, but it doesn't jump into library calls, I see only assembler listings.

Is it possible to tell debugger where library source code is and is it even possible to debug in Android like this?

Upvotes: 1

Views: 3017

Answers (1)

Aleksei Petrenko
Aleksei Petrenko

Reputation: 7188

Ok, it's definitely possible.

First of all, make sure you indeed have all the debugging information in .so library:

<path-to-your-NDK>/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/objdump -S <your-lib-name>.so | less

You should see a mix of assembler and C++ code, this indicates that your library contains debug symbols.

After that make sure that Qt Creator is able to find your library during debug session. Start "Debug", then Windows->Views->Debugger log to open gdb console. Execute:

show solib-search-path

to see the full list of directories where gdb tries to find the library. Add path to your library if it's not there yet, like:

set solib-search-path <old-value>:<path-to-your-library>

I know it's a bit lame, there should be a way to automate this. But it worked for me.

Upvotes: 1

Related Questions