Ndk-gdb with several such libs

I found out about the Android NDK r4 debugging tool "ndk-gdb". Now I can start debugging the hello-jni sample (although there is some problem).

But for my own Android applications, I have several such libraries that can be used from a large number of c / C ++ files. I used to create these files with ndk-build and then copied these files to the $ PROJECT / libs directory and it works fine without debugging. But now I want to debug one such lib with ndk-gdb. When I started ndk-gdb, he complained that the character table was not loaded.

I also copy all these files to the $ PROJECT / bin / ndk / local / armeabi file (this seems to be the default directory where gdb tries to load the character table). And yet it does not work.

Maybe ndk-gdb will not be able to track my files after copying them? Or why can't it load symbol tables even after I copy them to $ PROJECT / bin / ndk / local / armeabi?

Does anyone have encountered this problem before?

Thank you so much!

+7
android android-ndk gdb
source share
1 answer

I think you are copying them to the wrong folder. The older NDKs copied the files to the bin folder; the new one copies them to the obj folder and that where it tells gdb to look for characters.

Also, make sure you copy the pre-shared .so files to the obj folder, not the files you copied to the libs folder. As part of the build process, the files in the libs folder were devoid of characters and debugging information. Therefore, you need to save two copies of each of your .so files: one from the libs folder for installation on the Android device and one from the obj folder for installation for GDB to receive the characters.

Instead of copying debug files to the obj folder in the application tree, you can add another obj / folders directory for assembly to the gdb symbol search path. ndk-build installs the gdb.setup file, which includes a line starting with set solib-search-path . You can put a colon-separated path on this line that includes all of your target obj / local / whatever folders, and then gdb will find the characters.

+10
source share

All Articles