From cdc029d04b4122a1503072c5a56fe33f6191d806 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Thu, 7 Aug 2014 23:35:20 +0000 Subject: [PATCH] Disable the command pipe in ConnectionFileDescriptor for Windows. The select() API on Windows is not compatible with objects other than sockets, so passing a descriptor for the command pipe to this function is guaranteed to fail. ConnectionFileDescriptor is still broken on Windows after this patch, but slightly less broken than before. llvm-svn: 215172 --- lldb/source/Core/ConnectionFileDescriptor.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp index ff89ce1df993..7c8e98a21129 100644 --- a/lldb/source/Core/ConnectionFileDescriptor.cpp +++ b/lldb/source/Core/ConnectionFileDescriptor.cpp @@ -591,11 +591,18 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt if (handle != IOObject::kInvalidHandleValue) { +#if defined(_MSC_VER) + // select() won't accept pipes on Windows. The entire Windows codepath needs to be + // converted over to using WaitForMultipleObjects and event HANDLEs, but for now at least + // this will allow ::select() to not return an error. + const bool have_pipe_fd = false; +#else const bool have_pipe_fd = pipe_fd >= 0; -#if !defined(__APPLE__) && !defined(_MSC_VER) +#if !defined(__APPLE__) assert (handle < FD_SETSIZE); if (have_pipe_fd) assert (pipe_fd < FD_SETSIZE); +#endif #endif while (handle == m_read_sp->GetWaitableHandle()) {