[Lldb-commits] [lldb] [NFC][lldb][Windows] extract IOHandlerProcessSTDIOWindows (PR #201651)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 5 08:22:37 PDT 2026
https://github.com/charles-zablit updated https://github.com/llvm/llvm-project/pull/201651
>From e189365b39724e8b4a665a45886f846b96609701 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Thu, 4 Jun 2026 18:40:44 +0100
Subject: [PATCH 1/6] [NFC][lldb][Windows] extract IOHandlerProcessSTDIOWindows
---
.../Plugins/Process/Utility/CMakeLists.txt | 12 +-
.../Utility/IOHandlerProcessSTDIOWindows.cpp | 172 ++++++++++++++++
.../Utility/IOHandlerProcessSTDIOWindows.h | 63 ++++++
.../Process/Windows/Common/ProcessWindows.cpp | 190 +-----------------
.../Process/Windows/Common/ProcessWindows.h | 2 +
5 files changed, 259 insertions(+), 180 deletions(-)
create mode 100644 lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.cpp
create mode 100644 lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h
diff --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index 3652a0cfb530f..e400676df8b65 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -1,7 +1,7 @@
# TODO: Clean up this directory and its dependencies
set_property(DIRECTORY PROPERTY LLDB_PLUGIN_KIND ProcessUtility)
-add_lldb_library(lldbPluginProcessUtility
+set(LLDB_PLUGIN_PROCESS_UTILITY_SOURCES
AuxVector.cpp
FreeBSDSignals.cpp
GDBRemoteSignals.cpp
@@ -64,6 +64,16 @@ add_lldb_library(lldbPluginProcessUtility
RegisterInfoPOSIXDynamic_riscv32.cpp
StopInfoMachException.cpp
ThreadMemory.cpp
+)
+
+if(WIN32)
+ list(APPEND LLDB_PLUGIN_PROCESS_UTILITY_SOURCES
+ IOHandlerProcessSTDIOWindows.cpp
+ )
+endif()
+
+add_lldb_library(lldbPluginProcessUtility
+ ${LLDB_PLUGIN_PROCESS_UTILITY_SOURCES}
LINK_COMPONENTS
Support
diff --git a/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.cpp b/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.cpp
new file mode 100644
index 0000000000000..2b9ab9ce0812b
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.cpp
@@ -0,0 +1,172 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "IOHandlerProcessSTDIOWindows.h"
+
+#include "lldb/Host/windows/windows.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
+
+using namespace lldb_private;
+
+IOHandlerProcessSTDIOWindows::IOHandlerProcessSTDIOWindows(Process *process)
+ : IOHandler(process->GetTarget().GetDebugger(), IOHandler::Type::ProcessIO),
+ m_process(process),
+ m_read_file(GetInputFD(), File::eOpenOptionReadOnly, false),
+ m_interrupt_event(
+ CreateEvent(/*lpEventAttributes=*/nullptr, /*bManualReset=*/FALSE,
+ /*bInitialState=*/FALSE, /*lpName=*/nullptr)) {}
+
+IOHandlerProcessSTDIOWindows::~IOHandlerProcessSTDIOWindows() {
+ if (m_interrupt_event != INVALID_HANDLE_VALUE)
+ ::CloseHandle(m_interrupt_event);
+}
+
+void IOHandlerProcessSTDIOWindows::SetIsRunning(bool running) {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ SetIsDone(!running);
+ m_is_running = running;
+}
+
+/// Peek the console for input. If it has any, drain the pipe until text input
+/// is found or the pipe is empty.
+///
+/// \param hStdin
+/// The handle to the standard input's pipe.
+///
+/// \return
+/// true if the pipe has text input.
+llvm::Expected<bool>
+IOHandlerProcessSTDIOWindows::ConsoleHasTextInput(const HANDLE hStdin) {
+ // Check if there are already characters buffered. Pressing enter counts as
+ // 2 characters '\r\n' and only one of them is a keyDown event.
+ DWORD bytesAvailable = 0;
+ if (PeekNamedPipe(hStdin, nullptr, 0, nullptr, &bytesAvailable, nullptr)) {
+ if (bytesAvailable > 0)
+ return true;
+ }
+
+ while (true) {
+ INPUT_RECORD inputRecord;
+ DWORD numRead = 0;
+ if (!PeekConsoleInput(hStdin, &inputRecord, 1, &numRead))
+ return llvm::createStringError("failed to peek standard input");
+
+ if (numRead == 0)
+ return false;
+
+ if (inputRecord.EventType == KEY_EVENT &&
+ inputRecord.Event.KeyEvent.bKeyDown &&
+ inputRecord.Event.KeyEvent.uChar.AsciiChar != 0)
+ return true;
+
+ if (!ReadConsoleInput(hStdin, &inputRecord, 1, &numRead))
+ return llvm::createStringError("failed to read standard input");
+ }
+}
+
+void IOHandlerProcessSTDIOWindows::Run() {
+ if (!m_read_file.IsValid()) {
+ SetIsDone(true);
+ return;
+ }
+
+ SetIsDone(false);
+ SetIsRunning(true);
+
+ HANDLE hStdin = m_read_file.GetWaitableHandle();
+ HANDLE waitHandles[2] = {hStdin, m_interrupt_event};
+
+ DWORD consoleMode;
+ bool isConsole = GetConsoleMode(hStdin, &consoleMode) != 0;
+ // With ENABLE_LINE_INPUT, ReadFile returns only when a carriage return is
+ // read. This will block lldb in ReadFile until the user hits enter. Save
+ // the previous console mode to restore it later and remove
+ // ENABLE_LINE_INPUT.
+ DWORD oldConsoleMode = consoleMode;
+ SetConsoleMode(hStdin, consoleMode & ~ENABLE_LINE_INPUT & ~ENABLE_ECHO_INPUT);
+
+ while (true) {
+ {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ if (GetIsDone())
+ goto exit_loop;
+ }
+
+ DWORD result = WaitForMultipleObjects(2, waitHandles, FALSE, INFINITE);
+ switch (result) {
+ case WAIT_FAILED:
+ goto exit_loop;
+ case WAIT_OBJECT_0: {
+ if (isConsole) {
+ auto hasInputOrErr = ConsoleHasTextInput(hStdin);
+ if (!hasInputOrErr) {
+ Log *log = GetLog(LLDBLog::Process);
+ LLDB_LOG_ERROR(log, hasInputOrErr.takeError(),
+ "failed to process debuggee's IO: {0}");
+ goto exit_loop;
+ }
+
+ // If no text input is ready, go back to waiting.
+ if (!*hasInputOrErr)
+ continue;
+ }
+
+ char ch = 0;
+ DWORD read = 0;
+ if (!ReadFile(hStdin, &ch, 1, &read, nullptr) || read != 1)
+ goto exit_loop;
+
+ Status err;
+ m_process->PutSTDIN(&ch, 1, err);
+ if (err.Fail())
+ goto exit_loop;
+ break;
+ }
+ case WAIT_OBJECT_0 + 1: {
+ ControlOp op = m_pending_op.exchange(eControlOpNone);
+ if (op == eControlOpQuit)
+ goto exit_loop;
+ if (op == eControlOpInterrupt &&
+ StateIsRunningState(m_process->GetState()))
+ m_process->SendAsyncInterrupt();
+ break;
+ }
+ default:
+ goto exit_loop;
+ }
+ }
+
+exit_loop:;
+ SetIsRunning(false);
+ SetIsDone(true);
+ SetConsoleMode(hStdin, oldConsoleMode);
+}
+
+void IOHandlerProcessSTDIOWindows::Cancel() {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ SetIsDone(true);
+ if (m_is_running) {
+ m_pending_op.store(eControlOpQuit);
+ ::SetEvent(m_interrupt_event);
+ }
+}
+
+bool IOHandlerProcessSTDIOWindows::Interrupt() {
+ if (m_active) {
+ m_pending_op.store(eControlOpInterrupt);
+ ::SetEvent(m_interrupt_event);
+ return true;
+ }
+ if (StateIsRunningState(m_process->GetState())) {
+ m_process->SendAsyncInterrupt();
+ return true;
+ }
+ return false;
+}
diff --git a/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h b/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h
new file mode 100644
index 0000000000000..fcbd587b40143
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LIBLLDB_PLUGINS_PROCESS_WINDOWS_COMMON_IO_HANDLER_PROCESS_STDIO_WINDOWS_H_
+#define LIBLLDB_PLUGINS_PROCESS_WINDOWS_COMMON_IO_HANDLER_PROCESS_STDIO_WINDOWS_H_
+
+#include "lldb/Core/IOHandler.h"
+#include "lldb/Host/File.h"
+#include "lldb/Target/Process.h"
+
+typedef void *HANDLE;
+
+using namespace lldb_private;
+
+class IOHandlerProcessSTDIOWindows : public IOHandler {
+public:
+ IOHandlerProcessSTDIOWindows(Process *process);
+
+ ~IOHandlerProcessSTDIOWindows() override;
+
+ void SetIsRunning(bool running);
+
+ /// Peek the console for input. If it has any, drain the pipe until text input
+ /// is found or the pipe is empty.
+ ///
+ /// \param hStdin
+ /// The handle to the standard input's pipe.
+ ///
+ /// \return
+ /// true if the pipe has text input.
+ llvm::Expected<bool> ConsoleHasTextInput(const HANDLE hStdin);
+
+ void Run() override;
+
+ void Cancel() override;
+
+ bool Interrupt() override;
+
+ void GotEOF() override {}
+
+private:
+ enum ControlOp : char {
+ eControlOpQuit = 'q',
+ eControlOpInterrupt = 'i',
+ eControlOpNone = 0,
+ };
+
+ Process *m_process;
+ /// Read from this file (usually actual STDIN for LLDB)
+ NativeFile m_read_file;
+ HANDLE m_interrupt_event =
+ reinterpret_cast<HANDLE>(static_cast<intptr_t>(-1));
+ std::atomic<ControlOp> m_pending_op{eControlOpNone};
+ std::mutex m_mutex;
+ bool m_is_running = false;
+};
+
+#endif // LIBLLDB_PLUGINS_PROCESS_WINDOWS_COMMON_IO_HANDLER_PROCESS_STDIO_WINDOWS_H_
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 9a273463792ce..83d9e784f75a0 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -45,6 +45,7 @@
#include "ExceptionRecord.h"
#include "ForwardDecl.h"
#include "LocalDebugDelegate.h"
+#include "Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h"
#include "ProcessWindowsLog.h"
#include "TargetThreadWindows.h"
@@ -1084,184 +1085,15 @@ Status ProcessWindows::DisableWatchpoint(WatchpointSP wp_sp, bool notify) {
return error;
}
-class IOHandlerProcessSTDIOWindows : public IOHandler {
-public:
- IOHandlerProcessSTDIOWindows(Process *process, HANDLE conpty_input)
- : IOHandler(process->GetTarget().GetDebugger(),
- IOHandler::Type::ProcessIO),
- m_process(process),
- m_read_file(GetInputFD(), File::eOpenOptionReadOnly, false),
- m_write_file(conpty_input),
- m_interrupt_event(
- CreateEvent(/*lpEventAttributes=*/nullptr, /*bManualReset=*/FALSE,
- /*bInitialState=*/FALSE, /*lpName=*/nullptr)) {}
-
- ~IOHandlerProcessSTDIOWindows() override {
- if (m_interrupt_event != INVALID_HANDLE_VALUE)
- ::CloseHandle(m_interrupt_event);
+size_t ProcessWindows::PutSTDIN(const char *src, size_t src_len,
+ Status &error) {
+ if (!m_stdio_communication.IsConnected()) {
+ error = Status::FromErrorString("stdin not connected");
+ return 0;
}
-
- void SetIsRunning(bool running) {
- std::lock_guard<std::mutex> guard(m_mutex);
- SetIsDone(!running);
- m_is_running = running;
- }
-
- /// Peek the console for input. If it has any, drain the pipe until text input
- /// is found or the pipe is empty.
- ///
- /// \param hStdin
- /// The handle to the standard input's pipe.
- ///
- /// \return
- /// true if the pipe has text input.
- llvm::Expected<bool> ConsoleHasTextInput(const HANDLE hStdin) {
- // Check if there are already characters buffered. Pressing enter counts as
- // 2 characters '\r\n' and only one of them is a keyDown event.
- DWORD bytesAvailable = 0;
- if (PeekNamedPipe(hStdin, nullptr, 0, nullptr, &bytesAvailable, nullptr)) {
- if (bytesAvailable > 0)
- return true;
- }
-
- while (true) {
- INPUT_RECORD inputRecord;
- DWORD numRead = 0;
- if (!PeekConsoleInput(hStdin, &inputRecord, 1, &numRead))
- return llvm::createStringError("failed to peek standard input");
-
- if (numRead == 0)
- return false;
-
- if (inputRecord.EventType == KEY_EVENT &&
- inputRecord.Event.KeyEvent.bKeyDown &&
- inputRecord.Event.KeyEvent.uChar.AsciiChar != 0)
- return true;
-
- if (!ReadConsoleInput(hStdin, &inputRecord, 1, &numRead))
- return llvm::createStringError("failed to read standard input");
- }
- }
-
- void Run() override {
- if (!m_read_file.IsValid() || m_write_file == INVALID_HANDLE_VALUE) {
- SetIsDone(true);
- return;
- }
-
- SetIsDone(false);
- SetIsRunning(true);
-
- HANDLE hStdin = m_read_file.GetWaitableHandle();
- HANDLE waitHandles[2] = {hStdin, m_interrupt_event};
-
- DWORD consoleMode;
- bool isConsole = GetConsoleMode(hStdin, &consoleMode) != 0;
- // With ENABLE_LINE_INPUT, ReadFile returns only when a carriage return is
- // read. This will block lldb in ReadFile until the user hits enter. Save
- // the previous console mode to restore it later and remove
- // ENABLE_LINE_INPUT.
- DWORD oldConsoleMode = consoleMode;
- SetConsoleMode(hStdin,
- consoleMode & ~ENABLE_LINE_INPUT & ~ENABLE_ECHO_INPUT);
-
- while (true) {
- {
- std::lock_guard<std::mutex> guard(m_mutex);
- if (GetIsDone())
- goto exit_loop;
- }
-
- DWORD result = WaitForMultipleObjects(2, waitHandles, FALSE, INFINITE);
- switch (result) {
- case WAIT_FAILED:
- goto exit_loop;
- case WAIT_OBJECT_0: {
- if (isConsole) {
- auto hasInputOrErr = ConsoleHasTextInput(hStdin);
- if (!hasInputOrErr) {
- Log *log = GetLog(WindowsLog::Process);
- LLDB_LOG_ERROR(log, hasInputOrErr.takeError(),
- "failed to process debuggee's IO: {0}");
- goto exit_loop;
- }
-
- // If no text input is ready, go back to waiting.
- if (!*hasInputOrErr)
- continue;
- }
-
- char ch = 0;
- DWORD read = 0;
- if (!ReadFile(hStdin, &ch, 1, &read, nullptr) || read != 1)
- goto exit_loop;
-
- DWORD written = 0;
- if (!WriteFile(m_write_file, &ch, 1, &written, nullptr) || written != 1)
- goto exit_loop;
- break;
- }
- case WAIT_OBJECT_0 + 1: {
- ControlOp op = m_pending_op.exchange(eControlOpNone);
- if (op == eControlOpQuit)
- goto exit_loop;
- if (op == eControlOpInterrupt &&
- StateIsRunningState(m_process->GetState()))
- m_process->SendAsyncInterrupt();
- break;
- }
- default:
- goto exit_loop;
- }
- }
-
- exit_loop:;
- SetIsRunning(false);
- SetIsDone(true);
- SetConsoleMode(hStdin, oldConsoleMode);
- }
-
- void Cancel() override {
- std::lock_guard<std::mutex> guard(m_mutex);
- SetIsDone(true);
- if (m_is_running) {
- m_pending_op.store(eControlOpQuit);
- ::SetEvent(m_interrupt_event);
- }
- }
-
- bool Interrupt() override {
- if (m_active) {
- m_pending_op.store(eControlOpInterrupt);
- ::SetEvent(m_interrupt_event);
- return true;
- }
- if (StateIsRunningState(m_process->GetState())) {
- m_process->SendAsyncInterrupt();
- return true;
- }
- return false;
- }
-
- void GotEOF() override {}
-
-private:
- enum ControlOp : char {
- eControlOpQuit = 'q',
- eControlOpInterrupt = 'i',
- eControlOpNone = 0,
- };
-
- Process *m_process;
- /// Read from this file (usually actual STDIN for LLDB)
- NativeFile m_read_file;
- /// Write to this file (usually the primary pty for getting io to debuggee)
- HANDLE m_write_file = INVALID_HANDLE_VALUE;
- HANDLE m_interrupt_event = INVALID_HANDLE_VALUE;
- std::atomic<ControlOp> m_pending_op{eControlOpNone};
- std::mutex m_mutex;
- bool m_is_running = false;
-};
+ ConnectionStatus status;
+ return m_stdio_communication.WriteAll(src, src_len, status, &error);
+}
void ProcessWindows::SetPseudoConsoleHandle() {
if (m_pty == nullptr)
@@ -1277,8 +1109,8 @@ void ProcessWindows::SetPseudoConsoleHandle() {
{
std::lock_guard<std::mutex> guard(m_process_input_reader_mutex);
if (!m_process_input_reader)
- m_process_input_reader = std::make_shared<IOHandlerProcessSTDIOWindows>(
- this, m_pty->GetSTDINHandle());
+ m_process_input_reader =
+ std::make_shared<IOHandlerProcessSTDIOWindows>(this);
}
}
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
index da35ae923dcee..38c47a95e6cbf 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
@@ -113,6 +113,8 @@ class ProcessWindows : public Process, public ProcessDebugger {
/// buffered in the ConPTY/pipe to the process's STDOUT cache.
void DrainProcessStdout();
+ size_t PutSTDIN(const char *src, size_t src_len, Status &error);
+
ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
Status DoGetMemoryRegionInfo(lldb::addr_t vm_addr,
>From 065c3060498b36ad21658554fbd6cb572f0e5119 Mon Sep 17 00:00:00 2001
From: Charles Zablit <zablitcharles at gmail.com>
Date: Fri, 5 Jun 2026 10:03:41 +0100
Subject: [PATCH 2/6] Update
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
Co-authored-by: Nerixyz <nero.9 at hotmail.de>
---
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
index 38c47a95e6cbf..677ade4971eed 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
@@ -113,7 +113,7 @@ class ProcessWindows : public Process, public ProcessDebugger {
/// buffered in the ConPTY/pipe to the process's STDOUT cache.
void DrainProcessStdout();
- size_t PutSTDIN(const char *src, size_t src_len, Status &error);
+ size_t PutSTDIN(const char *src, size_t src_len, Status &error) override;
ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
>From dd182ba6cb5e34b02f8cdda3e78e20f9c19be233 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Fri, 5 Jun 2026 12:02:37 +0100
Subject: [PATCH 3/6] move to Windows directory
---
lldb/source/Plugins/Process/Utility/CMakeLists.txt | 5 -----
lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt | 1 +
.../Common}/IOHandlerProcessSTDIOWindows.cpp | 0
.../Common}/IOHandlerProcessSTDIOWindows.h | 0
.../source/Plugins/Process/Windows/Common/ProcessWindows.cpp | 2 +-
5 files changed, 2 insertions(+), 6 deletions(-)
rename lldb/source/Plugins/Process/{Utility => Windows/Common}/IOHandlerProcessSTDIOWindows.cpp (100%)
rename lldb/source/Plugins/Process/{Utility => Windows/Common}/IOHandlerProcessSTDIOWindows.h (100%)
diff --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index e400676df8b65..469535080f6f7 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -66,11 +66,6 @@ set(LLDB_PLUGIN_PROCESS_UTILITY_SOURCES
ThreadMemory.cpp
)
-if(WIN32)
- list(APPEND LLDB_PLUGIN_PROCESS_UTILITY_SOURCES
- IOHandlerProcessSTDIOWindows.cpp
- )
-endif()
add_lldb_library(lldbPluginProcessUtility
${LLDB_PLUGIN_PROCESS_UTILITY_SOURCES}
diff --git a/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt b/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
index 9854b79fbb8d6..bd076d5d64df1 100644
--- a/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
@@ -1,5 +1,6 @@
add_lldb_library(lldbPluginProcessWindowsCommon PLUGIN
+ IOHandlerProcessSTDIOWindows.cpp
DebuggerThread.cpp
LocalDebugDelegate.cpp
NativeProcessWindows.cpp
diff --git a/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.cpp
similarity index 100%
rename from lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.cpp
rename to lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.cpp
diff --git a/lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h b/lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.h
similarity index 100%
rename from lldb/source/Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h
rename to lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.h
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 83d9e784f75a0..ff9fe61a18eec 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -45,7 +45,7 @@
#include "ExceptionRecord.h"
#include "ForwardDecl.h"
#include "LocalDebugDelegate.h"
-#include "Plugins/Process/Utility/IOHandlerProcessSTDIOWindows.h"
+#include "IOHandlerProcessSTDIOWindows.h"
#include "ProcessWindowsLog.h"
#include "TargetThreadWindows.h"
>From b95a5b5db665e758cad9a62448059c59f33d3704 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Fri, 5 Jun 2026 12:07:27 +0100
Subject: [PATCH 4/6] fixup! move to Windows directory
---
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index ff9fe61a18eec..941c25e9ecb77 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -44,8 +44,8 @@
#include "DebuggerThread.h"
#include "ExceptionRecord.h"
#include "ForwardDecl.h"
-#include "LocalDebugDelegate.h"
#include "IOHandlerProcessSTDIOWindows.h"
+#include "LocalDebugDelegate.h"
#include "ProcessWindowsLog.h"
#include "TargetThreadWindows.h"
>From c913362c93038210a598e3b6b45d889a1d38f774 Mon Sep 17 00:00:00 2001
From: Charles Zablit <zablitcharles at gmail.com>
Date: Fri, 5 Jun 2026 16:20:50 +0100
Subject: [PATCH 5/6] Update
lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.h
Co-authored-by: Nerixyz <nero.9 at hotmail.de>
---
.../Process/Windows/Common/IOHandlerProcessSTDIOWindows.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.h b/lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.h
index fcbd587b40143..3eeab0e3d477e 100644
--- a/lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/IOHandlerProcessSTDIOWindows.h
@@ -13,7 +13,7 @@
#include "lldb/Host/File.h"
#include "lldb/Target/Process.h"
-typedef void *HANDLE;
+using HANDLE = void*;
using namespace lldb_private;
>From afd40784624acdf5d7d896eb70d0735965d8362f Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Fri, 5 Jun 2026 16:22:17 +0100
Subject: [PATCH 6/6] remove cmakelists changes
---
lldb/source/Plugins/Process/Utility/CMakeLists.txt | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index 469535080f6f7..3652a0cfb530f 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -1,7 +1,7 @@
# TODO: Clean up this directory and its dependencies
set_property(DIRECTORY PROPERTY LLDB_PLUGIN_KIND ProcessUtility)
-set(LLDB_PLUGIN_PROCESS_UTILITY_SOURCES
+add_lldb_library(lldbPluginProcessUtility
AuxVector.cpp
FreeBSDSignals.cpp
GDBRemoteSignals.cpp
@@ -64,11 +64,6 @@ set(LLDB_PLUGIN_PROCESS_UTILITY_SOURCES
RegisterInfoPOSIXDynamic_riscv32.cpp
StopInfoMachException.cpp
ThreadMemory.cpp
-)
-
-
-add_lldb_library(lldbPluginProcessUtility
- ${LLDB_PLUGIN_PROCESS_UTILITY_SOURCES}
LINK_COMPONENTS
Support
More information about the lldb-commits
mailing list