[Lldb-commits] [lldb] r216194 - Fix on Linux for ReadThread lingering after inferior exits
Todd Fiala
todd.fiala at gmail.com
Thu Aug 21 10:16:26 PDT 2014
Author: tfiala
Date: Thu Aug 21 12:16:26 2014
New Revision: 216194
URL: http://llvm.org/viewvc/llvm-project?rev=216194&view=rev
Log:
Fix on Linux for ReadThread lingering after inferior exits
See this email thread:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140818/012487.html
This patch handles the case where the inferior process exits but leaves the ReadThread in a continuous loop reading from the communication pipe. On MacOSX, the ReadThread exits when it receives a 0 return value from the read due to EOF. On Linux the read returns -1 and sets errno to EIO error, this does not currently cause the thread to shutdown so it continues to read from the comm. In Communication::ReadThread I added a handler for eConnectionStatusError to disconnect and shutdown the thread.
Change by Alex Pepper.
Modified:
lldb/trunk/source/Core/Communication.cpp
Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=216194&r1=216193&r2=216194&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Thu Aug 21 12:16:26 2014
@@ -380,13 +380,24 @@ Communication::ReadThread (lldb::thread_
if (comm->GetCloseOnEOF())
done = true;
break;
+ case eConnectionStatusError: // Check GetError() for details
+ if (error.GetType() == eErrorTypePOSIX && error.GetError() == EIO)
+ {
+ // EIO on a pipe is usually caused by remote shutdown
+ comm->Disconnect ();
+ done = true;
+ }
+ if (log)
+ error.LogIfError (log,
+ "%p Communication::ReadFromConnection () => status = %s",
+ p,
+ Communication::ConnectionStatusAsCString (status));
+ break;
case eConnectionStatusNoConnection: // No connection
case eConnectionStatusLostConnection: // Lost connection while connected to a valid connection
case eConnectionStatusInterrupted: // Interrupted
-
done = true;
// Fall through...
- case eConnectionStatusError: // Check GetError() for details
case eConnectionStatusTimedOut: // Request timed out
if (log)
error.LogIfError (log,
More information about the lldb-commits
mailing list