I have been trying to debug my native library for some time, and it just won't work. The native code works and compiles, but for optimization purposes, I really need to debug my own code.
I read and followed many tutorials (e.g. tutorial1 , tutorial2 ) step by step, but I am getting some errors that I cannot find a solution to.
I set up the Android and C ++ debugging configuration, and after I debug the Android debugging configuration, it gets to the breakpoint after loading the library (only one). I go to cygwin and see if my device is detected (what it is). Then run:
$ ndk-gdb --start --verbose
Which gives me the following result:
Android NDK installation path: /cygdrive/c/Android/android-ndk/android-ndk-r8 Using default adb command: /cygdrive/c/Android/android-sdk/platform-tools/adb ADB version found: Android Debug Bridge version 1.0.29 Using ADB flags: Using auto-detected project path: . Found package name: com.mypackage ABIs targetted by application: armeabi-v7a Device API Level: 15 Device CPU ABIs: armeabi-v7a armeabi Compatible device ABI: armeabi-v7a Using gdb setup init: ./libs/armeabi-v7a/gdb.setup Using toolchain prefix: /cygdrive/c/Android/android-ndk/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi- Using app out directory: ./obj/local/armeabi-v7a Found debuggable flag: true Found device gdbserver: /data/data/com.mypackage/lib/gdbserver Found data directory: '/data/data/com.mypackage' Found first launchable activity: .MainActivity Launching activity: com.mypackage/.MainActivity
I see gdbserver running successfully, which is good, but I donβt know why this is happening:
Could not open remote device: Invalid argument
since adb can connect to the device (as previously verified). After that, it seems to me (I'm not too good at cygwin) that gdb just closes everything and that will make C ++ Debug in eclipse fail. When I launched it, the following error appeared:
76-target-select remote localhost:5039 &"Remote communication error: Bad file descriptor.\n" Remote communication error: Bad file descriptor. 76^error,msg="Remote communication error: Bad file descriptor."
Is there anything that could prevent my device from being detected in adb? I use this device for testing (without C ++ debugging) all the time without problems.
Or is the problem a port error?