This is an archive of the discontinued LLVM Phabricator instance.

Use timeout when reading debugserver's port from a named pipe.
ClosedPublic

Authored by ovyalov on Dec 2 2014, 3:45 PM.

Details

Reviewers
clayborg
Summary

After debugserver is launched (either by lldb or lldb-platform) it may terminate prematurely even after successful start by various reasons:

  1. Invalid flag configuration.
  2. 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.

Diff Detail

Event Timeline

ovyalov updated this revision to Diff 16835.Dec 2 2014, 3:45 PM
ovyalov retitled this revision from to Use timeout when reading debugserver's port from a named pipe. .
ovyalov updated this object.
ovyalov edited the test plan for this revision. (Show Details)
ovyalov added a reviewer: clayborg.
ovyalov added a subscriber: Unknown Object (MLST).
clayborg accepted this revision.Dec 2 2014, 4:13 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Dec 2 2014, 4:13 PM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r223251.