[Lldb-commits] [lldb] [lldb][windows] refactor FileAction (PR #179274)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 3 06:26:37 PST 2026
================
@@ -326,8 +326,12 @@ 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()));
- launch_info.AppendDuplicateFileAction((int64_t)shared_socket.GetSendableFD(),
- (int64_t)shared_socket.GetSendableFD());
+#ifdef _WIN32
+ int fd = _open_osfhandle((intptr_t)shared_socket.GetSendableFD(), NULL);
----------------
charles-zablit wrote:
I did not notice that this was in `lldb-server`, thanks!
> Probably it is possible to use lldb::file_t fd instead of int fd (pipe_t and file_t are the same). Note AppendDuplicateFileAction() and AppendOpenFileAction(), AppendCloseFileAction() use different types of descriptions now on Windows. We need to unify this type somehow.
I have tried this but I was having a hard time with all the `file_action.Open(STDIN_FILENO, ...` calls. Most call site just use `STDIN_FILENO`/`STDOUT_FILENO`/`STDERR_FILENO`. Also, the SBApi expects file descriptors, I did not think it would be good to break it.
I have pushed new changes which do not use `_open_osfhandle` at all.
https://github.com/llvm/llvm-project/pull/179274
More information about the lldb-commits
mailing list