IPhone一起玩越狱 -(十八)- 探究Xcode怎么使用ll

2018-07-02  本文已影响15人  struggle3g

引言

在Mac终端上面

 xxx $ lldb
(lldb)

那么Xcode是怎么开启lldb调试的呐?

Xcode的lldb调试IPhone

未越狱lldb的调试的原理

lldb每一条指令都会传给debugserverdebugserver在去选择性的调试某一个App
debugserver的安装过程

以上是IPhone中debugserver的由来

越狱Iphone的lldb调试原理

  1. debugserver连接App
    例如:
    iPhone:/Developer/usr/bin root# ./debugserver *:3457 -A antitweak
    debugserver-@(#)PROGRAM:debugserver      PROJECT:debugserver-360.0.26.3
    for arm64.
    Attaching to process antitweak...
    Listening to port 3457 for a connection from *...
    
  2. lldb连接手机的debugserver
xxx $ lldb
(lldb) process connect connect://172.16.107.4:3457
Process 15256 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x000000018fd9f224 libsystem_kernel.dylib`mach_msg_trap + 8
libsystem_kernel.dylib`mach_msg_trap:
->  0x18fd9f224 <+8>: ret

libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x18fd9f228 <+0>: mov    x16, #-0x20
    0x18fd9f22c <+4>: svc    #0x80
    0x18fd9f230 <+8>: ret
Target 0: (antitweak) stopped.
(lldb)

lldb调试成功!
注意
连接成功,程序是被断住的,需要输入c才能正常运行

使用usb连接lldb

iPhone:/Developer/usr/bin root# ./debugserver *:3457 -A antitweak
debugserver-@(#)PROGRAM:debugserver      PROJECT:debugserver-360.0.26.3
for arm64.
Attaching to process antitweak...
Listening to port 3457 for a connection from *...

需要在Mac电脑中添加

python /opt/cycript_0.9.594/ConnectionShell/python-client/tcprelay.py -t 22:3456 3457:3457

上述代码不懂请查看IPhone一起玩越狱 -(六)- USB登录Iphone用户
将本地的端口映射到手机的端口3457:3457
IPhone

iPhone:/Developer/usr/bin root# ./debugserver *:3457 -A antitweak
debugserver-@(#)PROGRAM:debugserver      PROJECT:debugserver-360.0.26.3
for arm64.
Attaching to process antitweak...
Listening to port 3457 for a connection from *...

item

xxx $ lldb
(lldb) process connect connect://localhost:3458
Process 573 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x000000019187b224 libsystem_kernel.dylib`mach_msg_trap + 8
libsystem_kernel.dylib`mach_msg_trap:
->  0x19187b224 <+8>: ret

libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x19187b228 <+0>: mov    x16, #-0x20
    0x19187b22c <+4>: svc    #0x80
    0x19187b230 <+8>: ret
Target 0: (eSmartWallet) stopped.
(lldb)
上一篇 下一篇

猜你喜欢

热点阅读