How can I start native debugging session on Nexus 5X?
I tried running 'ndk-gdb' and it cannot start the debugging session. The native code is build with NDK_GDB=1 and deployed app is debuggable.
Here is the output of ndk-gdb when attempting to start gdb session on Nexus 5X:
$ ndk-gdb --package=com.microblink.test --verbose
Android NDK installation path: /Users/dodo/android-sdks/android-ndk
Using default adb command: /Users/dodo/android-sdks/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.32
Revision 09a0d98bebce-android
Using ADB flags:
Using JDB command: /usr/bin/jdb
Using auto-detected project path: .
Using package name: com.microblink.test
ABIs targetted by application: arm64-v8a armeabi armeabi-v7a armeabi-v7a mips mips64 x86 x86_64
Device API Level: 23
Device CPU ABIs: arm64-v8a armeabi-v7a armeabi
Compatible device ABI: arm64-v8a
Using gdb setup init: ./libs/arm64-v8a/gdb.setup
Using toolchain prefix: /Users/dodo/android-sdks/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-
Using app out directory: ./obj/local/arm64-v8a
Found debuggable flag: false
Found gdb.setup under libs/arm64-v8a, assuming app was built with NDK_DEBUG=1
Found data directory: '/data/data/com.microblink.test'
4813 KB/s (759464 bytes in 0.154s)
Push gdbserver in device
Found device gdbserver: /data/local/tmp/gdbserver
Found running PID: 16285
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/com.microblink.test/debug-socket
## COMMAND: adb_cmd pull /system/bin/app_process64 ./obj/local/arm64-v8a/app_process
1623 KB/s (22456 bytes in 0.013s)
Pulled app_process64 from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker64 ./obj/local/arm64-v8a/linker64
4637 KB/s (273320 bytes in 0.057s)
Pulled linker64 from device/emulator.
## COMMAND: adb_cmd pull /system/lib64/libc.so ./obj/local/arm64-v8a/libc.so
4046 KB/s (1032392 bytes in 0.249s)
Pulled /system/lib64/libc.so from device/emulator.
GNU gdb (GDB) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=aarch64-elf-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: /Users/dodo/Work/Microblink/android-core/core/CoreUtils/tinyxml2: No such file or directory.
./obj/local/arm64-v8a/gdb.setup:5: Error in sourced command file:
Remote connection closed
(gdb) c
The program is not being run.
(gdb) q
However, the very same call to ndk-gdb works correctly when started on HTC One M8 with Android 5.0.
Here is the output of ndk-gdb for same app when HTC One M8 was plugged into PC:
$ ndk-gdb --package=com.microblink.test --verbose
Android NDK installation path: /Users/dodo/android-sdks/android-ndk
Using default adb command: /Users/dodo/android-sdks/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.32
Revision 09a0d98bebce-android
Using ADB flags:
Using JDB command: /usr/bin/jdb
Using auto-detected project path: .
Using package name: com.microblink.test
ABIs targetted by application: arm64-v8a armeabi armeabi-v7a armeabi-v7a mips mips64 x86 x86_64
Device API Level: 21
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi-v7a
Using gdb setup init: ./libs/armeabi-v7a/gdb.setup
Using toolchain prefix: /Users/dodo/android-sdks/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi-v7a
Found debuggable flag: false
Found gdb.setup under libs/armeabi-v7a, assuming app was built with NDK_DEBUG=1
Found data directory: '/data/data/com.microblink.test'
Found device gdbserver: /data/data/com.microblink.test/lib/gdbserver
Found running PID: 2608
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/com.microblink.test/debug-socket
## COMMAND: adb_cmd pull /system/bin/app_process32 ./obj/local/armeabi-v7a/app_process
2175 KB/s (13636 bytes in 0.006s)
Pulled app_process32 from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker ./obj/local/armeabi-v7a/linker
3395 KB/s (133823 bytes in 0.038s)
Pulled linker from device/emulator.
## COMMAND: adb_cmd pull /system/lib/libc.so ./obj/local/armeabi-v7a/libc.so
3133 KB/s (490423 bytes in 0.152s)
Pulled /system/lib/libc.so from device/emulator.
Pulled *.bc:.so from device/emulator.
remote object '/data/data/com.microblink.test/lib/*.bc:.so' does not exist
Pulled No.so from device/emulator.
remote object '/data/data/com.microblink.test/lib/No.so' does not exist
Pulled such.so from device/emulator.
remote object '/data/data/com.microblink.test/lib/such.so' does not exist
Pulled file.so from device/emulator.
remote object '/data/data/com.microblink.test/lib/file.so' does not exist
Pulled or.so from device/emulator.
remote object '/data/data/com.microblink.test/lib/or.so' does not exist
Pulled directory.so from device/emulator.
remote object '/data/data/com.microblink.test/lib/directory.so' does not exist
GNU gdb (GDB) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=arm-linux-android".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: /Users/dodo/Work/Microblink/android-core/core/CoreUtils/tinyxml2: No such file or directory.
warning: Could not load shared library symbols for 113 libraries, e.g. libm.so.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
0xb6ecca6c in __epoll_pwait ()
from /Users/dodo/Work/Microblink/android-core/android-studio/LibRecognizer/build/intermediates/ndk/everything/release/obj/local/armeabi-v7a/libc.so
(gdb) c
Continuing.
Is this an Android 6.0 issue or simply a 64-bit device issue (debugging also does not work on Samsung Galaxy S6, but I beleive this is due to a run-as not working).
Has anyone managed to debug NDK on Nexus 5X?
Related
I have a small application that uses a native ARM shared library (.so). When using Genymotion, I can successfuly install the ARM translation package (just by dropping the ZIP file) and the app runs fine on a x86-based emulator.
Now I have the need to run the same app in a headless linux server, which is not supported by Genymotion. I downloaded the official google emulator and corresponding system image. After extracting the files from zip archive and uploading to /system partition, I can run houdini --version, however the application won't install (INSTALL_FAILED_NO_MATCHING_ABIS).
Can you please guide me how to run the app which contains ARM library on the official google x86 emulator?
What is the output of houdini --version ?
When you install applications PackageManager checks ABI of the app(which libraries are contained in the apk .so files) and the ABI of the system (which type of libraries system supports)
if you run getprop | grep -i abi
getprop | grep -i abi
[ro.product.cpu.abi]: [x86]
[ro.product.cpu.abilist]: [x86,armeabi-v7a,armeabi]
[ro.product.cpu.abilist32]: [x86,armeabi-v7a,armeabi]
[ro.product.cpu.abilist64]: []
In this output, the system supports 32 bit .so files of x86, armeabi-v7a and armeabi type.
Please check this output on your device. Most probably there will be no mention of armeabi in this output.
So when PackageManager tries to install ARM app and checks that this ABI is not supported, it throws INSTALL_FAILED_NO_MATCHING_ABIS error.
So you will have to fix the system ABIs.
Edit the file /system/build.prop to add ARM support, in ro.product.cpu.abilist and ro.product.cpu.abilist32.
If you are running 64 bit Android, you will have to change these lines.
ro.product.cpu.abilist=x86_64,x86,arm64-v8a,armeabi-v7a,armeabi
ro.product.cpu.abilist32=x86,armeabi-v7a,armeabi
ro.product.cpu.abilist64=x86_64,arm64-v8a
I want to use ndk-gdb to debug my native code on Android application.
My ndk version is r9d, and my OS is Ubuntu 12.04 64-bit.
I use HelloJni to my test project. After compiling (ndk-build NDK_DEBUG=1), I try to use ndk-gdb to debug this project. But there are errors.
> ndk-gdb --verbose --force --start
WARNING: The shell running this script isn't bash. Although we try to avoid bashism in scripts, things can happen.
/home/jargo/ndk/android-ndk-r9d/ndk-gdb: 143: /home/jargo/ndk/android-ndk-r9d/ndk-gdb: Bad substitution
Android NDK installation path: /home/jargo/ndk/android-ndk-r9d
Using default adb command: /home/jargo/sdk/android-sdk-linux/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using JDB command: /usr/bin/jdb
Using auto-detected project path: .
Found package name: com.example.hellojni
ABIs targetted by application: armeabi
Device API Level: 17
Device CPU ABIs: armeabi-v7a armeabi
/home/jargo/ndk/android-ndk-r9d/ndk-gdb: 555: [: 1: unexpected operator
Compatible device ABI: armeabi
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /home/jargo/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: false
Found gdb.setup under libs/armeabi, assuming app was built with NDK_DEBUG=1
Found data directory: '/data/data/com.example.hellojni'
Found device gdbserver: /data/data/com.example.hellojni/lib/gdbserver
Found first launchable activity: .HelloJni
Launching activity: com.example.hellojni/.HelloJni
## COMMAND: adb_cmd shell am start -D -n com.example.hellojni/.HelloJni
Starting: Intent { cmp=com.example.hellojni/.HelloJni }
## COMMAND: adb_cmd shell sleep 2
Found running PID: 9802
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/com.example.hellojni/debug-socket
## COMMAND: adb_cmd shell run-as com.example.hellojni /data/data/com.example.hellojni/lib/gdbserver +debug-socket --attach 9802
## COMMAND: adb_cmd pull /system/bin/app_process ./obj/local/armeabi/app_process
Cannot attach to lwp 9802: Operation not permitted (1)
Exiting
107 KB/s (9564 bytes in 0.086s)
Pulled app_process from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker ./obj/local/armeabi/linker
376 KB/s (63176 bytes in 0.163s)
Pulled linker from device/emulator.
## COMMAND: adb_cmd pull /system/lib/libc.so ./obj/local/armeabi/libc.so
560 KB/s (301636 bytes in 0.525s)
Pulled libc.so from device/emulator.
Setup JDB connection
## COMMAND: adb_cmd forward tcp:65534 jdwp:9802
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.
/home/jargo/ndk/android-ndk-r9d/ndk-gdb: 771: [: armeabi: unexpected operator
GNU gdb (GDB) 7.3.1-gg2
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android".
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
./obj/local/armeabi/gdb.setup:4: Error in sourced command file:
Remote communication error. Target disconnected.: Connection reset by peer.
It seems the error is in its script, and can't load symbol table. I found this link, it says use ndk-gdb.py - the python version of ndk-gdb. The errors show following, seems the connection failed.
> ndk-gdb.py --verbose --force --start
Android NDK installation path: /home/jargo/ndk/android-ndk-r9d
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using auto-detected project path: .
Found package name: com.example.hellojni
ABIs targetted by application: armeabi
Device API Level: 17
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /home/jargo/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: false
Found gdbserver under libs/armeabi, assuming app was built with NDK_DEBUG=1
Found device gdbserver: /data/data/com.example.hellojni/lib/gdbserver
Found data directory: '/data/data/com.example.hellojni'
Found first launchable activity: .HelloJni
Launching activity: com.example.hellojni/.HelloJni
## COMMAND: adb_cmd shell am start -D -n com.example.hellojni/.HelloJni
## COMMAND: adb_cmd shell sleep 2.000000
Found running PID: 9585
## COMMAND: adb_cmd shell run-as com.example.hellojni lib/gdbserver +debug-socket --attach 9585 [BACKGROUND]
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/com.example.hellojni/debug-socket
## COMMAND: adb_cmd pull /system/bin/app_process ./obj/local/armeabi/app_process
Cannot attach to lwp 9585: Operation not permitted (1)
Exiting
106 KB/s (9564 bytes in 0.087s)
Pulled app_process from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker ./obj/local/armeabi/linker
301 KB/s (63176 bytes in 0.204s)
Pulled linker from device/emulator.
## COMMAND: adb_cmd pull /system/lib/libc.so ./obj/local/armeabi/libc.so
752 KB/s (301636 bytes in 0.391s)
Pulled libc.so from device/emulator.
Set up JDB connection, using jdb command: /usr/bin/jdb
## COMMAND: adb_cmd forward tcp:65534 jdwp:9585
JDB :: java.io.IOException: handshake failed - connection prematurally closed
JDB :: at com.sun.tools.jdi.SocketTransportService.handshake(SocketTransportService.java:136)
JDB :: at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:232)
JDB :: at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
JDB :: at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:90)
JDB :: at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519)
JDB :: at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328)
JDB :: at com.sun.tools.example.debug.tty.Env.init(Env.java:63)
JDB :: at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1066)
JDB ::
JDB :: Fatal error:
JDB :: Unable to attach to target VM.
GNU gdb (GDB) 7.3.1-gg2
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android".
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
./obj/local/armeabi/gdb.setup:4: Error in sourced command file:
Remote communication error. Target disconnected.: Connection reset by peer.
Have any one know what's the problem?
I have two processes in the Android application- main application process and a remote service process.
The native libraries are loaded from the remote service process.
I want to debug the native library code.
The application is debuggable. The native library was built from Windows command-line using ndk-build. In Android.mk, -g -ggdb flag was used for this library.
I am running ndk-gdb from cygwin.
Test device: Galaxy Nexus running Android 4.2.2
Error line: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
In the verbose information, I see that gdbserver is trying to attach to process id of the main application process. Should it matter that the library is loaded from a remote process within this application.
Detailed ndk-gdb run information-
$ ndk-gdb --verbose --force
Android NDK installation path: /cygdrive/c/work/android/ndk/android-ndk-r9-windows-x86/android-ndk-r9
Using default adb command: /cygdrive/c/work/android/sdk/android-sdk_r10-windows/android-sdk-windows/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using JDB command: /cygdrive/c/program files (x86)/java/jdk1.6.0_25/bin/jdb
Using auto-detected project path: .
Found package name: [application-pkg-name]
ABIs targetted by application: armeabi
Device API Level: 17
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /cygdrive/c/work/android/ndk/android-ndk-r9-windows-x86/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/[applcation-pkg-name]/lib/gdbserver
Found data directory: '/data/data/[applcation-pkg-name]'
Found running PID: 17890
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd shell run-as [applcation-pkg-name] lib/gdbserver +debug-socket --attach 17890
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/[applcation-pkg-name]/debug-socket
Attached; pid = 17890 [Comment: This pid is for the main application process]
Listening on Unix socket debug-socket
## COMMAND: adb_cmd pull /system/bin/app_process obj/local/armeabi/app_process
493 KB/s (9592 bytes in 0.019s)
Pulled app_process from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker obj/local/armeabi/linker
1165 KB/s (63244 bytes in 0.053s)
Pulled linker from device/emulator.
## COMMAND: adb_cmd pull /system/lib/libc.so obj/local/armeabi/libc.so
2442 KB/s (297608 bytes in 0.119s)
Pulled libc.so from device/emulator.
/cygdrive/c/work/android/ndk/android-ndk-r9-windows-x86/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-gdb.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
Couple of side notes that could be helpful-
1) If I run the ndk-gdb command without --force, it gives me error that Another debug session is running. Although the gdb prompt came out during the last run.
2) On Android 4.3, with the same application and setup, I get error that "Could not extract package's data directory"
I am trying to debug a C++ native code on Android device using NDK.
The Android.mk already has the debug flags:
APP_OPTIM:= debug
LOCAL_CFLAGS := -DRAPIDXML_NO_EXCEPTIONS
LOCAL_CFLAGS += -g
LOCAL_CFLAGS += -ggdb
LOCAL_CFLAGS += -O1
I also tried with the flag -O0 instead of -O1.
And the AndroidManifest.xml has also the debug mode:
android:debuggable="true"
So, here we go... I put some breakpoints in the code to watch it step by step. Went to the terminal and typed:
$ adb shell ps |grep packtpub
app_57 24084 117 467368 49136 ffffffff 00000000 S com.packtpub.app3D
Then run the debug:
$ ndk-gdb --verbose --force
...
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: /home/android-sdks/platform-tools/adb forward tcp:5039 localfilesystem:/data/data/com.packtpub.app3D/debug-socket
## COMMAND: /home/android-sdks/platform-tools/adb shell run-as com.packtpub.app3D lib/gdbserver +debug-socket --attach 1822
## COMMAND: /home/android-sdks/platform-tools/adb pull /system/bin/app_process ./obj/local/armeabi/app_process
Attached; pid = 1822
Listening on sockaddr socket debug-socket
Pulled app_process from device/emulator.
## COMMAND: /home/android-sdks/platform-tools/adb pull /system/lib/libc.so ./obj/local/armeabi/libc.so
Pulled libc.so from device/emulator.
The application starts and run. But no break points show up. Neither the (gdb) prompt appears to allow me to set commands.
I tried both ways: from Eclipse IDE, and from console using the command line. And the same happens.
Any suggestion how to spot what is missing to put the debug on and have the breakpoints working?
All comments and suggestions are highly appreciated.
So... I keep fighting to solve why the ndk-debug is not running. Maybe I came across something that can shed a little light on it:
I have also added to Android.mk:
APP_MODULES := callbacks
APP_PLATFORM := android-14
On command line in the terminal:
$ android update project -p . --target android-14
It gives the message:
Error: Target id 'android-14' is not valid. Use 'android list targets' to get the target ids.
Then we obtain the output when running the list targets:
$ android list targets
id: 1 or "android-15"
Name: Android 4.0.3
Type: Platform
API level: 15
...
id: 2 or "Google Inc.:Google APIs:15"
On the other hand it compiles and builds on command line only if I put 'android-15', but it will not run in the device (a Samsung Nexus), which has the 'android-14'. In the AndroidManifest.xml it was setup as 14, to allow the App to compile, load and run in the device from the Eclipse IDE:
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="14">
In Eclipse IDE it compiles and runs with no complaints as Android-14. When asked to run ndk-debug on Eclipse IDE, it also doesn't complaint as shown mentioned in my previous post, but neither the (gdb) appears.
However, when I try to run the ndk-debug on command line it complains and shows that it is not attaching the debugger:
$ ndk-gdb --verbose --force
...
Launched gdbserver successfully.
## COMMAND: /home/android-sdks/platform-tools/adb shell run-as com.packtpub.app3D lib/gdbserver +debug-socket --attach 7722
## COMMAND: /home/android-sdks/platform-tools/adb pull /system/bin/app_process ./obj/local/armeabi/app_process
Cannot attach to process 7722: Operation not permitted (1)
Pulled app_process from device/emulator.
The ndk-gdb not working has something to do with the target version?
Any suggestions or workaround that might fix it and make possible to have active breakpoint to debug NDK?
Thanks in advance.
Solved the problem installing the API 14 in the debugging environment,and creating a new project entirely as API 14. Now it works.
I'm about to port a existing game that allready uses the SDL libary to android with the NDK, but the application crashs when calling this(SDL_Init runs fine, SetVideoMode crashes):
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER) < 0) {
screen = SDL_SetVideoMode(0, 0, 16, SDL_FULLSCREEN);
}
Any ideas?
ndk-gdb:
Android NDK installation path: /cygdrive/c/android-sdk-windows/android-ndk-r7/.
Using default adb command: /cygdrive/c/android-sdk-windows/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.29
Using final ADB command: '/cygdrive/c/android-sdk-windows/platform-tools/adb'
Using specified project path: C:/Users/Revan/workspace/JazzDroid
Found package name: com.dscorp.jazzdroid
ABIs targetted by application: armeabi
Device API Level: 10
Device CPU ABI: armeabi
Compatible device ABI: armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.dscorp.jazzdroid/lib/gdbserver
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /cygdrive/c/android-sdk-windows/android-ndk-r7/./toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found data directory: '/data/data/com.dscorp.jazzdroid'
Found first launchable activity: .SDLActivity
Launching activity: com.dscorp.jazzdroid/.SDLActivity
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb shell am start -n com.dscorp.jazzdroid/.SDLActivity
Starting: Intent { cmp=com.dscorp.jazzdroid/.SDLActivity }
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb shell sleep 2
Found running PID: 476
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb forward tcp:5039 localfilesystem:/data/data/com.dscorp.jazzdroid/debug-socket
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb shell run-as com.dscorp.jazzdroid lib/gdbserver +debug-socket --attach 476
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb pull /system/bin/app_process obj/local/armeabi/app_process
Cannot attach to process 476: No such process (3)
345 KB/s (5660 bytes in 0.016s)
Pulled app_process from device/emulator.
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb pull /system/lib/libc.so obj/local/armeabi/libc.so
58 KB/s (273868 bytes in 4.574s)
Pulled libc.so from device/emulator.
cp: cannot stat `./libs/armeabi/gdb.setup': No such file or directory
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=i586-mingw32msvc --target=arm-elf-linux".
(no debugging symbols found)
(gdb) C:\android-sdk-windows\android-ndk-r7/obj/local/armeabi/gdb.setup:2: Error in sourced command file:
Remote communication error: Bad file descriptor.