ndk-gdb with multiple so libs

后端 未结 1 627
忘了有多久
忘了有多久 2021-02-04 17:24

I learned about the debug tool of \"ndk-gdb\" from Android NDK r4. Now I can start debugging the hello-jni sample(although some issue exists).

But, for my own Android ap

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 18:03

    I think you're copying them to the wrong folder. The older NDK copied files to the bin folder; the new one copies them to the obj folder, and that's where it points gdb to look for symbols.

    Also, be sure that you copy the pre-stripped .so files to the obj folder, and not the same files that you copy to the libs folder: As part of the build process, the files in the libs folder have been stripped of symbols and debugging information. So you'll want to keep two copies of each of your .so files: One from the libs folder to install on the Android device, and one from the obj folder to install for GDB to get symbols from.

    You could, instead of copying the debug files to the obj folder in your app tree, add the other build directory obj/ folders to gdb's symbol search path. ndk-build sets up a file, gdb.setup, that includes a line that starts with set solib-search-path. You can put a colon-separated path on that line that includes all of your target obj/local/whatever folders, and then gdb will find the symbols.

    0 讨论(0)
提交回复
热议问题