我试图调试Android应用程序调用本地代码做一些GL渲染。本机代码是现有的,我试图端口(和我真的不知道那个好)代码。我有现有的代码编译,链接,并正确安装,我已经得到了到该代码正在正确地从我的Java代码调用调用一些本地函数。我得到我想要追查段错误,并且有越来越gdb来设置程序中的断点一些问题。这是在Windows XP上使用Cygwin - 我也许应该提到我还在学习GDB

我开始与方向在 HTTP:/ /honeypod.blogspot.com/2008/01/debug-native-application-for-android.html ;这里是目前我在做什么。

在仿真器中启动该应用。

在一个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.

所以它看起来像断点被设定好了,并且这些符号都OK,但也许该地址是错误的,当它试图插入断点。我已经尝试不同的命令的几种变化从以上引用的网页,但到目前为止,没有运气。

任何想法是怎么回事?

由于

有帮助吗?

解决方案

从本质上讲,在这一点上与NDK 1.6,我发现,那里只是没有为这种与NDK严格调试的支持。但是,如果您使用PDK(平台开发工具包),你可以做这样的原生代码调试。我们还没有尝试过的PDK,因为生成地图文件工作的很好,我们(见这太问题),但如果你走这条路线,检查的更多细节NDK谷歌组

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top