Lldb 远程调试 ios的问题

遇到个问题。请教一下大家。。谢谢。
我的是 iphone5s , 已经越狱。。 想lldb远程调试app。 例如。

1 ssh 远程

helloworld:/usr/bin root# /usr/bin/dbgserver *:1234 -a “YoukuiPhone”
debugserver-310.2 for arm64.
Attaching to process YoukuiPhone…
Listening to port 1234 for a connection from *…
Waiting for debugger instructions for process 0.

2 mac本地
(lldb) platform select remote-ios
Platform: remote-ios
Connected: no
SDK Path: “/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/8.1 (12B411)”
SDK Roots: 0] "/Applica

。。。。。。。。。

(lldb) process connect connect://192.168.1.100:1234
warning: unable to find and load segment named ‘__LINKEDIT’ at 0x11ac000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__TEXT’ at 0x4000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__DATA’ at 0xb78000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__LINKEDIT’ at 0x11ac000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__TEXT’ at 0x133a000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__DATA’ at 0x133b000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__LINKEDIT’ at 0x133c000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__TEXT’ at 0x31212000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__DATA’ at 0x3a1a6000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__LINKEDIT’ at 0x3b9e0000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__TEXT’ at 0x17e1000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__TEXT’ at 0x390d6000 in ‘’ in macosx dynamic loader plug-in.
warning: unable to find and load segment named ‘__DATA’ at 0x43e7e000 in ‘’ in macosx dynamic loader plug-in.
Process 638 stopped

  • thread #1: tid = 0x82f5, 0x39c9aa50, stop reason = signal SIGSTOP
    frame #0: 0x39c9aa50
    error: read memory from 0x39c9aa50 failed
    (lldb) c
    Process 638 resuming
    Process 638 exited with status = -1 (0xffffffff) lost connection

然后进程就退出了。试了好几个app。都是一样的情况。 纠结。

(lldb) process connect connect://192.168.1.100:1234
Process 646 stopped

  • thread #1: tid = 0x8a5e, 0x39c9aa50, stop reason = signal SIGSTOP
    frame #0: 0x39c9aa50
    error: GDB server does not support reading memory

???

上面的问题可能是网速的问题。。请教另外的一个问题。在ida里面看是正确的。 例如

__text:000E6054 90 B5 PUSH {R4,R7,LR}
__text:000E6056 40 F6 44 61 MOVW R1, #(:lower16:(selRef_moduleDelegate - 0xE6064))
__text:000E605A 01 AF ADD R7, SP, #4
__text:000E605C C0 F2 BA 01 MOVT.W R1, #(:upper16:(selRef_moduleDelegate - 0xE6064))
__text:000E6060 79 44 ADD R1, PC ; selRef_moduleDelegate
__text:000E6062 09 68 LDR R1, [R1] ; “moduleDelegate”
__text:000E6064 37 F0 D2 C9 BLX.W _objc_msgSend

但是lldb的dis命令。 就不正确了。

0xe6054: .long 0xf640b590 ; unknown opcode
0xe6058: svcge #0x16144
0xe605c: .long 0x01baf2c0 ; unknown opcode
0xe6060: stmdavs r9, {r0, r3, r4, r5, r6, r10, lr}
0xe6064: ldmibgt r2, {r0, r1, r2, r4, r5, r12, sp, lr, pc} ^
0xe6068: vmax.s8 d20, d0, d4
0xe606c: .long 0xf2c05086 ; unknown opcode
0xe6070: ldrbtmi r0, [r8], #-186

即使对dis 加-A的参数,强制指定汇编解析的方式。 也是不能像ida那样正确

0xe6054: push {r4, r7, lr}
0xe6056: .long 0x6144f640 ; unknown opcode
0xe605a: add r7, sp, #0x4
0xe605c: .long 0x01baf2c0 ; unknown opcode
0xe6060: add r1, pc
0xe6062: ldr r1, [r1]
0xe6064: .long 0xc9d2f037 ; unknown opcode
0xe6068: mov r4, r0
0xe606a: .long 0x5086f240 ; unknown opcode
0xe606e: .long 0x00baf2c0 ; unknown opcode

0xe6072: add r0, pc

这个如何解决?

这个应该是lldb的bug,看看跟这个帖子描述的现象是否相同

恩。 arm . thumb 混合一起时候就悲剧了。。 我也去找个旧的lldb。 谢谢楼上

最新版的lldb貌似已经修复了这个bug,你升级到Xcode 6.1就好了

我的就是 xcode 6.1 (6A1052D)
lldb的版本是这个?

localhost:~xxxxx$ lldb -v
lldb-320.4.152

我也是这个版本,貌似没问题啊?再不行的话你换个旧的Xcode试试

和dbgserver有关系吗?

另外,ios7是否只能用对应的那个debugserver?
可以用8里面的么?

可能不行,但我没试过,你可以试试看

请教一下。 你的debugserver版本是多少?

例如我的是 debugserver-310.2 for arm64.

helloworld:~ root# /usr/bin/debugserver *:1234 /var/mobile/Applications/8968BA17-37C3-4926-B223-8D42A123A786/YoukuiPhone.app/YoukuiPhone
debugserver-310.2 for arm64.
Listening to port 1234 for a connection from *…

我也是310.2,但我没用过dis命令

貌似这个版本的lldb还是没修复这个问题,换旧版吧