Skip to content

Commit 3b48e2a

Browse files
authored
[lldb-dap] Ensure we acquire the SB API lock while handling requests. (llvm#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.
1 parent dbb8434 commit 3b48e2a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lldb/tools/lldb-dap/Handler/RequestHandler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "Protocol/ProtocolBase.h"
1515
#include "RunInTerminal.h"
1616
#include "llvm/Support/Error.h"
17+
#include <mutex>
1718

1819
#if !defined(_WIN32)
1920
#include <unistd.h>
@@ -180,6 +181,9 @@ void BaseRequestHandler::Run(const Request &request) {
180181
return;
181182
}
182183

184+
lldb::SBMutex lock = dap.GetAPIMutex();
185+
std::lock_guard<lldb::SBMutex> guard(lock);
186+
183187
// FIXME: After all the requests have migrated from LegacyRequestHandler >
184188
// RequestHandler<> we should be able to move this into
185189
// RequestHandler<>::operator().

0 commit comments

Comments
 (0)