================
@@ -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")
----------------
piyushjaiswal98 wrote:

This was to make sure the cleanup doesn't fail irrespective of the reason for 
DAP server crashing (due to the test in question or another cause). Cleanup 
failing could mask the real the test failure when investigating particular tests

https://github.com/llvm/llvm-project/pull/155335
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to