Skip to content

Commit 6e3ec6c

Browse files
Apply suggestions from code review
Co-authored-by: Jonas Devlieghere <[email protected]>
1 parent 931b3fb commit 6e3ec6c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lldb/tools/lldb-dap/DAP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ struct DAP {
207207
/// The set of features supported by the connected client.
208208
llvm::DenseSet<ClientFeature> clientFeatures;
209209

210-
/// The initial thread list upon attaching
210+
/// The initial thread list upon attaching.
211211
std::optional<llvm::json::Array> initial_thread_list;
212212

213213
/// Creates a new DAP sessions.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ void ThreadsRequestHandler::operator()(
6363
if (dap.initial_thread_list) {
6464
threads = dap.initial_thread_list.value();
6565
dap.initial_thread_list.reset();
66-
} else
66+
} else {
6767
threads = GetThreads(dap.target.GetProcess(), dap.thread_format);
68+
}
6869

6970
if (threads.size() == 0) {
7071
response["success"] = llvm::json::Value(false);

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,9 @@ llvm::json::Value CreateThread(lldb::SBThread &thread, lldb::SBFormat &format) {
871871
}
872872

873873
llvm::json::Array GetThreads(lldb::SBProcess process, lldb::SBFormat &format) {
874+
lldb::SBMutex lock = process.GetTarget().GetAPIMutex();
875+
std::lock_guard<lldb::SBMutex> guard(lock);
876+
874877
llvm::json::Array threads;
875878
const uint32_t num_threads = process.GetNumThreads();
876879
for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) {

0 commit comments

Comments
 (0)