[Lldb-commits] [lldb] [LLDB][Windows]: Don't pass duplicate HANDLEs to CreateProcess (PR #165281)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 27 10:18:11 PDT 2025
https://github.com/lb90 created https://github.com/llvm/llvm-project/pull/165281
Fixes https://github.com/msys2/MINGW-packages/issues/26030
>From 65250c73d14cb98b918fa586dd0dee9d7738241b Mon Sep 17 00:00:00 2001
From: Luca Bacci <luca.bacci982 at gmail.com>
Date: Mon, 27 Oct 2025 18:06:40 +0100
Subject: [PATCH] [LLDB][Windows]: Don't pass duplicate HANDLEs to
CreateProcess
Fixes https://github.com/msys2/MINGW-packages/issues/26030
---
lldb/source/Host/windows/ProcessLauncherWindows.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index f5adadaf061bf..ab151f1a9a0ac 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -15,6 +15,7 @@
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Program.h"
+#include <algorithm>
#include <string>
#include <vector>
@@ -122,6 +123,11 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
act->GetFD() == act->GetActionArgument())
inherited_handles.push_back(reinterpret_cast<HANDLE>(act->GetFD()));
}
+ // Remove duplicate HANDLEs
+ std::sort(inherited_handles.begin(), inherited_handles.end());
+ inherited_handles.erase(
+ std::unique(inherited_handles.begin(), inherited_handles.end()),
+ inherited_handles.end());
if (!inherited_handles.empty()) {
if (!UpdateProcThreadAttribute(
startupinfoex.lpAttributeList, /*dwFlags=*/0,
More information about the lldb-commits
mailing list