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調試器
選擇調試進程
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)