Skip to content

Commit c72c0b2

Browse files
authored
Fix race condition during iteration through modules (#139283) (#139862)
Use the locking iterator to ensure module don't change during iteration.
1 parent 2f5a24d commit c72c0b2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lldb/source/Target/Target.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,8 +1511,7 @@ bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id,
15111511

15121512
ModuleSP Target::GetExecutableModule() {
15131513
// search for the first executable in the module list
1514-
for (size_t i = 0; i < m_images.GetSize(); ++i) {
1515-
ModuleSP module_sp = m_images.GetModuleAtIndex(i);
1514+
for (ModuleSP module_sp : m_images.Modules()) {
15161515
lldb_private::ObjectFile *obj = module_sp->GetObjectFile();
15171516
if (obj == nullptr)
15181517
continue;

0 commit comments

Comments
 (0)