Fix race condition during iteration through modules (#139283) (#139862)

Use the locking iterator to ensure module don't change during iteration.
This commit is contained in:
nd
2025-05-16 18:09:50 +02:00
committed by GitHub
parent 2f5a24d0c5
commit c72c0b298c

View File

@@ -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;