Help me please to use ndk-gdb!
I searched through StackOverflow and other internets =) but still doing something wrong.
Configuration: MacOSX 64 + latest SDK + latest NDK + latest IDEA + Nexus 7 + huge C++ project.
I did all the common arrangement:
-g -ggdb -O0
toLOCAL_CFLAGS
(also tried just-g
)APP_OPTIM := debug
debuggable=«true»
in manifestndk-build NDK_DEBUG=1
I get expected gdb.setup and gdbserver files, BUT nm
command give me zero output on my *.so files.
I run ndk-gdb
in project's root folder and get working GDB - e.g. i can pause app and resume it, can get ASM code on adress and so on. Even when i set brakepoints with break Class::method
, gdb tell me right file name and line number.
But breakpoints does not hit in 99%. Backstack is always obviously wrong (wrong method names). Looks like all the symbolic names and addresses mapped wrong.
What have I missed?
UPD. gdb output at start with two commands info sharedlibrary
and C
.
: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, e.g. 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) is loaded most correctly (or not?)
- breakpoint address adjusted (what does it mean?)