0

平台是 Mac,使用NDK r11b,我的应用程序由大约 8 个 c/c++ so 文件组成。过去我通过 NDK r10e 使用过 ndk-gdb (sh) 脚本。shell 脚本现在已被弃用,ndk-gdb.py现在是唯一的选择。问题是我无法让它工作。我像往常一样从我的项目文件夹中运行它。我尝试了多个命令行选项,但没有成功。感觉好像没有找到我的源文件。它使用"Waiting for Debugger". 我到了(gdb) prompt。我尝试添加断点,但在可靠的中断点处没有中断。我需要一些关于如何为 ndk-gdb 配置和使用 python 版本的指示。谷歌已经删除了文档文件,我在任何地方都找不到任何足以作为指南的东西。

我尝试过的一些命令行。

ndk-gdb --launch --verbose 这会启动应用程序,但会阻止等待调试器

ndk-gdb将附加到正在运行的进程。ctr-c 将暂停执行,但回溯会bt列出损坏的堆栈。

ndk-gdb --launch -t -v -p $ProjectDir 我得到了一个我不熟悉的新界面,上面写着[ No Source Available ]

任何帮助或见解将不胜感激

4

2 回答 2

0

对我来说同样的故事 - 我能够通过发出“等待调试器”消息来进行新的调试会话,ndk-gdb --launch --force --nowait 但即使使用 Google 的 NDK 示例,ndk-gdb 仍然无法正常工作。除了堆栈跟踪 -和其他有关损坏堆栈的投诉外,只有info thread命令会产生实际结果。我的目标设备是运行最新更新的 API 23 的 Nexus 5。由 NDK r11b 编译的相同二进制文件可以通过 GDB 7.7 从以前的 NDK r10e 成功调试。在 Windows 上,失败并显示以下错误消息:btinfo stackndk-gdb.py

Traceback (most recent call last): File "F:\work\android-ndk-r11b\prebuilt\windows\bin\ndk-gdb.py", line 704, in <module> main() File "F:\work\android-ndk-r11b\prebuilt\windows\bin\ndk-gdb.py", line 583, in main args.props = device.get_props() File "F:\work\android-ndk-r11b\python-packages\adb\device.py", line 459, in get_props raise RuntimeError('invalid getprop line: "{}"'.format(line)) RuntimeError: invalid getprop line: ""

实际上,ndk-gdb.py从 NDK r11b 看来,它只适用于 Linux:

vagrant@vagrant:/vagrant/native_activity$ $ANDROID_NDK_ROOT/ndk-gdb --launch --force WARNING: Failed to find jdb on your path, defaulting to --nowait Redirecting gdbclient output to /tmp/gdbclient-9150 GNU gdb (GDB) 7.10 ... This GDB was configured as "x86_64-linux-gnu". ... warning: Could not load shared library symbols for 110 libraries, e.g. /system/lib/libcutils.so. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"? 0xb6c93894 in __epoll_pwait () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so (gdb) info sources Source files for which symbols have been read in: Source files for which symbols will be read in on demand: /Volumes/Android/buildbot/tmp/build/toolchain/gcc-4.9/gcc/include/unwind-arm-common.h, /Volumes/Android/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/pr-support.c, /Volumes/Android/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/libunwind.S, /Volumes/Android/buildbot/tmp/build/toolchain/gcc-4.9/arm-linux-androideabi/armv7-a/libgcc/./unwind.h, /Volumes/Android/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc, /Volumes/Android/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/config/arm/unwind-arm.c, /Users/mike/android-ndk-r11b/sources/android/native_app_glue/android_native_app_glue.c, /vagrant/native_activity/jni/main.c

基本命令正常工作:

(gdb) bt #0 0xb6c93894 in __epoll_pwait () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so #1 0xb6c6ce72 in epoll_pwait () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so #2 0xb6c6ce80 in epoll_wait () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so #3 0xb6ebfc5a in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) info thread Id Target Id Frame 11 Thread 28735 0xb6c6a5e4 in syscall () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 10 Thread 28733 0xb6c93894 in __epoll_pwait () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 9 Thread 28721 0xb6c939bc in __ioctl () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 8 Thread 28720 0xb6c939bc in __ioctl () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 7 Thread 28719 0xb6c6a5e4 in syscall () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 6 Thread 28718 0xb6c6a5e4 in syscall () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 5 Thread 28717 0xb6c6a5e4 in syscall () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 4 Thread 28716 0xb6c6a5e4 in syscall () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 3 Thread 28715 0xb6c94948 in recvmsg () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so 2 Thread 28714 0xb6c93b68 in __rt_sigtimedwait () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so * 1 Thread 28709 0xb6c93894 in __epoll_pwait () from /vagrant/native_activity/obj/local/armeabi-v7a/system/lib/libc.so

于 2016-03-23T19:47:43.517 回答
0

此问题已发布到 Mikhail 提供的https://github.com/android-ndk/ndk/issues站点。该问题已分配并声称已修复:解决方案将在 NDK r11c 中传播;

https://github.com/android-ndk/ndk/issues/51

另外我更新到 R11c。现在一切正常

于 2016-03-30T14:51:09.343 回答