LLDB调试第三方app

先要用xcode新创建一个项目连接手机调试它,这样手机上就会有debugserver程序,如图所示。
LLDB调试第三方app
会在/Developer/usr/bin下如图所示。
LLDB调试第三方app
因为他目前不能调试其它app,因为没有task_for_pid权限。先把它拷贝到电脑上。
创建一个pist文件。如图所示。
LLDB调试第三方app
entitlements.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/ PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.springboard.debugapplications</key> <true/>
    <key>run-unsigned-code</key>
    <true/>
    <key>get-task-allow</key>
    <true/>
    <key>task_for_pid-allow</key>
    <true/>
</dict>
</plist>

重新签名它。
codesign -s - --entitlements entitlements.plist -f debugserver
LLDB调试第三方app
上传到手机 /usr/bin下。选择一个进程调试它如图所示。
LLDB调试第三方app
LLDB调试第三方app
mac上转发端口
iproxy 1234 1234
最后连接。输入lldb进入ldb,输入process connect connect://localhost:1234
同时查看查看模块和加载基地址。
LLDB调试第三方app

猜你喜欢

转载自blog.51cto.com/haidragon/2396785