Author: Ebuka Ezike Date: 2026-01-28T16:51:12Z New Revision: fa3b3a0be13c3921d983375b1d0ac03d3d2b725d
URL: https://github.com/llvm/llvm-project/commit/fa3b3a0be13c3921d983375b1d0ac03d3d2b725d DIFF: https://github.com/llvm/llvm-project/commit/fa3b3a0be13c3921d983375b1d0ac03d3d2b725d.diff LOG: [lldb-dap] Fix debugger initialisation order in DAP::InitializeDebugger (#178022) Validate the debugger before assigning it to the member debugger to avoid setting an invalid debugger on error. We usually have an existing session with that debugger ends up messing with that session. Added: Modified: lldb/tools/lldb-dap/DAP.cpp Removed: ################################################################################ diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index 08afef2988c2a..ef423fe876621 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -1312,21 +1312,23 @@ void DAP::StartEventThreads() { llvm::Error DAP::InitializeDebugger(const DAPSession &session) { // Find the existing debugger by ID - debugger = lldb::SBDebugger::FindDebuggerWithID(session.debuggerId); - if (!debugger.IsValid()) { + lldb::SBDebugger found_debugger = + lldb::SBDebugger::FindDebuggerWithID(session.debuggerId); + if (!found_debugger.IsValid()) { return llvm::createStringError( "Unable to find existing debugger for debugger ID"); } // Find the target within the debugger by its globally unique ID lldb::SBTarget target = - debugger.FindTargetByGloballyUniqueID(session.targetId); + found_debugger.FindTargetByGloballyUniqueID(session.targetId); if (!target.IsValid()) { return llvm::createStringError( "Unable to find existing target for target ID"); } - // Set the target for this DAP session. + // Set the target and debugger for this DAP session. + debugger = found_debugger; SetTarget(target); StartEventThreads(); return llvm::Error::success(); _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
