File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1451,16 +1451,18 @@ bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id,
14511451}
14521452
14531453ModuleSP Target::GetExecutableModule () {
1454- // search for the first executable in the module list
1455- for (size_t i = 0 ; i < m_images.GetSize (); ++i) {
1456- ModuleSP module_sp = m_images.GetModuleAtIndex (i);
1454+ std::lock_guard<std::recursive_mutex> lock (m_images.GetMutex ());
1455+
1456+ // Search for the first executable in the module list.
1457+ for (ModuleSP module_sp : m_images.ModulesNoLocking ()) {
14571458 lldb_private::ObjectFile *obj = module_sp->GetObjectFile ();
14581459 if (obj == nullptr )
14591460 continue ;
14601461 if (obj->GetType () == ObjectFile::Type::eTypeExecutable)
14611462 return module_sp;
14621463 }
1463- // as fall back return the first module loaded
1464+
1465+ // If there is none, fall back return the first module loaded.
14641466 return m_images.GetModuleAtIndex (0 );
14651467}
14661468
You can’t perform that action at this time.
0 commit comments