From d6b32e7dfed6901e2ed8180ddc80d5ba22a02f8e Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 11 Mar 2026 08:50:54 -0700 Subject: [PATCH] [Dexter] Add missing calls to SBDebugger::{Initialize,Terminate} (#185535) When using LLDB, the first and last call should be SBDebugger::Initialize and SBDebugger::Terminate respectively. While we're resilient against mistakes, I'm adding an assert (#185162) to debug builds to catch those mistakes in-tree as they have the potential to leak resources. The assert was tripped by Dexter. This PR adds the missing calls to SBDebugger::{Initialize,Terminate}, and while I was at it, I also added a missing call to SBDebugger::Destroy. With that, the Dexter tests pass locally with the assert enabled. --- .../debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py index 73b2a4dd36d0..17a22eb662ca 100644 --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py @@ -32,6 +32,12 @@ class LLDB(DebuggerBase): # condition. See get_triggered_breakpoint_ids usage for more info. self._breakpoint_conditions = {} super(LLDB, self).__init__(context, *args) + if self.has_loaded: + self._interface.SBDebugger.Initialize() + + def __del__(self): + if self.has_loaded: + self._interface.SBDebugger.Terminate() def _custom_init(self): self._debugger = self._interface.SBDebugger.Create() @@ -49,8 +55,10 @@ class LLDB(DebuggerBase): def _custom_exit(self): if getattr(self, "_process", None): self._process.Kill() - if getattr(self, "_debugger", None) and getattr(self, "_target", None): - self._debugger.DeleteTarget(self._target) + if getattr(self, "_debugger", None): + if getattr(self, "_target", None): + self._debugger.DeleteTarget(self._target) + self._interface.SBDebugger.Destroy(self._debugger) def _translate_stop_reason(self, reason): if reason == self._interface.eStopReasonNone: