https://github.com/ashgti updated 
https://github.com/llvm/llvm-project/pull/133811

>From 9053618204265ea71a6a30382937cff584f8c02d Mon Sep 17 00:00:00 2001
From: John Harrison <harj...@google.com>
Date: Mon, 31 Mar 2025 14:36:16 -0700
Subject: [PATCH 1/2] [lldb-dap] Do not take ownership of stdin.

There isn't any benefit to taking ownership of stdin and it may cause issues if 
`Transport` is dealloced.
---
 lldb/tools/lldb-dap/lldb-dap.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 062c3a5f989f3..a1d4f4f92e625 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -571,7 +571,7 @@ int main(int argc, char *argv[]) {
   }
 
   lldb::IOObjectSP input = std::make_shared<NativeFile>(
-      fileno(stdin), File::eOpenOptionReadOnly, true);
+      fileno(stdin), File::eOpenOptionReadOnly, false);
   lldb::IOObjectSP output = std::make_shared<NativeFile>(
       stdout_fd, File::eOpenOptionWriteOnly, false);
 

>From c695e60634d42b58a169f3afc1a683d201f4c3b4 Mon Sep 17 00:00:00 2001
From: John Harrison <harj...@google.com>
Date: Mon, 31 Mar 2025 15:42:06 -0700
Subject: [PATCH 2/2] Using `NativeFile::Unowned` instead of `false`.

---
 lldb/tools/lldb-dap/lldb-dap.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index a1d4f4f92e625..b91c62e921428 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -571,9 +571,9 @@ int main(int argc, char *argv[]) {
   }
 
   lldb::IOObjectSP input = std::make_shared<NativeFile>(
-      fileno(stdin), File::eOpenOptionReadOnly, false);
+      fileno(stdin), File::eOpenOptionReadOnly, NativeFile::Unowned);
   lldb::IOObjectSP output = std::make_shared<NativeFile>(
-      stdout_fd, File::eOpenOptionWriteOnly, false);
+      stdout_fd, File::eOpenOptionWriteOnly, NativeFile::Unowned);
 
   constexpr llvm::StringLiteral client_name = "stdin/stdout";
   Transport transport(client_name, log.get(), input, output);

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to