[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 14 10:14:14 PDT 2025
================
@@ -423,34 +493,66 @@ void DynamicLoaderPOSIXDYLD::RefreshModules() {
E = m_rendezvous.end();
m_initial_modules_added = true;
}
- for (; I != E; ++I) {
- // Don't load a duplicate copy of ld.so if we have already loaded it
- // earlier in LoadInterpreterModule. If we instead loaded then unloaded it
- // later, the section information for ld.so would be removed. That
- // information is required for placing breakpoints on Arm/Thumb systems.
- if ((m_interpreter_module.lock() != nullptr) &&
- (I->base_addr == m_interpreter_base))
- continue;
-
- ModuleSP module_sp =
- LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);
- if (!module_sp.get())
- continue;
-
- if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress(
- &m_process->GetTarget()) == m_interpreter_base) {
- ModuleSP interpreter_sp = m_interpreter_module.lock();
- if (m_interpreter_module.lock() == nullptr) {
- m_interpreter_module = module_sp;
- } else if (module_sp == interpreter_sp) {
- // Module already loaded.
- continue;
- }
- }
- loaded_modules.AppendIfNeeded(module_sp);
- new_modules.Append(module_sp);
+ std::mutex interpreter_module_mutex;
----------------
JDevlieghere wrote:
Maybe add a comment here too to specify what this is protecting. I didn't know what the "interpreter module" was when I first read this, but admittedly that's because I'm not that familiar with the POSIX loader.
```suggestion
// Synchronize access to m_interpreter_module.
std::mutex interpreter_module_mutex;
```
https://github.com/llvm/llvm-project/pull/130912
More information about the lldb-commits
mailing list