[Lldb-commits] [lldb] Fix race condition during iteration through modules (#139283) (PR #139862)
via lldb-commits
lldb-commits at lists.llvm.org
Wed May 14 02:11:12 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: None (nd)
<details>
<summary>Changes</summary>
Lock ensures modules don't change during iteration.
---
Full diff: https://github.com/llvm/llvm-project/pull/139862.diff
1 Files Affected:
- (modified) lldb/source/Target/Target.cpp (+1)
``````````diff
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 7f61f8689fb95..485b49aeb64b4 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1510,6 +1510,7 @@ bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id,
}
ModuleSP Target::GetExecutableModule() {
+ std::lock_guard<std::recursive_mutex> guard(m_images.GetMutex());
// search for the first executable in the module list
for (size_t i = 0; i < m_images.GetSize(); ++i) {
ModuleSP module_sp = m_images.GetModuleAtIndex(i);
``````````
</details>
https://github.com/llvm/llvm-project/pull/139862
More information about the lldb-commits
mailing list