Gdb Remote Debug I / O Error on Android

I am trying to debug an Android application that calls native code to perform GL rendering. Native code is the existing code that I am trying to plug in (and that I really don't know that). I have existing compilation, binding and installation of code, and I have some native functions that call code that is correctly called from my Java code. I get a segfault which I am trying to track, and having some problems getting gdb to set a breakpoint in the program. This is on Windows XP with Cygwin - and I should probably mention that I'm still learning gdb.

I started with the directions from http://honeypod.blogspot.com/2008/01/debug-native-application-for-android.html ; this is what i am doing now.

Run the application in the emulator.

At the cmd command prompt:

> 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 the 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 is set in order, and that the characters are in order, but the address may be incorrect when it tries to insert a breakpoint. I tried several variations of the various commands on the web page mentioned above, but still no luck.

Any ideas what is going on?

thanks

+4
source share
1 answer

In fact, at the moment with NDK 1.6, I found that this debugging is strictly not supported strictly using the NDK. However, if you use the PDK (platform development kit), you can do this debugging using your own code. We did not try the PDK because the map file generation worked well enough for us (see this SO question ), but if you go along this route check the Google NDK group for more details.

+1
source

Source: https://habr.com/ru/post/1301505/


All Articles