IDA+GDB远程调试android平台 - Aarch64- elf64程序

gdb配置

gdb和gdbserver

gdbserver的是在 android-ndk-r10e\prebuilt\android-arm\gdbserver 这个目录下
gdb 是在 android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin 目录下,名称是arm-linux-androideabi-gdb.exe
需要注意的是,ndk r11开始,移除了gdb,旧版本NDK

然后把gdbserver安装到设备的 /system/bin下

adb push gdbserver /system/bin/
adb shell chmod u+x /system/bin/gdbserver

启动程序

adb push hello /data/local/tmp/
adb shell chmod u+x /data/local/tmp/hello
gdbserver  :8123 /data/local/tmp/hello

我这里36即为被调试应用
在这里插入图片描述

设置adb的转发

adb forward tcp:1234 tcp:8123

IDA配置

选择GDB调试器
在这里插入图片描述
选择附加进程,之后自动附加上被GDB启动的调试进程,回车确认对话框即可
选择如下调试进程会提示权限不足,需要重新gdb启动进程
在这里插入图片描述

IDA远程调试 The debugger could not attach to the selected process. irs_recv 等待的操作过时
IDA连接android_server 选中进程点ok之后 连接不上报错
The debugger could not attach to the selected process.
This can perhaps indicate the process was just terminated, or that you dot’t have the necessary privileges.
输出窗口提示 irs_recv 等待的操作过时

原因:
Android5.0之后默认启用了 SELinux/SEAndroid
查看是否开启
getenforce

解决办法:
setenforce 0
或者
echo 0 > /sys/fs/selinux/enforce
在这里插入图片描述
Cannot attach to lwp xxxx1: Operation not permitted (1)

在这里插入图片描述

参考链接
用GDB远程调试android native程序

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章