Author: Ebuka Ezike
Date: 2026-07-10T09:56:22+01:00
New Revision: 83950f4c84d0b59d539f5819d67167d896eaa6a5

URL: 
https://github.com/llvm/llvm-project/commit/83950f4c84d0b59d539f5819d67167d896eaa6a5
DIFF: 
https://github.com/llvm/llvm-project/commit/83950f4c84d0b59d539f5819d67167d896eaa6a5.diff

LOG: [lldb-dap] Log the adapter's stdio during cleanup (#208432)

The adapter may crash for any reason especially if it is built with
sanitizers. Log the adapter's stdout and stderr.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/tools/lldb_dap/lldb_dap_testcase.py
    lldb/packages/Python/lldbsuite/test/tools/lldb_dap/utils.py

Removed: 
    


################################################################################
diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/lldb_dap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/lldb_dap_testcase.py
index 2b2412bcea072..ac74770e2e4bc 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/lldb_dap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/lldb_dap_testcase.py
@@ -153,6 +153,13 @@ def create_debug_adapter(
         def cleanup_adapter():
             if adapter.is_alive:
                 adapter.kill()
+            # The debug adapter may have a reason the test failed.
+            if stderr := adapter.process.stderr:
+                if err_str := stderr.read().decode():
+                    self.logger.debug("The adapter stderr: \n%s", err_str)
+            if stdout := adapter.process.stdout:
+                if err_str := stdout.read().decode():
+                    self.logger.debug("The adapter stdout: \n%s", err_str)
 
         self.addTearDownHook(cleanup_adapter)
         return adapter

diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/utils.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/utils.py
index db89d9f77ceba..61147e3e31e52 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/utils.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/utils.py
@@ -156,6 +156,7 @@ def kill(self):
             self._process.wait(timeout=2.0)
         except subprocess.TimeoutExpired:
             self._process.kill()
+            self._process.wait()
 
     def _read_listening_uri(self) -> str:
         # lldb-dap will print the listening address once the listener is


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to