With reverse-connect, lldb gets a port from the OS, spawns a listen thread using the port, and launches lldb-server/debugserver, telling it to connect back to lldb. lldb with then join with the listen thread. The listen thread calls accept() to wait for the server to connect back to it.
On Linux (and possibly other OSes), if lldb-server dies or quits before connecting, lldb will hang. It sits waiting for accept() to return, but it never will.
If the child dies, the listen thread should be killed, and an error returned to the user.
This is easily seen on Linux. Simply point to an alternate debugserver. Set LLDB_DEBUGSERVER_PATH to something else, say /bin/ls. This will finish and never connect back to lldb.
→ setenv LLDB_DEBUGSERVER_PATH /bin/ls
(lldb) target create “/bin/ls”
Current executable set to ‘/bin/ls’ (x86_64).