Skip to content

Commit c35a97f

Browse files
committed
[lldb-dap] Destroy debugger when debug session terminates
1 parent 62ff9ac commit c35a97f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,15 @@ void DAP::SendTerminatedEvent() {
901901
// Prevent races if the process exits while we're being asked to disconnect.
902902
llvm::call_once(terminated_event_flag, [&] {
903903
RunTerminateCommands();
904+
904905
// Send a "terminated" event
905906
llvm::json::Object event(CreateTerminatedEventObject(target));
906907
SendJSON(llvm::json::Value(std::move(event)));
908+
909+
// Destroy the debugger when the session ends. This will trigger the
910+
// debugger's destroy callbacks for earlier logging and clean-ups, rather
911+
// than waiting for the termination of the lldb-dap process.
912+
lldb::SBDebugger::Destroy(debugger);
907913
});
908914
}
909915

0 commit comments

Comments
 (0)