Help me use ndk-gdb!
I searched through StackOverflow and other internets =), but was still doing something wrong.
Configuration: MacOSX 64 + last SDK + last NDK + last IDEA + Nexus 7 + project with huge C ++.
I made all the general agreement:
-g -ggdb -O0 to LOCAL_CFLAGS (also tried only -g )APP_OPTIM := debugdebuggable=ยซtrueยป in the manifestndk-build NDK_DEBUG=1
I get the expected gdb.setup and gdbserver files, BUT nm gives me zero output in my * .so files.
I run ndk-gdb in the root folder of the project and get a working GDB - for example. I can pause the application and resume it, get the ASM code at address, etc. Even when I install brakepoints using break Class::method , gdb will tell me the correct file name and line number.
But breakpoints do not fall at 99%. The back panel is always clearly erroneous (incorrect method names). It seems like all the symbolic names and addresses are mapped incorrectly.
What did I miss?
UPD gdb at the beginning with two info sharedlibrary and C commands.
:ndk-gdb /android-ndk-macosx/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than >android:minSdkVersion 8 in ./AndroidManifest.xml /android-ndk-macosx/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than >android:minSdkVersion 8 in ./AndroidManifest.xml /android-ndk-macosx/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than >android:minSdkVersion 8 in ./AndroidManifest.xml /android-ndk-macosx/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than >android:minSdkVersion 8 in ./AndroidManifest.xml GNU gdb (GDB) 7.3.1-gg2 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-apple-darwin --target=arm-linux-android". For bug reporting instructions, please see: <http://source.android.com/source/report-bugs.html>. warning: .dynamic section for "/Users/<...>/android/obj/local/armeabi/lib1.so" is not at the expected address (wrong library or version >mismatch?) warning: Could not load shared library symbols for 73 libraries, eg libstdc++.so. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"? warning: Breakpoint address adjusted from 0x400aca53 to 0x400aca52. 0x401a7ee4 in epoll_wait () from /Users/<...>/android/obj/local/armeabi/libc.so (gdb) info sharedlibrary From To Syms Read Shared Object Library 0x400aa220 0x400b2978 Yes (*) /Users/<...>/android/obj/local/armeabi/linker 0x4019c860 0x401cc184 Yes (*) /Users/<...>/android/obj/local/armeabi/libc.so No libstdc++.so No libm.so <...dozens of system libs with "no"...> No libjnigraphics.so 0x6749c160 0x67527844 Yes (*) /Users/<...>/android/obj/local/armeabi/lib1.so 0x65c487f8 0x65c6634c Yes (*) /Users/<...>/android/obj/local/armeabi/lib2.so 0x693e62e8 0x699dcd90 Yes /Users/<...>/android/obj/local/armeabi/lib3.so (*): Shared library is missing debugging information. (gdb) C Continuing.>
You can see that
- lib3.so (main lib) loaded the most correctly (or not?)
- breakpoint address is adjusted (what does this mean?)
source share