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().


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to