我正在尝试调试一个调用本机代码来进行GL渲染的android应用。本机代码是我要移植的现有代码(我不太了解)。我已经正确地编译,链接和安装了现有代码,并且有一些本机函数可以从我的Java代码正确调用该代码。我遇到了要跟踪的段错误,让gdb在程序中设置断点时遇到了一些问题。这是在使用Cygwin的Windows XP上进行的-我可能应该提到我仍在学习gdb。
在模拟器中启动应用程序。
在cmd提示中:
> adb forward tcp:1234 tcp:1234
> adb shell
# gdbserver localhost:1234 --attach 2120
gdbserver localhost:1234 --attach 2120
Attached; pid = 2120
Listening on port 1234
在cygwin外壳中:
arm-eabi-4.2.1/bin/arm-eabi-gdb.exe out/apps/app-android/libDM.so
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=i686-pc-cygwin --target=arm-elf-linux"...
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
warning: shared library handler failed to enable breakpoint
0xafe0da04 in AppRefCounted::unref () at ../../stlport/stl/_iosfwd.h:39
39 class basic_ostream;
Current language: auto; currently c++
(gdb) b Java_com_app_AppRenderer_onCreate
Breakpoint 1 at 0xafff1b1a: file apps/app-android/../../../app-Android/jni/DMJNI/DMInterface.cpp, line 75.
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0xafff1b1a: Input/Output error.
因此,看起来断点设置正确,符号也可以,但是在尝试插入断点时地址可能错误。我已经从上面引用的网页中尝试了几种不同命令的变体,但是到目前为止,还没有运气。
有什么想法吗?
谢谢