[Lldb-commits] [lldb] [lldb-dap] Destroy debugger at disconnect request (PR #156231)
Roy Shi via lldb-commits
lldb-commits at lists.llvm.org
Sun Aug 31 03:45:17 PDT 2025
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/156231
>From c35a97fb54dfc046be3bdcde2a6297603aa9b297 Mon Sep 17 00:00:00 2001
From: Roy Shi <royshi at meta.com>
Date: Sun, 31 Aug 2025 01:45:23 -0700
Subject: [PATCH] [lldb-dap] Destroy debugger when debug session terminates
---
lldb/tools/lldb-dap/DAP.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index b1ad38d983893..4226bfa83c4cf 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -901,9 +901,15 @@ void DAP::SendTerminatedEvent() {
// Prevent races if the process exits while we're being asked to disconnect.
llvm::call_once(terminated_event_flag, [&] {
RunTerminateCommands();
+
// Send a "terminated" event
llvm::json::Object event(CreateTerminatedEventObject(target));
SendJSON(llvm::json::Value(std::move(event)));
+
+ // Destroy the debugger when the session ends. This will trigger the
+ // debugger's destroy callbacks for earlier logging and clean-ups, rather
+ // than waiting for the termination of the lldb-dap process.
+ lldb::SBDebugger::Destroy(debugger);
});
}
More information about the lldb-commits
mailing list