gdb+gdbserver调试
1,拷贝gdbserver到目标机
# NDK目录下
adb push ./prebuilt/android-arm64/gdbserver/gdbserver /sdcard/Download/
# or
adb push ./prebuilt/android-arm/gdbserver/gdbserver /sdcard/Download/
2,登录目标机并获取权限
adb shell
su
mount -o rw,remount /system
3,拷贝gdbserver到目标机的系统目录并给予执行权限
# 目标机中执行
cp /sdcard/Download/gdbserver /system/bin/gdbserver
chmod 777 /system/bin/gdbserver
4,attach需要调试的进程
# 目标机中执行
gdbserver :8888 --attach you_app_pid
5,gdb链接gdbserver,开始调试
# NDK目录下执行
adb forward tcp:8888 tcp:8888
./prebuilt/linux-x86_64/bin/gdb
set solib-search-path /you_lib_path
target remote :8888