diff options
| author | nd <dmitry.neverov@gmail.com> | 2025-05-16 18:09:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-16 09:09:50 -0700 |
| commit | c72c0b298c13ebc4d374e84b8ea20f8ca4f5ace2 (patch) | |
| tree | 9c726df675ac23372ea7df154e256d04fe4c542c /lldb/source/Target/Target.cpp | |
| parent | 2f5a24d0c555832ec6e5747cc7bad814ed97cbdc (diff) | |
Fix race condition during iteration through modules (#139283) (#139862)
Use the locking iterator to ensure module don't change during iteration.
Diffstat (limited to 'lldb/source/Target/Target.cpp')
| -rw-r--r-- | lldb/source/Target/Target.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 7f61f8689fb9..9660fc97970b 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -1511,8 +1511,7 @@ bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id, ModuleSP Target::GetExecutableModule() { // 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); + for (ModuleSP module_sp : m_images.Modules()) { lldb_private::ObjectFile *obj = module_sp->GetObjectFile(); if (obj == nullptr) continue; |
