[lldb-dev] Failure connecting to lldb-server running in local virtual machine.

Howard Hellyer via lldb-dev lldb-dev at lists.llvm.org
Thu Feb 16 05:58:16 PST 2017


Hi,

I’ve been hitting issues connecting to lldb-server. I’ve been trying from 
Mac to Linux running in a Virtual Box VM on the same machine. Once I’ve 
created a target and issued the “run” command lldb immediately disconnects 
with “error: connect remote failed (failed to get reply to handshake 
packet)”. The full output from a failed connection attempting to debug a 
simple "Hello World!" program is:

---
(lldb) platform select remote-linux
  Platform: remote-linux
 Connected: no
(lldb) platform connect connect://127.0.0.1:1234
    Platform: remote-linux
    Triple: x86_64-pc-linux-gnu
OS Version: 4.8.0 (4.8.0-22-generic)
    Kernel: #24-Ubuntu SMP Sat Oct 8 09:15:00 UTC 2016
  Hostname: hhellyer-VirtualBox
 Connected: yes
WorkingDir: /home/hhellyer
(lldb) target create hello.out
Current executable set to 'hello.out' (x86_64).
(lldb) run
error: connect remote failed (failed to get reply to handshake packet)
error: process launch failed: failed to get reply to handshake packet
--

I’m running the server (on Linux) with:
>lldb-server platform --listen *:1234 -P 2345
(I need to specify the -P as only a few ports are forwarded from the 
VirtualBox vm.)

With logging enabled the logs showed the failure happened when the 
lldb-server received the "QStartNoAckMode" packet. I initially thought 
this was a timing issue on the connection between the client and the 
server. After doing some investigation I ended up adding code to dump a 
backtrace when the connection was disconnected (in 
Communication::Disconnect) and suddenly running the target started 
working. I replaced the backtrace with a sleep(1) call and it continued 
working. After that I setup another remote virtual linux box (actually 
some distance away on the network) and found that lldb worked fine 
connecting to the remote lldb-server there, presumably because the 
connection was much slower.

At this point I was assuming it was a timing issue however another 
configuration that worked was lldb-server and lldb both running on the 
Linux VM inside Virtual Box which I would have assumed would also be very 
quick. I’m also wondering if lldb does anything special when the 
connection goes to 127.0.0.1 that using a local VM might confuse.

I was testing from Mac to Virtual Box just because it was simpler than 
testing to a remote system, which was actually the goal and seems to work, 
so this isn’t totally blocking me but it does seem like a problem and I'm 
not sure if other users connecting to remote linux machine will hit this 
problem.

Are there any known issues around this type of connection already? Or does 
anyone have any useful pointers? I couldn’t see anything quite the same on 
http://bugs.llvm.org/ so asking here seemed like a logical next step.

Thanks,

Howard Hellyer
IBM Runtime Technologies, IBM Systems
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170216/99ae8a13/attachment-0001.html>


More information about the lldb-dev mailing list