如何在Nexus 5X上启动本机调试会话?
我尝试过运行' ndk-gdb'它无法启动调试会话。本机代码是使用NDK_GDB = 1构建的,部署的应用程序是可调试的。
尝试在Nexus 5X上启动gdb会话时,这是ndk-gdb的输出:
$ 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
但是,在使用Android 5.0的HTC One M8上启动时,对ndk-gdb
的同一调用也能正常工作。
当HTC One M8插入PC时,以下是同一应用程序的ndk-gdb输出:
$ 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.
这是Android 6.0问题还是仅仅是64位设备问题(调试也无法在Samsung Galaxy S6上运行,但我相信这是由于run-as
无法正常工作)。
有没有人设法在Nexus 5X上调试NDK?