version 1:android-ndk-r10e-linux-x86_64/android-ndk-r10e/prebuilt/android-arm64/gdbserver (arm64) version 2:android-ndk-r10e-linux-x86_64/android-ndk-r10e/prebuilt/android-arm/gdbserver (armv7)
version 1提取链接:https://pan.baidu.com/s/1dK7aLdASn7mQtTPJh1Oohw 提取码:8888
1.1 首先在本地部署adb(NDK,已经完成编译,可以直接运行)
sun@sun:~/softinstall/android-ndk-r10e-linux-x86_64/android-ndk-r10e/prebuilt/android-arm64$ cd ../../
sun@sun:~/softinstall/android-ndk-r10e-linux-x86_64/android-ndk-r10e$ cd toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/
sun@sun:~/softinstall/android-ndk-r10e-linux-x86_64/android-ndk-r10e/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin$ ./aarch64-linux-android-gdb
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-linux-gnu --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".
(gdb) target remote 192.168.103.246:1111
192.168.103.246:1111: Connection timed out.
(gdb)
(gdb) exit
Undefined command: "exit". Try "help".
(gdb) quit
sun@sun:~/softinstall/android-ndk-r10e-linux-x86_64/android-ndk-r10e/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin$ adb devices
List of devices attached
192.168.103.246:5555 device
1.2 其次在远端部署 gdbserver
~/softinstall/android-ndk-r10e-linux-x86_64/android-ndk-r10e/prebuilt/android-arm64$ adb connect 192.168.103.246
connected to 192.168.103.246:5555
sun@sun:~/softinstall/android-ndk-r10e-linux-x86_64/android-ndk-r10e/prebuilt/android-arm64$ adb push gdbserver /sdcard/
/sdcard/gdbserver/: 1 file pushed. 0 files skipped. 0.8 MB/s (759464 bytes in 0.899s)
sun@sun:~/softinstall/android-ndk-r10e-linux-x86_64/android-ndk-r10e/prebuilt/android-arm64$ adb shell
tb8788p1_64_bsp_wxp:/ $ su
tb8788p1_64_bsp_wxp:/
tb8788p1_64_bsp_wxp:/data
==============================================================================================================================================================================
2 系统依赖配置
2.1 拉去远程设备端数据到本地,在本地对应的文件夹下执行如下命令
adb pull /system/lib64 ./system_lib/
adb pull /vendor/lib64 ./vendor_lib/
adb pull /system/framework/oat ./frame_lib/oat/
adb pull /system/framework/arm64 ./frame_lib/arm64/
2.2 监听target remote
./gdbserver :1111 --attach 4080
注:1111 为监听的端口号,PID 为进程号
gdb aarch64-linux-android-gdb 用于调试Android aarch64平台代码,位于android-ndk-r10e-linux-x86_64/android-ndk-r10e/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin目录下
arm-linux-androideabi-gdb 用于调试Android armv7平台代码,位于android-ndk-r10e-linux-x86_64/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin目录下
target remote 192.168.105.76:1111
192.168.105.76为Android机器的ip
1111 Android机器gdbserver监听的端口号
2.3监听set solib-search-path
~/bctc300_mtk8788_symbol/:~/bctc300_mtk8788_symbol/system_lib/:~/bctc300_mtk8788_symbol/vendor_lib/:~/bctc300_mtk8788_symbol/frame_lib/arm64/:~/bctc300_mtk8788_symbol/vendor_lib/egl/:~/bctc300_mtk8788_symbol/vendor_lib/hw/:~/bctc300_mtk8788_symbol/frame_lib/oat/arm64/:~/bctc300_mtk8788_symbol/so/
==============================================================================================================================================================================
3 adb常用命令
首先连接设备
adb
adb connect ip
进入远程设备端
adb shell
获取远程设备端su权限
adb root
查看远程端设备
adb devices
挂载远程端
adb remount
推送数到远程端
adb push
连接上设别后直接使用该命令传输文件即可(包括远程连接)
sun@sun:~/workspace/androd$ adb push ./bin/aurora300_runner /data/debug/aurora300_test
[100%] /data/debug/aurora300_test/aurora300_runner
sun@sun:~/workspace/androd$ adb push ./bin/ /data/debug/aurora300_test
/data/debug/aurora300_test/bin/: 43 files pushed. 0 files skipped. 1.0 MB/s (112192766 bytes in 111.913s)
==============================================================================================================================================================================
|