[Lldb-commits] [lldb] [lldb] Updated lldb-server to spawn the child process and share socket on Windows (PR #101283)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 31 04:28:32 PDT 2024


================
@@ -283,54 +293,94 @@ Status PipeWindows::ReadWithTimeout(void *buf, size_t size,
   DWORD sys_bytes_read = size;
   BOOL result = ::ReadFile(m_read, buf, sys_bytes_read, &sys_bytes_read,
                            &m_read_overlapped);
-  if (!result && GetLastError() != ERROR_IO_PENDING)
-    return Status(::GetLastError(), eErrorTypeWin32);
-
-  DWORD timeout = (duration == std::chrono::microseconds::zero())
-                      ? INFINITE
-                      : duration.count() * 1000;
-  DWORD wait_result = ::WaitForSingleObject(m_read_overlapped.hEvent, timeout);
-  if (wait_result != WAIT_OBJECT_0) {
-    // The operation probably failed.  However, if it timed out, we need to
-    // cancel the I/O. Between the time we returned from WaitForSingleObject
-    // and the time we call CancelIoEx, the operation may complete.  If that
-    // hapens, CancelIoEx will fail and return ERROR_NOT_FOUND. If that
-    // happens, the original operation should be considered to have been
-    // successful.
-    bool failed = true;
-    DWORD failure_error = ::GetLastError();
-    if (wait_result == WAIT_TIMEOUT) {
-      BOOL cancel_result = CancelIoEx(m_read, &m_read_overlapped);
-      if (!cancel_result && GetLastError() == ERROR_NOT_FOUND)
-        failed = false;
+  if (!result) {
----------------
slydiman wrote:

Thanks. Updated.

https://github.com/llvm/llvm-project/pull/101283


More information about the lldb-commits mailing list