[Lldb-commits] [lldb] [lldb-dap] Adding exception handling for dap server disconnect and terminations in lldbdap_testcase.py (PR #155335)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 26 09:14:04 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:
----------------
ashgti wrote:

We could add both of these as two distinct cleanups. Exceptions thrown in a `addTearDownHook` are logged already, but I think the goal of this change is to ensure the .terminate is called. The hooks are called in FIFO order, so we could change this to:

```
if disconnectAutomatically:
  self.addTearDownHook(lambda: self.dap_server.request_disconnect(terminateDebuggee=True))
self.addTearDownHook(lambda: self.dap_server.terminate())
```

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


More information about the lldb-commits mailing list