Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lldb/tools/lldb-dap/DAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,11 @@ llvm::Error DAP::Loop() {
out.Stop();
err.Stop();
StopEventHandlers();

// 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);
});

while (true) {
Expand Down
10 changes: 1 addition & 9 deletions lldb/tools/lldb-dap/EventHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,7 @@ llvm::Error SendThreadStoppedEvent(DAP &dap, bool on_entry) {

// Send a "terminated" event to indicate the process is done being
// debugged.
void SendTerminatedEvent(DAP &dap) {
// Prevent races if the process exits while we're being asked to disconnect.
llvm::call_once(dap.terminated_event_flag, [&] {
dap.RunTerminateCommands();
// Send a "terminated" event
llvm::json::Object event(CreateTerminatedEventObject(dap.target));
dap.SendJSON(llvm::json::Value(std::move(event)));
});
}
void SendTerminatedEvent(DAP &dap) { dap.SendTerminatedEvent(); }

// Grab any STDOUT and STDERR from the process and send it up to VS Code
// via an "output" event to the "stdout" and "stderr" categories.
Expand Down
Loading