[Lldb-commits] [lldb] [lldb] Inherit DuplicateFileAction(HANDLE, HANDLE) handles on windows (PR #137978)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 30 12:41:34 PDT 2025


================
@@ -274,10 +274,8 @@ static Status spawn_process(const char *progname, const FileSpec &prog,
   self_args.AppendArgument(llvm::StringRef("platform"));
   self_args.AppendArgument(llvm::StringRef("--child-platform-fd"));
   self_args.AppendArgument(llvm::to_string(shared_socket.GetSendableFD()));
-#ifndef _WIN32
   launch_info.AppendDuplicateFileAction((int)shared_socket.GetSendableFD(),
                                         (int)shared_socket.GetSendableFD());
----------------
slydiman wrote:

I like the overall approach. But we must work with FileAction more clearly.
ProcessLauncherWindows::GetStdioHandle() uses launch_info.GetFileActionForFD(STDOUT_FILENO) and such. It means that FileAction.m_fd is std fd. But here you stores HANDLE converted to int. We cannot store HANDLE and std fd in the same property, even if the value is < 1K and can be converted to int. We must use shared_fd_t in FileAction or a union with relevant types for different actions.

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


More information about the lldb-commits mailing list