Lldb connect 时 端口转接窗口报错

问题出现步骤:

  1. 启动debugserver:debugserver localhost:3333 -x auto “app路径”;
  2. 终端中做好端口转接:./tcprelay.py -t 3333:3333。
  3. lldb 启动。
  4. 在lldb窗口中执行命令:process connect connect://localhost:3333
  5. lldb窗口收到:failed to get reply to handshake packet。与此同时端口转接窗口报错如下:

bogon:python-client optaim$ ./tcprelay.py -t 3333:3333
Forwarding local port 3333 to remote port 3333
Incoming connection to 3333
Waiting for devices…
Connecting to device <MuxDevice: ID 4 ProdID 0x12a8 Serial ‘e01db3d7be9224c584ab14fa5a518aa6251b6c91’ Location 0x14200000>

Exception happened during processing of request from (‘127.0.0.1’, 51615)
Traceback (most recent call last):
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py”, line 599, in process_request_thread
self.finish_request(request, client_address)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py”, line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py”, line 655, in init
self.handle()
File “./tcprelay.py”, line 82, in handle
dsock = mux.connect(dev, self.server.rport)
File “/Users/optaim/Downloads/usbmuxd-1.0.8/python-client/usbmux.py”, line 235, in connect
return connector.connect(device, port)
File “/Users/optaim/Downloads/usbmuxd-1.0.8/python-client/usbmux.py”, line 206, in connect
raise MuxError(“Connect failed: error %d”%ret)
MuxError: Connect failed: error 3

查了一半天也没有搞明白这个问题出现的原因。
怀疑过debugserver的签名问题,也怀疑过debugserver的指令问题,但是因为我的debugserver是按照之前一个逆友给的做好的debugserver,我选择了相信这种可能性不大。

也怀疑过是Python版本问题。
怀疑过是usbmuxd的版本问题,我的是1.0.8.

但最终却是坑爹的发现是我多连接了一台iPhone设备。

最终解决方案:

移除多余的那台iPhone连接就可以了。