I've recently loaded the new Android dev tools, SDK 20130717 and NDK r9.
Up to now I had the previous versions, working and debugging from within Eclipse just fine on both of my systems, a XP and a W7/64.
Now, the W7/64 with the new tools does work and debug my apps ok after the new tools installation and the required path environment changes.
It works ok when I select the "Debug As" + "Android Native Application".
Yet the XP, although they have the exact configuration in terms of folders/cygwin etc, after the new tools installed and the necessary path env changed, it looks that it can't start the ndk-dbg and it;s stuck waiting in definitively at "Launching MyApp(1): (100%)". That happens after I select the "Debug As" + "Android Native Application".
Any hints on what might be the cause of it? or is there any known issue on XP and r9 debugging that I miss?
thanks, Christos
*edit
Tried to start manually the ndk-gdb and this is what I get, any hints are welcome
Blockquote
$ ndk-gdb --start --verbose --force
Android NDK installation path: /cygdrive/e/android-ndk-r9
Using default adb command: /cygdrive/e/adt-bundle-windows-x86-20130717/sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using JDB command: /cygdrive/e/Android/Java/jdk1.7.0_21/bin/jdb
Using auto-detected project path: .
Found package name: myndkpackage
ABIs targetted by application: armeabi-v7a
Device API Level: 17
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi-v7a
Using gdb setup init: ./libs/armeabi-v7a/gdb.setup
Using toolchain prefix: /cygdrive/e/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi-v7a
Found debuggable flag: true
Found device gdbserver: /data/data/myndkpackage/lib/gdbserver
Found data directory: '/data/data/myndkpackage'
Found first launchable activity: myndkpackage.MainActivity
Launching activity: myndkpackage/myndkpackage.MainActivity
COMMAND: adb_cmd shell am start -D -n myndkpackage/myndkpackage.MainActivity
Starting: Intent { cmp=myndkpackage/.MainActivity }
COMMAND: adb_cmd shell sleep 2
Found running PID: 2787
Killing existing debugging session
COMMAND: adb_cmd shell kill -9 2753
Launched gdbserver succesfully.
Setup network redirection
COMMAND: adb_cmd shell run-as myndkpackage lib/gdbserver +debug-socket --attach 2787
COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/myndkpackage/debug-socket
Attached; pid = 2787
Listening on Unix socket debug-socket
COMMAND: adb_cmd pull /system/bin/app_process obj/local/armeabi-v7a/app_process
599 KB/s (9588 bytes in 0.015s)
Pulled app_process from device/emulator.
COMMAND: adb_cmd pull /system/bin/linker obj/local/armeabi-v7a/linker
658 KB/s (63244 bytes in 0.093s)
Pulled linker from device/emulator.
COMMAND: adb_cmd pull /system/lib/libc.so obj/local/armeabi-v7a/libc.so
744 KB/s (297608 bytes in 0.390s)
Pulled libc.so from device/emulator.
Setup JDB connection
COMMAND: adb_cmd forward tcp:65534 jdwp:2787
java.io.IOException: handshake failed - connection prematurally closed
at com.sun.tools.jdi.SocketTransportService.handshake(SocketTransportService.java:136)
at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:232)
at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:90)
at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519)
at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328)
at com.sun.tools.example.debug.tty.Env.init(Env.java:63)
at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1066)
Fatal error:
Unable to attach to target VM.
/cygdrive/e/android-ndk-r9/ndk-gdb: line 742: 4636 Segmentation fault $GDBCLIENT -x
native_path $GDBSETUP
Blockquote
Ok,
From what I understand, its a problem in the new r9 release, specifically in the file named
android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-gdb
This executable gives the segmentation fault.
So it looks that in the distro it has not been generated correctly from the start, from the android devs themselves who uploaded it on the main android site.
I tried and re-downloaded the r9 distribution and re-installed, yet the same thing happens so it was not something accidental eg a bad unzip.
I tried the older r8e same file and it does not give the segmentation fault, it works ok.
So, I did something to get a proof of concept of what I say and took the previous version file (from r8e) and overwrite the new r9 file, then tried again to run the failing ndk-dbg and..
..IT WORKS..
Now I have a new r9 NDK but with one file from the r8e, the old arm-linux-androideabi-gdb.exe and everything works just fine!
So I guess the android devs have to re-do the compilation of the
-> android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-gdb.exe
tool, properly this time.
At least I hope someone will find this useful and avoid the frustration that I had all this time.
Christos
This is the bug that was opened on the Android NDK. A work-around is to use the arm-linux-androideabi-gdb.exe
from Android NDK r8e (as described in Christos' answer), or to download a fixed file from http://code.google.com/p/mingw-and-ndk/downloads/detail?name=arm-linux-androideabi-gdb.exe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With