ndk-gdb调试无法加载符号:说无法获取线程创建断点的位置

时间:2014-03-11 13:32:44

标签: debugging android-ndk ndk-gdb

我有一个Android本机代码,它包含一个静态库(XXX.a),最后的ndk-build命令(NDK_DEBUG设置为1)获取上面预构建的静态库并创建一个共享对象。

我使用nm命令查看特定函数定义的共享对象,它似乎可用(001ff2f5 T XXXXX)。

但是当我在运行4.4.2的Android设备上运行ndk-gdb时,gdb无法加载共享对象符号:

Android NDK installation path: /opt/android-ndk-r8
Using specific adb command: ~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags: 
Using auto-detected project path: .
Found package name: com.example.ue2fileviewer
ABIs targetted by application: armeabi
Device API Level: 19
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /opt/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.example.ue2fileviewer/lib/gdbserver
Found data directory: '/data/data/com.example.ue2fileviewer'
Found first launchable activity: .UE2FvSample
Launching activity: com.example.ue2fileviewer/.UE2FvSample
COMMAND: ~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb shell am start -n com.example.ue2fileviewer/.UE2FvSample
Starting: Intent { cmp=com.example.ue2fileviewer/.UE2FvSample }
COMMAND:~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb shell sleep 10
Found running PID: 1650
Killing existing debugging session
COMMAND: ~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb shell kill -9 29470
/system/bin/sh: kill: 29470: Operation not permitted
Launched gdbserver succesfully.
Setup network redirection
COMMAND:~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb forward tcp:5039 localfilesystem:/data/data/com.example.ue2fileviewer/debug-socket
COMMAND: ~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb shell run-as com.example.ue2fileviewer lib/gdbserver +debug-socket --attach 1650
COMMAND: ~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb pull /system/bin/app_process ./obj/local/armeabi/app_process
Attached; pid = 1650
Listening on sockaddr socket debug-socket
106 KB/s (9560 bytes in 0.087s)
Pulled app_process from device/emulator.
COMMAND: ~/Desktop/adt-bundle-linux-x86-20131030/sdk/platform-tools/adb pull /system/lib/libc.so ./obj/local/armeabi/libc.so
780 KB/s (310652 bytes in 0.388s)
Pulled libc.so from device/emulator.
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i386-linux-gnu --target=arm-elf-linux".
(no debugging symbols found)
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: shared library handler failed to enable breakpoint
0x4004f73c in ?? ()
gdb: Unable to get location for thread creation breakpoint: requested event is not supported
(gdb) 

我在Ubuntu,ndk-r8 NDK版本和Android SDK平台android-19上运行它。

我已经尝试了几乎所有当前可用的堆栈溢出的帖子,但似乎没有一个对我有用。我一直在尝试在静态库中存在的函数中设置断点但没有成功。

有人可以提供一个洞察我可能出错的地方以及如何从这里开始让ndk-gdb调试工作吗?

1 个答案:

答案 0 :(得分:0)

除了NDK_DEBUG = 1之外,你能尝试用APP_OPTIM = debug进行编译吗? 此外,升级到最新版本的NDK(r9d)可能会有所帮助,因为自r8以来有大量关于gdb的错误修复。