[Lldb-commits] [lldb] 3b48e2a - [lldb-dap] Ensure we acquire the SB API lock while handling requests. (#137026)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 23 11:02:36 PDT 2025
Author: John Harrison
Date: 2025-04-23T11:02:33-07:00
New Revision: 3b48e2a7508ab090b1b7c6a68f87e3eddad5473d
URL: https://github.com/llvm/llvm-project/commit/3b48e2a7508ab090b1b7c6a68f87e3eddad5473d
DIFF: https://github.com/llvm/llvm-project/commit/3b48e2a7508ab090b1b7c6a68f87e3eddad5473d.diff
LOG: [lldb-dap] Ensure we acquire the SB API lock while handling requests. (#137026)
Acquiring the lock for the target should help ensure consistency with
other background operations, like the thread monitoring events that can
trigger run commands from a different thread.
Added:
Modified:
lldb/tools/lldb-dap/Handler/RequestHandler.cpp
Removed:
################################################################################
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
index 3520dc2c71a55..be9273963654a 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
@@ -14,6 +14,7 @@
#include "Protocol/ProtocolBase.h"
#include "RunInTerminal.h"
#include "llvm/Support/Error.h"
+#include <mutex>
#if !defined(_WIN32)
#include <unistd.h>
@@ -180,6 +181,9 @@ void BaseRequestHandler::Run(const Request &request) {
return;
}
+ lldb::SBMutex lock = dap.GetAPIMutex();
+ std::lock_guard<lldb::SBMutex> guard(lock);
+
// FIXME: After all the requests have migrated from LegacyRequestHandler >
// RequestHandler<> we should be able to move this into
// RequestHandler<>::operator().
More information about the lldb-commits
mailing list