[Lldb-commits] [lldb] [lldb-dap] Improving lldbdap_testcase.py error diagnosability and adding exception handling for dap server disconnect and terminations (PR #155335)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 25 17:51:31 PDT 2025


================
@@ -466,8 +466,15 @@ def attach(
         # if we throw an exception during the test case.
         def cleanup():
             if disconnectAutomatically:
-                self.dap_server.request_disconnect(terminateDebuggee=True)
-            self.dap_server.terminate()
+                try:
+                    self.dap_server.request_disconnect(terminateDebuggee=True)
+                except (ValueError, TimeoutError, BrokenPipeError, ConnectionError, Exception) as e:
+                    # DAP server might not be responsive, skip disconnect and terminate directly
+                    print(f"Warning: disconnect failed ({e}), skipping and terminating directly")
+            try:
+                self.dap_server.terminate()
+            except Exception as e:
+                print(f"Warning: terminate failed ({e}), DAP server may have already died")
----------------
JDevlieghere wrote:

Do we not want the test to fail when this happens? 

https://github.com/llvm/llvm-project/pull/155335


More information about the lldb-commits mailing list