Skip to content

Commit ee07d86

Browse files
Merge pull request #10436 from felipepiovezan/felipe/thread_safe_cherry-pick
[cherry-pick][lldb] Make `RegisterContextThreadMemory` thread safe (llvm#134469)
2 parents 20b1136 + 8f4b819 commit ee07d86

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ RegisterContextThreadMemory::RegisterContextThreadMemory(
2525
RegisterContextThreadMemory::~RegisterContextThreadMemory() = default;
2626

2727
void RegisterContextThreadMemory::UpdateRegisterContext() {
28+
std::lock_guard<std::mutex> lock(m_update_register_ctx_lock);
29+
2830
ThreadSP thread_sp(m_thread_wp.lock());
2931
if (thread_sp) {
3032
ProcessSP process_sp(thread_sp->GetProcess());

lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class RegisterContextThreadMemory : public lldb_private::RegisterContext {
9999
RegisterContextThreadMemory(const RegisterContextThreadMemory &) = delete;
100100
const RegisterContextThreadMemory &
101101
operator=(const RegisterContextThreadMemory &) = delete;
102+
103+
std::mutex m_update_register_ctx_lock;
102104
};
103105

104106
} // namespace lldb_private

0 commit comments

Comments
 (0)