[Lldb-commits] [lldb] [lldb][Process/FreeBSDKernelCore] Rework plugin destruction (PR #188426)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 25 03:09:45 PDT 2026


================
@@ -67,8 +67,13 @@ ProcessFreeBSDKernelCore::ProcessFreeBSDKernelCore(lldb::TargetSP target_sp,
     : PostMortemProcess(target_sp, listener_sp, core_file), m_kvm(kvm) {}
 
 ProcessFreeBSDKernelCore::~ProcessFreeBSDKernelCore() {
-  if (m_kvm)
-    kvm_close(m_kvm);
+  m_thread_list.Clear();
+
+  // We need to call finalize on the process before destroying ourselves to
+  // make sure all of the broadcaster cleanup goes as planned. If we destruct
+  // this class, then Process::~Process() might have problems trying to fully
+  // destroy the broadcaster.
+  Finalize(true /* destructing */);
----------------
DavidSpickett wrote:

Use the form `/*foo=*/true` instead. This is more common in llvm.

(I know you copied that from elf core though, which is much older code)

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


More information about the lldb-commits mailing list