After debugserver is launched (either by lldb or lldb-platform) it may terminate prematurely even after successful start by various reasons:
- Invalid flag configuration.
- Socket errors.
In this case a named pipe (used to deliver a port that debugserver listens) will be never opened and written - so, lldb or platform hangs forever.
This CL fixes the problem by opening pipe in non-blocking mode and waiting on pipe data via select.
Potentially, this issue might be handled even more properly if GDBRemoteCommunication::StartDebugserverProcess gets notified about debugserver termination (via callback or condition variable). If such approach sounds reasonable I can do it as a next step.