aboutsummaryrefslogtreecommitdiff
path: root/lldb/tools/lldb-server/lldb-platform.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2025-05-12 07:57:43 +0200
committerGitHub <noreply@github.com>2025-05-12 07:57:43 +0200
commit9e44f0d669c116e896845d08ca603ca4f46be1db (patch)
treed291875672bccca2debc1b3ef3d4c6d7efcfda8c /lldb/tools/lldb-server/lldb-platform.cpp
parent80c61dec2d2b7b2c4f7aca378ccf621033b00c68 (diff)
downloadllvm-9e44f0d669c116e896845d08ca603ca4f46be1db.zip
llvm-9e44f0d669c116e896845d08ca603ca4f46be1db.tar.gz
llvm-9e44f0d669c116e896845d08ca603ca4f46be1db.tar.bz2
Reapply "[lldb] Inherit DuplicateFileAction(HANDLE, HANDLE) handles on windows (#137978)" (#138896)
This reverts commit https://github.com/llvm/llvm-project/commit/a0260a95ece74733ada00b19d8b1930dde462a66, reapplying https://github.com/llvm/llvm-project/commit/7c5f5f3ef83b1d1d43d63862a8431af3dded15bb, with a fix that makes *both* pipe handles inheritable. The original commit description was: This is a follow-up to https://github.com/llvm/llvm-project/pull/126935, which enables passing handles to a child process on windows systems. Unlike on unix-like systems, the handles need to be created with the "inheritable" flag because there's to way to change the flag value after it has been created. This is why I don't respect the child_process_inherit flag but rather always set the flag to true. (My next step is to delete the flag entirely.) This does mean that pipe may be created as inheritable even if its not necessary, but I think this is offset by the fact that windows (unlike unixes, which pass all ~O_CLOEXEC descriptors through execve and *all* descriptors through fork) has a way to specify the precise set of handles to pass to a specific child process. If this turns out to be insufficient, instead of a constructor flag, I'd rather go with creating a separate api to create an inheritable copy of a handle (as typically, you only want to inherit one end of the pipe).
Diffstat (limited to 'lldb/tools/lldb-server/lldb-platform.cpp')
-rw-r--r--lldb/tools/lldb-server/lldb-platform.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index 10d79c6..5b0a8ad 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -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());
-#endif
if (gdb_port) {
self_args.AppendArgument(llvm::StringRef("--gdbserver-port"));
self_args.AppendArgument(llvm::to_string(gdb_port));