平台是Mac,使用NDK r11b
,我的应用程序包含大约8个c / c ++文件。在过去,我通过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 ]
任何帮助或见解都将不胜感激
答案 0 :(得分:0)
同样的故事 - 我能够过去"等待调试器"发出ndk-gdb --launch --force --nowait
的新调试会话消息
但即使使用Google的NDK样本,ndk-gdb仍然无法正常工作。
只有info thread
命令才会产生实际结果,除了堆栈跟踪 - bt
,info stack
以及其他对损坏堆栈的投诉。
我的目标设备是运行API 23的Nexus 5,带有最新更新。
NDK r11b编译的相同二进制文件可以通过GDB 7.7从之前的NDK r10e成功调试。
在Windows上,ndk-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 r11b中的ndk-gdb.py
仅适用于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
答案 1 :(得分:0)
此问题已发布到Mikhail提供的https://github.com/android-ndk/ndk/issues网站。该问题已分配并声明已解决:决议将在NDK r11c中传播;
https://github.com/android-ndk/ndk/issues/51
另外我更新到R11c。一切都在运作