summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2014-08-21 17:16:26 +0000
committerTodd Fiala <todd.fiala@gmail.com>2014-08-21 17:16:26 +0000
commit426282813220cb3328c9554fdef33983057daeb0 (patch)
tree6dd42553841257600858796db6a2ee58ae0566eb /lldb/source/Core
parentdfdda0d41cf0b5d2ca5271e83ae212baedfcd847 (diff)
downloadbcm5719-llvm-426282813220cb3328c9554fdef33983057daeb0.tar.gz
bcm5719-llvm-426282813220cb3328c9554fdef33983057daeb0.zip
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. llvm-svn: 216194
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/Communication.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp
index 20231c4506b..d71c9881a6f 100644
--- a/lldb/source/Core/Communication.cpp
+++ b/lldb/source/Core/Communication.cpp
@@ -380,13 +380,24 @@ Communication::ReadThread (lldb::thread_arg_t p)
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,
OpenPOWER on IntegriCloud