简体   繁体   English

gdb输入/输出错误远程调试到Android

[英]gdb Input/Output error remote debugging to Android

I'm trying to debug an android app that call native code to do some GL rendering. 我正在尝试调试一个调用本机代码的Android应用程序来进行一些GL渲染。 The native code is existing code that I'm trying to port (and that I don't really know that well). 本机代码是我正在尝试移植的现有代码(而且我真的不太清楚)。 I've got the existing code compiling, linking, and installing correctly, and I've got some native functions that call in to that code that are being correctly called from my Java code. 我已经正确编译,链接和安装现有代码,并且我有一些本机函数调用从我的Java代码正确调用的代码。 I'm getting a segfault that I'm trying to track down, and having some problems getting gdb to set a breakpoint in the program. 我正在尝试追踪一个段错误,并且在程序中让gdb设置断点时遇到一些问题。 This is on windows XP with Cygwin - and I should probably mention I'm still learning gdb. 这是在带有Cygwin的Windows XP上 - 我应该提到我还在学习gdb。

I started with the directions at http://honeypod.blogspot.com/2008/01/debug-native-application-for-android.html ; 我从http://honeypod.blogspot.com/2008/01/debug-native-application-for-android.html上的指示开始; here's what I'm currently doing. 这就是我目前正在做的事情。

Start the app in the emulator. 在模拟器中启动应用程序。

In a cmd prompt: 在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

In a cygwin shell: 在cygwin shell中:

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.

So it looks like the breakpoint gets set ok, and that the symbols are ok, but maybe the address is wrong when it tries to insert the breakpoint. 所以看起来断点设置正常,并且符号没问题,但是当尝试插入断点时,地址可能是错误的。 I've tried several variations of different commands from the webpage referenced above, but so far, no luck. 我已经从上面引用的网页尝试了不同命令的几种变体,但到目前为止,没有运气。

Any ideas what's going on? 有什么想法发生了什么?

Thanks 谢谢

Essentially, at this point with NDK 1.6, I've found that there just isn't support for this kind of debugging strictly with the NDK. 基本上,在NDK 1.6的这一点上,我发现严格使用NDK不支持这种调试。 However, if you use the PDK (platform development kit), you can do this kind of debugging with native code. 但是,如果使用PDK(平台开发工具包),则可以使用本机代码进行此类调试。 We haven't tried the PDK, because generating a map file worked well enough for us (see this SO question ), but if you do go that route, check the NDK google group for more details. 我们还没有尝试过PDK,因为生成一个地图文件对我们来说运作得很好(参见这个问题 ),但是如果你确实去了那条路线,请查看NDK谷歌小组了解更多细节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM