安装debugserver到iPhone上
2016-08-24 21:17
411 查看
1、不喜欢使用命令行的小伙伴,可以选择 iFunBox 或者其他的 工具查看文件目录。
2、注意:在使用ldid对 debugserver签名的时候,键入命令: ldid -Sentitlement.xml debugserver
命令中 -S 与 entitlement.xml之间没有空格。
文章出处:http://bbs.pediy.com/showthread.php?t=190126
因为Apple已经弃gdb投lldb,所以随着我动态调试的次数越来越频繁,gdb上一个接一个的bug经常会让人很恼火。既然苹果打算建立自己的调试器王国,也投入了钱力精力,那我们干脆也上手lldb玩玩,看看lldb是不是比gdb要更好用(以下操作在iPhone
5,iOS 7.0.4上测试,应该也适用于arm64,如果不行,请参照iphonedevwiki)。
使用的工具
Otool ——查看程序依赖哪些动态库信息,反编代码段……等等等等
Ldid ——签名工具,通过plist文件指定了授予一应用的一组特权
Gdbserver ——调试工具
SSH ——远程控制
Lipo ——合并拆分对支持不同芯片的mach-o
一.定制一个可以调试的debugserver
1.下载编译ldid
git clone git://git.saurik.com/ldid.git
cd ldid
git submodule update --init
./make.sh
完成以上操作会在ldid目录下生产一个mac 可执行程序 ldid。
2.获取debugserver和ARMDisassembler.framework
我这以xcode 5.1.1的版本为例。
找到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/7.1
(11D167)/DeveloperDiskImage.dmg
如果你在Mac那双击它,你会看到如下目录:
红色框圈起来的就是我们需要使用到的部分,此时你一定很高兴的看到了debugserver,但是别高兴的太早了,我们还要对这个debugserver做下处理,使其能正常的调试起来。
将ARMDisassembler.framework 拷贝到手机上/System/Library/PrivateFrameworks目录下。
很多人一定奇怪为啥要这步骤,你们可以自己试试,去掉ARMDisassembler.framework与存在ARMDisassembler.framework,在LLDB调试的过程看ARM反汇编的质量和效果。
我这边使用scp拷贝到设备上去:
# cd /Volumes/DeveloperDiskImage/Library/PrivateFrameworks
# scp -r -p 22 ARMDisassembler.framework root@192.168.20.21:/System/Library/PrivateFrameworks
3.提取对应设备版本的debugserver,并对其签名授予特权
1) 提取对应的debugserver(由于ldid不支持对FAT文件格式的mach-o签名,所以需要提取对应版本)
lipo -thin armv7 /Developer/usr/bin/debugserver
-output ~/debugserver
lipo -thin armv7S /Developer/usr/bin/debugserver
-output ~/debugserver
lipo -thin armv64/Developer/usr/bin/debugserver
-output ~/debugserver
以上根据自己手机支持的armv7、armv7s、arm64提取,我这边以iphone5为例,是armv7,所以我使用
# cd Development/DeveloperDiskImage/usr/bin/
# mv debugserver _debugserver
# lipo -thin armv7 _debugserver -output debugserver
2) 保存以下授予特权内容为entitlement.xml
<!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>get-task-allow</key>
<true/>
<key>task_for_pid-allow</key>
<true/>
<key>run-unsigned-code</key>
<true/>
</dict>
</plist>
3) 使用ldid对debugserver签名授予特权
# ldid -Sentitlement.xml debugserver
将签名授予特权的debugserver拷贝到手机/usr/bin目录下
# scp -p 22 debugserver root@192.168.20.21:/usr/bin/
4) 测试debugserver是否安装成功(如下正常)
# debugserver 192.168.40.45:12345 -a "PPAppInstall"
debugserver-310.2 for armv7.
Attaching to process PPAppInstall...
Listening to port 12345 for a connection from 192.168.40.45...
参考链接: http://www.iphonedevwiki.net/index.php/Debugserver
2、注意:在使用ldid对 debugserver签名的时候,键入命令: ldid -Sentitlement.xml debugserver
命令中 -S 与 entitlement.xml之间没有空格。
文章出处:http://bbs.pediy.com/showthread.php?t=190126
因为Apple已经弃gdb投lldb,所以随着我动态调试的次数越来越频繁,gdb上一个接一个的bug经常会让人很恼火。既然苹果打算建立自己的调试器王国,也投入了钱力精力,那我们干脆也上手lldb玩玩,看看lldb是不是比gdb要更好用(以下操作在iPhone
5,iOS 7.0.4上测试,应该也适用于arm64,如果不行,请参照iphonedevwiki)。
使用的工具
Otool ——查看程序依赖哪些动态库信息,反编代码段……等等等等
Ldid ——签名工具,通过plist文件指定了授予一应用的一组特权
Gdbserver ——调试工具
SSH ——远程控制
Lipo ——合并拆分对支持不同芯片的mach-o
一.定制一个可以调试的debugserver
1.下载编译ldid
git clone git://git.saurik.com/ldid.git
cd ldid
git submodule update --init
./make.sh
完成以上操作会在ldid目录下生产一个mac 可执行程序 ldid。
2.获取debugserver和ARMDisassembler.framework
我这以xcode 5.1.1的版本为例。
找到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/7.1
(11D167)/DeveloperDiskImage.dmg
如果你在Mac那双击它,你会看到如下目录:
红色框圈起来的就是我们需要使用到的部分,此时你一定很高兴的看到了debugserver,但是别高兴的太早了,我们还要对这个debugserver做下处理,使其能正常的调试起来。
将ARMDisassembler.framework 拷贝到手机上/System/Library/PrivateFrameworks目录下。
很多人一定奇怪为啥要这步骤,你们可以自己试试,去掉ARMDisassembler.framework与存在ARMDisassembler.framework,在LLDB调试的过程看ARM反汇编的质量和效果。
我这边使用scp拷贝到设备上去:
# cd /Volumes/DeveloperDiskImage/Library/PrivateFrameworks
# scp -r -p 22 ARMDisassembler.framework root@192.168.20.21:/System/Library/PrivateFrameworks
3.提取对应设备版本的debugserver,并对其签名授予特权
1) 提取对应的debugserver(由于ldid不支持对FAT文件格式的mach-o签名,所以需要提取对应版本)
lipo -thin armv7 /Developer/usr/bin/debugserver
-output ~/debugserver
lipo -thin armv7S /Developer/usr/bin/debugserver
-output ~/debugserver
lipo -thin armv64/Developer/usr/bin/debugserver
-output ~/debugserver
以上根据自己手机支持的armv7、armv7s、arm64提取,我这边以iphone5为例,是armv7,所以我使用
# cd Development/DeveloperDiskImage/usr/bin/
# mv debugserver _debugserver
# lipo -thin armv7 _debugserver -output debugserver
2) 保存以下授予特权内容为entitlement.xml
<!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>get-task-allow</key>
<true/>
<key>task_for_pid-allow</key>
<true/>
<key>run-unsigned-code</key>
<true/>
</dict>
</plist>
3) 使用ldid对debugserver签名授予特权
# ldid -Sentitlement.xml debugserver
将签名授予特权的debugserver拷贝到手机/usr/bin目录下
# scp -p 22 debugserver root@192.168.20.21:/usr/bin/
4) 测试debugserver是否安装成功(如下正常)
# debugserver 192.168.40.45:12345 -a "PPAppInstall"
debugserver-310.2 for armv7.
Attaching to process PPAppInstall...
Listening to port 12345 for a connection from 192.168.40.45...
参考链接: http://www.iphonedevwiki.net/index.php/Debugserver
相关文章推荐
- iphone 在VMWare上安装Mac OS X Server 10.6
- iOS 菜鸟逆向学习 (二)----iOS debugserver + lldb的安装调试
- iphone/itouch上安装offline wikipedia (安装wiki2touch server,并制作数据包)
- iOS debugserver + lldb的安装调试
- Win7 上 iPhone开发环境搭建之一VMware上安装Mac OS X Server 10.6
- 解决Android Studio安装成功后出现Unable to create Debug Bridge,Unable to start adb server问题
- Win7 上 iPhone开发环境搭建之一VMware上安装Mac OS X Server 10.6
- DEBUG:ubuntu 安装openssh-server失败
- SCO OpenServer release 5.0.6安装步骤
- Microsoft SQL Server Desktop Engine安装过程中遇到的问题(2)
- How to debug Web Services or .Net Remoting Components hosted in IIS in Windows 2003 Server
- Windows Server Family 上安装Office 2000
- 解决redhat advance server 3.0安装via vt6102 rhine-ii型网卡速度慢问题
- J2EE 1.4 application Server for Linux 安装与配置
- sql-server数据库安装问题
- Microsoft SQL Server Desktop Engine安装过程中遇到的问题(1)
- Microsoft SQL Server Desktop Engine安装过程中遇到的问题(2)
- 《Exchange 2000 Server规划安装》
- 使用 Microsoft SQL Server 2000 各种版本或组件而必须安装的操作系统
- 在Windows 2000 Server上安装配置MySQL +Tomcat