Author: Felipe de Azevedo Piovezan Date: 2025-04-04T18:43:31-07:00 New Revision: 6272e1f37e0710b51d38cb98b905a3f2ffea7966
URL: https://github.com/llvm/llvm-project/commit/6272e1f37e0710b51d38cb98b905a3f2ffea7966 DIFF: https://github.com/llvm/llvm-project/commit/6272e1f37e0710b51d38cb98b905a3f2ffea7966.diff LOG: [lldb] Make `RegisterContextThreadMemory` thread safe (#134469) The UpdateRegisterContext method can be called from multiple threads. Added: Modified: lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp index 75438550ce914..29927e3b5e4ed 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp @@ -25,6 +25,8 @@ RegisterContextThreadMemory::RegisterContextThreadMemory( RegisterContextThreadMemory::~RegisterContextThreadMemory() = default; void RegisterContextThreadMemory::UpdateRegisterContext() { + std::lock_guard<std::mutex> lock(m_update_register_ctx_lock); + ThreadSP thread_sp(m_thread_wp.lock()); if (thread_sp) { ProcessSP process_sp(thread_sp->GetProcess()); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h index 23f675508cf38..1df32bbc1f057 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h @@ -99,6 +99,8 @@ class RegisterContextThreadMemory : public lldb_private::RegisterContext { RegisterContextThreadMemory(const RegisterContextThreadMemory &) = delete; const RegisterContextThreadMemory & operator=(const RegisterContextThreadMemory &) = delete; + + std::mutex m_update_register_ctx_lock; }; } // namespace lldb_private _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits