https://github.com/charles-zablit updated 
https://github.com/llvm/llvm-project/pull/181809

>From b4a2d67a3ac3878830ac8310a876db6a8f938eb0 Mon Sep 17 00:00:00 2001
From: Charles Zablit <[email protected]>
Date: Tue, 17 Feb 2026 11:57:13 +0000
Subject: [PATCH 1/3] [lldb][windows] handle ENXIO error

---
 lldb/source/Core/ThreadedCommunication.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lldb/source/Core/ThreadedCommunication.cpp 
b/lldb/source/Core/ThreadedCommunication.cpp
index 649ce71c29374..163708ab937b7 100644
--- a/lldb/source/Core/ThreadedCommunication.cpp
+++ b/lldb/source/Core/ThreadedCommunication.cpp
@@ -293,6 +293,12 @@ lldb::thread_result_t ThreadedCommunication::ReadThread() {
         disconnect = GetCloseOnEOF();
         done = true;
       }
+      if (error.GetType() == eErrorTypeWin32 && error.GetError() == ENXIO) {
+        // ENXIO on a pipe is usually caused by a remote shutdown of the
+        // attached ConPTY
+        disconnect = GetCloseOnEOF();
+        done = true;
+      }
       if (error.Fail())
         LLDB_LOG(log, "error: {0}, status = {1}", error,
                  ThreadedCommunication::ConnectionStatusAsString(status));

>From 1917d6e22d235184f52febd56d381e4cc8611b6b Mon Sep 17 00:00:00 2001
From: Charles Zablit <[email protected]>
Date: Tue, 17 Feb 2026 14:34:17 +0000
Subject: [PATCH 2/3] switch to ERROR_INVALID_HANDLE

---
 lldb/source/Core/ThreadedCommunication.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Core/ThreadedCommunication.cpp 
b/lldb/source/Core/ThreadedCommunication.cpp
index 163708ab937b7..a4d417aa66599 100644
--- a/lldb/source/Core/ThreadedCommunication.cpp
+++ b/lldb/source/Core/ThreadedCommunication.cpp
@@ -16,6 +16,9 @@
 #include "lldb/Utility/Listener.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Status.h"
+#ifdef _WIN32
+#include "lldb/Host/windows/windows.h"
+#endif
 
 #include "llvm/Support/Compiler.h"
 
@@ -293,12 +296,13 @@ lldb::thread_result_t ThreadedCommunication::ReadThread() 
{
         disconnect = GetCloseOnEOF();
         done = true;
       }
-      if (error.GetType() == eErrorTypeWin32 && error.GetError() == ENXIO) {
-        // ENXIO on a pipe is usually caused by a remote shutdown of the
-        // attached ConPTY
+      #ifdef _WIN32
+      if (error.GetType() == eErrorTypeWin32 && error.GetError() == 
ERROR_INVALID_HANDLE) {
+        // ERROR_INVALID_HANDLE on a pipe is usually caused by a remote 
shutdown of the pipe's ConPTY
         disconnect = GetCloseOnEOF();
         done = true;
       }
+      #endif
       if (error.Fail())
         LLDB_LOG(log, "error: {0}, status = {1}", error,
                  ThreadedCommunication::ConnectionStatusAsString(status));

>From a58150c1575535b1bb7c80e79c5388ecd8cb7fd2 Mon Sep 17 00:00:00 2001
From: Charles Zablit <[email protected]>
Date: Tue, 17 Feb 2026 14:47:22 +0000
Subject: [PATCH 3/3] fixup! switch to ERROR_INVALID_HANDLE

---
 lldb/source/Core/ThreadedCommunication.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/source/Core/ThreadedCommunication.cpp 
b/lldb/source/Core/ThreadedCommunication.cpp
index a4d417aa66599..09f78f13f34d3 100644
--- a/lldb/source/Core/ThreadedCommunication.cpp
+++ b/lldb/source/Core/ThreadedCommunication.cpp
@@ -296,13 +296,15 @@ lldb::thread_result_t ThreadedCommunication::ReadThread() 
{
         disconnect = GetCloseOnEOF();
         done = true;
       }
-      #ifdef _WIN32
-      if (error.GetType() == eErrorTypeWin32 && error.GetError() == 
ERROR_INVALID_HANDLE) {
-        // ERROR_INVALID_HANDLE on a pipe is usually caused by a remote 
shutdown of the pipe's ConPTY
+#ifdef _WIN32
+      if (error.GetType() == eErrorTypeWin32 &&
+          error.GetError() == ERROR_INVALID_HANDLE) {
+        // ERROR_INVALID_HANDLE on a pipe is usually caused by a remote 
shutdown
+        // of the pipe's ConPTY
         disconnect = GetCloseOnEOF();
         done = true;
       }
-      #endif
+#endif
       if (error.Fail())
         LLDB_LOG(log, "error: {0}, status = {1}", error,
                  ThreadedCommunication::ConnectionStatusAsString(status));

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to