debugserver + lldb代替gdb进行动态调试

一、定制lldb(将下述所需的文件全部放于同一个文件夹下【假设为abc】,便于操作)
    1.
下载一个能用的ldid(http://joedj.net/ldid)   做后面的签名之用
    2. 获取原生
debugserver(建议直接从手机目录中拷贝出来,/Developer/usr/bin/debugserver,当此手机在Xcode中标记为开发设备后便会出来这些目录
    3.瘦身debugserver
     
命令行cd到abc文件下
      输入
lipo -thin armv7s /abc/fat/debugserver(原路径) -output /abc/thin/debugserver(重新生成的新路径)
           以上根据自己手机支持的armv7、armv7s、arm64提取,我这边以iphone5为例,是armv7
    4.签名瘦身之后的debugserver
     
将下面的内容另存为一个名为ent.xml的文件
      


        com.apple.springboard.debugapplications
       
        get-task-allow
       
        task_for_pid-allow
       
        run-unsigned-code
       


       命令行中输入:abc$ ldid -Sent.xml thin/debugserver
     5.
将定制好的debugserver拷贝回iOS,放在/usr/bin/debugserver下,然后在iOS的命令行运行:chmod +x /usr/bin/debugserver
     6.假如是IOS7下还要另外再加签名:
       
http://www.iphonedevwiki.net/index.php/Debugging_on_iOS_7
       
http://www.iphonedevwiki.net/index.php/Debugserver (里面的2、3点)
               http://lldb.llvm.org/lldb-gdb.html


参考:http://bbs.iosre.com/forum.php?mod=viewthread&tid=52&extra=page=1&filter=typeid&typeid=11&typeid=11
      http://www.kanxue.com/bbs/showthread.php?t=190126
  


原文地址:https://www.cnblogs.com/cnsec/p/11515781.html