================ @@ -671,8 +695,33 @@ void DAP::SetTarget(const lldb::SBTarget target) { } } -bool DAP::HandleObject(const protocol::Message &M) { - if (const auto *req = std::get_if<protocol::Request>(&M)) { +bool DAP::HandleObject(const Message &M) { + if (const auto *req = std::get_if<Request>(&M)) { + { + std::lock_guard<std::mutex> lock(m_active_request_mutex); + m_active_request = req; + } + + auto cleanup = llvm::make_scope_exit([&]() { + std::scoped_lock<std::mutex> active_request_lock(m_active_request_mutex); + m_active_request = nullptr; + }); + + { + // If there is a pending cancelled request, preempt the request and mark + // it cancelled. + std::lock_guard<std::mutex> lock(m_cancelled_requests_mutex); + if (m_cancelled_requests.find(req->seq) != m_cancelled_requests.end()) { + Response cancelled = CancelledResponse(req->seq, req->command); + Send(cancelled); + return true; + } + } + + // Clear interrupt marker prior to handling the next request. + if (debugger.InterruptRequested()) + debugger.CancelInterruptRequest(); ---------------- ashgti wrote:
Moved this up to 702 https://github.com/llvm/llvm-project/pull/130169 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits