summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-10-08 20:38:41 +0000
committerZachary Turner <zturner@google.com>2014-10-08 20:38:41 +0000
commitb2df30d6521069cb2f655213a1b31040f82ee7c3 (patch)
treec9b4d248569c80c5c19a8ec3caaabd5069ee0c8a /lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
parent1947f863efd83ce21f7e7d99ed69b95a484d4a84 (diff)
downloadbcm5719-llvm-b2df30d6521069cb2f655213a1b31040f82ee7c3.tar.gz
bcm5719-llvm-b2df30d6521069cb2f655213a1b31040f82ee7c3.zip
Fix deadlock in Python one-line execution.
Python one-line execution was using ConnectionFileDescriptor to do a non-blocking read against a pipe. This won't work on Windows, as CFD is implemented using select(), and select() only works with sockets on Windows. The solution is to use ConnectionGenericFile on Windows, which uses the native API to do overlapped I/O on the pipe. This in turn requires re-implementing Host::Pipe on Windows using native OS handles instead of the more portable _pipe CRT api. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5679 llvm-svn: 219339
Diffstat (limited to 'lldb/source/Host/windows/ConnectionGenericFileWindows.cpp')
-rw-r--r--lldb/source/Host/windows/ConnectionGenericFileWindows.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
index 312cef62d65..93d37945992 100644
--- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
+++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
@@ -241,9 +241,16 @@ ConnectionGenericFile::Read(void *dst, size_t dst_len, uint32_t timeout_usec, ll
goto finish;
}
-
- // An unknown error occured. Fail out.
- return_info.Set(0, eConnectionStatusError, ::GetLastError());
+ else if (::GetLastError() == ERROR_BROKEN_PIPE)
+ {
+ // The write end of a pipe was closed. This is equivalent to EOF.
+ return_info.Set(0, eConnectionStatusEndOfFile, 0);
+ }
+ else
+ {
+ // An unknown error occured. Fail out.
+ return_info.Set(0, eConnectionStatusError, ::GetLastError());
+ }
goto finish;
finish:
OpenPOWER on IntegriCloud