mjo*_*eer 4 android gdb native android-ndk ndk-gdb
请帮我使用ndk-gdb!
我搜索了StackOverflow和其他互联网=)但仍然做错了什么.
配置:MacOSX 64 +最新SDK +最新NDK +最新IDEA + Nexus 7 +巨大的C++项目.
我做了所有共同的安排:
-g -ggdb -O0到LOCAL_CFLAGS(也试过-g)APP_OPTIM := debugdebuggable=«true» 在清单中ndk-build NDK_DEBUG=1我得到了预期的gdb.setup和gdbserver文件,BUT nm命令给我*.so文件的零输出.
我ndk-gdb在项目的根文件夹中运行并运行GDB - 例如我可以暂停应用程序并恢复它,可以在地址上获取ASM代码等等.即使我设置制动点break Class::method,gdb告诉我正确的文件名和行号.
但断点并没有达到99%.Backstack总是显然是错误的(错误的方法名称).看起来所有符号名称和地址映射错误.
我错过了什么?
UPD.gdb在启动时输出两个命令info sharedlibrary和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.>
Run Code Online (Sandbox Code Playgroud)
你可以看到
好的,最后我做到了.这一点APP_ABI符合要求Application.mk.有两个ABI,不知怎的,这混淆了GDB.现在它适用于一个abi(我选择armeabi-v7a).
还有一点,我也想注意一下
APP_OPTIM := debug和APP_CFLAG := -g -ggdb -O0使用Application.mk; android:debuggable="true"在清单和NDK_DEBUG=1为ndk-build.我还没弄清楚他们是否能以某种方式帮助GDB更好地工作.其中一些是彼此重复的.当然,没有人会做得更糟.Breakpoint address adjustedNM命令.我也不太了解它,但它一直给我在我想要检查的每个文件上的零输出.真正重要的是 - info sharedlibrary在工作GDB中输出命令.检查您的图书馆是否有符号(例如我lib3.so上面的示例).这是必要的,但还不够.| 归档时间: |
|
| 查看次数: |
6822 次 |
| 最近记录: |