[Lldb-commits] [lldb] [llvm] [lldb][windows] add Windows Virtual Console support (PR #168729)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 17 08:02:33 PST 2025
================
@@ -0,0 +1,135 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "lldb/Host/windows/PseudoConsole.h"
+
+#include <mutex>
+
+#include "lldb/Host/windows/windows.h"
+
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/Errno.h"
+
+using namespace lldb_private;
+
+typedef HRESULT(WINAPI *CreatePseudoConsole_t)(COORD size, HANDLE hInput,
+ HANDLE hOutput, DWORD dwFlags,
+ HPCON *phPC);
+
+typedef HRESULT(WINAPI *ResizePseudoConsole_t)(HPCON hPC, COORD size);
+
+typedef VOID(WINAPI *ClosePseudoConsole_t)(HPCON hPC);
+
+class ConPTY {
+public:
+ static bool Initialize() {
+ std::lock_guard<std::mutex> guard(m_initialized_mutex);
+
+ if (!m_initialized) {
+ m_initialized = true;
+
+ HMODULE hMod = LoadLibraryW(L"kernel32.dll");
+ if (!hMod) {
+ return false;
+ }
+
+ pCreate =
+ (CreatePseudoConsole_t)GetProcAddress(hMod, "CreatePseudoConsole");
+ pClose = (ClosePseudoConsole_t)GetProcAddress(hMod, "ClosePseudoConsole");
----------------
charles-zablit wrote:
This is much better, thanks!
https://github.com/llvm/llvm-project/pull/168729
More information about the lldb-commits
mailing list