本帖最后由 蜗牛杰 于 2023-10-28 10:52 编辑
ida调试安卓so ####环境及工具 * IDA_Pro_7.7 * window10 * 真机Pexel XL(root) * 系统andrioid9 * Andrioid Device Monitor(非必须) ####准备工作 1、ida安装目录下的dbgsrv/android_server64 
执行命令将调试服务放入安卓机器 打开cmd到当前目录 `1、adb push andrioid_server64 /data/local/tmp/as ` 将服务push入安卓机器中并且改名为as `2、adb shell` 进入安卓命令行 `3、su` 切换root权限 `4、cd /data/local/tmp` 进入目录 `5、chmod 777 andrioid_server64` 修改andrioid_server64权限 `6、./andrioid_server64 -p12345` 启动服务 -p为启动端口参数可以不加 不加默认就是23946端口 
`7、adb forward tcp:12345 tcp:12345` 打开新的cmd 转发端口 
2、启动ida及其他设置 
我这里是64位的所以启动ida64.exe 
打开需要调试的so 
点exports找到需要调试的代码 
我这里是demo所以就在导出函数里面 
双击进入汇编 
tab进入伪C代码 
f2打上需要调试的代码debugger 
真机调试模式选择这个 
简单调试点击这个就好了 不要点击倒数第二个在库加载/写在时挂起(`当时就是看了其他教程点击了这个 结果发现这个是库加载的时候就会挂起在断点上 导致迟迟debugger不到自己设置的点上--小白踩坑`) 
主机localhost/127.0.0.1都可以 端口就是刚刚转发出去的端口这里是12345 3、apk为设置为debugger模式 
`adb shell am start -n "com.example.myapplication/com.example.myapplication.MainActivity" -D` 这里 ""里面的是apk的入口 

附加到进程 
选择要调试的进程 这里可以用ctrl+f搜索 
加载完对应东西后会在这里断住 
打开Andrioid Device Monitor 我这里安卓了andrioid SDK 所以 对应的tools/lib下有对应的monitor 这里有一个坑 就是 这个monitor 只有安装了JDK1.8才可以打开 其他版本会报错 `jdb -connect com.sun.jdi.SocketAttach:port=8700,hostname=localhost` 执行命令 
等待初始化就可以了 

这样就可以了 已经进入打的断点里面了 #####这里最需要注意的就是 
选项 新手应该是暂时不需要的 这里是库加载的时候就会挂起/卸载断点 新手第一次调试不用勾选这个 

注:若转载请注明大神论坛来源(本贴地址)与作者信息。
|