简体   繁体   中英

How to debug an Qt-Android application build with cmake?

I want to debug a Qt based Android application which is build using cmake (instead of qmake).

The androiddeployqt command bundles the apk and adds gdbserver . Then I can launch the gdb server via:

adb shell run-as com.package.name /data/data/com.package.name/lib/libgdbserver.so --once :5055 --attach $PID

and also I forward the port to my desktop via adb forward tcp:5055 tcp:5055

Attaching gdb from Qt-Creator succeeds but something seems to be missing. I am not shown any symbols and the number of displayed threads is not coherent.

I finally managed to get it running. For future documentation, here is what I was missing: I needed the libraries of my application as well as the Qt libraries build in debug mode. Further more I needed the executables and libraries from the phone. I fetched them via

adb pull /system/bin  ./
adb pull /system/lib  ./

adb creates subfolders when pulling and that was one of my problems: All these files need to be stored in one single folder – so I moved them.

Finally I needed to make gdb use the collected files via

set auto-solib-add on
set solib-search-path /tmp/adb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM