https://github.com/da-viper updated 
https://github.com/llvm/llvm-project/pull/137002

>From 8838b06036fb3420ab39491b23500b18066f2f28 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimy...@gmail.com>
Date: Wed, 23 Apr 2025 15:49:01 +0100
Subject: [PATCH 1/2] [lldb][lldb-dap] Redirect LLDB's messages to the right
 output category.

Based on the DAP specification.
The output categories stdout and stderr should only be used for the debuggee's 
stdout and stderr.

Signed-off-by: Ebuka Ezike <yerimy...@gmail.com>
---
 lldb/tools/lldb-dap/DAP.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 134762711b89d..7fc29838e9ebb 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -209,12 +209,12 @@ llvm::Error DAP::ConfigureIO(std::FILE *overrideOut, 
std::FILE *overrideErr) {
   in = lldb::SBFile(std::fopen(DEV_NULL, "r"), /*transfer_ownership=*/true);
 
   if (auto Error = out.RedirectTo(overrideOut, [this](llvm::StringRef output) {
-        SendOutput(OutputType::Stdout, output);
+        SendOutput(OutputType::Console, output);
       }))
     return Error;
 
   if (auto Error = err.RedirectTo(overrideErr, [this](llvm::StringRef output) {
-        SendOutput(OutputType::Stderr, output);
+        SendOutput(OutputType::Console, output);
       }))
     return Error;
 

>From 583406259905a1ba37f07cb48306e17d8a285d8d Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimy...@gmail.com>
Date: Fri, 25 Apr 2025 11:49:53 +0100
Subject: [PATCH 2/2] [lldb][lldb-dap] update the test case to use the correct
 output category.

---
 lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py | 2 +-
 lldb/test/API/tools/lldb-dap/output/TestDAP_output.py | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py 
b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py
index ca4cc0ee2f77a..479a91208a66c 100644
--- a/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py
+++ b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py
@@ -82,7 +82,7 @@ def test_inflight_request(self):
 
         blocking_seq = self.async_blocking_request(duration=self.timeoutval / 
2)
         # Wait for the sleep to start to cancel the inflight request.
-        self.collect_stdout(
+        self.collect_console(
             timeout_secs=self.timeoutval,
             pattern="starting sleep",
         )
diff --git a/lldb/test/API/tools/lldb-dap/output/TestDAP_output.py 
b/lldb/test/API/tools/lldb-dap/output/TestDAP_output.py
index fe54511d1e21f..49131ad9ecb17 100644
--- a/lldb/test/API/tools/lldb-dap/output/TestDAP_output.py
+++ b/lldb/test/API/tools/lldb-dap/output/TestDAP_output.py
@@ -40,7 +40,12 @@ def test_output(self):
         output += 
self.get_stdout(timeout=lldbdap_testcase.DAPTestCaseBase.timeoutval)
         self.assertTrue(output and len(output) > 0, "expect program stdout")
         self.assertIn(
-            "abcdefghi\r\nhello world\r\nfinally\0\0out\0\0\r\nerr\0\0",
+            "abcdefghi\r\nhello world\r\nfinally\0\0",
             output,
             "full stdout not found in: " + repr(output),
         )
+        console = self.get_console(timeout=self.timeoutval)
+        self.assertTrue(console and len(console) > 0, "expect dap messages")
+        self.assertIn(
+            "out\0\0\r\nerr\0\0\r\n", console, f"full console message not 
found"
+        )

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

Reply via email to