diff options
| author | Jim Ingham <jingham@apple.com> | 2011-08-03 01:03:17 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2011-08-03 01:03:17 +0000 |
| commit | b53cb271ca371737a0114cb5b61688e6f523e73e (patch) | |
| tree | be7eb8078b6203731dd69d8b308cba44afa9e5b9 /lldb/source/Plugins/DynamicLoader | |
| parent | e716ae02a9e1178a9e2c386fa6220b65a7329cfb (diff) | |
| download | bcm5719-llvm-b53cb271ca371737a0114cb5b61688e6f523e73e.tar.gz bcm5719-llvm-b53cb271ca371737a0114cb5b61688e6f523e73e.zip | |
Add method Module::IsLoadedInTarget, and then in the MacOS X dynamic loader, after we
have initialized our shared library state, discard all the modules that didn't make
it into the running process.
llvm-svn: 136755
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader')
| -rw-r--r-- | lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 5f1d6a411cd..4eec4c866ef 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -947,6 +947,36 @@ DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos () } } } + + // Now we have one more bit of business. If there is a library left in the images for our target that + // doesn't have a load address, then it must be something that we were expecting to load (for instance we + // read a load command for it) but it didn't in fact load - probably because DYLD_*_PATH pointed + // to an equivalent version. We don't want it to stay in the target's module list or it will confuse + // us, so unload it here. + Target *target = m_process->CalculateTarget(); + ModuleList &modules = target->GetImages(); + ModuleList not_loaded_modules; + size_t num_modules = modules.GetSize(); + for (size_t i = 0; i < num_modules; i++) + { + ModuleSP module_sp = modules.GetModuleAtIndex(i); + if (!module_sp->IsLoadedInTarget (target)) + { + if (log) + { + StreamString s; + module_sp->GetDescription (&s); + log->Printf ("Unloading pre-run module: %s.", s.GetData ()); + } + not_loaded_modules.Append (module_sp); + } + } + + if (not_loaded_modules.GetSize() != 0) + { + target->ModulesDidUnload(not_loaded_modules); + } + return true; } else |

