diff options
| author | Jason Molenda <jmolenda@apple.com> | 2019-04-08 23:03:02 +0000 |
|---|---|---|
| committer | Jason Molenda <jmolenda@apple.com> | 2019-04-08 23:03:02 +0000 |
| commit | 1724a179e7ae2d0485f0fc8fee7ac3a18cc29152 (patch) | |
| tree | 87bbd2f536267e1116e4243d67fe446449be3c35 /lldb/source/Plugins/DynamicLoader | |
| parent | e794752bdfb334b64b2d356e9c0444572ad19da1 (diff) | |
| download | bcm5719-llvm-1724a179e7ae2d0485f0fc8fee7ac3a18cc29152.tar.gz bcm5719-llvm-1724a179e7ae2d0485f0fc8fee7ac3a18cc29152.zip | |
Rename Target::GetSharedModule to Target::GetOrCreateModule.
Add a flag to control whether the ModulesDidLoad notification is
called when a module is added. If the notifications are disabled,
the caller must call ModulesDidLoad after adding all the new modules,
but postponing this notification until they're all batched up can
allow for better efficiency than notifying one-by-one.
Change the name of the ModuleList notifier functions that a subclass
can implement to start with 'Notify' to make it clear what they are.
Add a NotifyModulesRemoved.
Add header documentation for the changed/updated methods.
Added defaulted-value 'notify' argument to ModuleList Append,
AppendIfNeeded, and Remove because callers working with a local
ModuleList don't have an obvious idea of what notify means in this
context. When the ModuleList is a part of the Target class, the
notify behavior matters.
DynamicLoaderDarwin has been updated so that libraries being
added/removed are correctly batched up before notifications are
sent. Added the TestModuleLoadedNotifys.py test to run on
Darwin to test this.
<rdar://problem/48293064>
Differential Revision: https://reviews.llvm.org/D60172
llvm-svn: 357955
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader')
5 files changed, 11 insertions, 9 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index d88ce1c9fb7..45f6d49577c 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -841,7 +841,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule( // the DebugSymbols framework with the UUID to find the binary via its // search methods. if (!m_module_sp) { - m_module_sp = target.GetSharedModule(module_spec); + m_module_sp = target.GetOrCreateModule(module_spec, true /* notify */); } if (IsKernel() && !m_module_sp) { diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index e6deab8cd27..0fb05e99a07 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -199,7 +199,7 @@ ModuleSP DynamicLoaderHexagonDYLD::GetTargetExecutable() { return executable; // TODO: What case is this code used? - executable = target.GetSharedModule(module_spec); + executable = target.GetOrCreateModule(module_spec, true /* notify */); if (executable.get() != target.GetExecutableModulePointer()) { // Don't load dependent images since we are in dyld where we will know and // find out about all images that are loaded diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 87e43eb6027..086169d1336 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -122,7 +122,9 @@ ModuleSP DynamicLoaderDarwin::FindTargetModuleForImageInfo( if (!module_sp) { if (can_create) { - module_sp = target.GetSharedModule(module_spec); + // We'll call Target::ModulesDidLoad after all the modules have been + // added to the target, don't let it be called for every one. + module_sp = target.GetOrCreateModule(module_spec, false /* notify */); if (!module_sp || module_sp->GetObjectFile() == NULL) module_sp = m_process->ReadModuleFromMemory(image_info.file_spec, image_info.address); @@ -637,7 +639,8 @@ bool DynamicLoaderDarwin::AddModulesUsingImageInfos( module_spec.SetObjectOffset(objfile->GetFileOffset() + commpage_section->GetFileOffset()); module_spec.SetObjectSize(objfile->GetByteSize()); - commpage_image_module_sp = target.GetSharedModule(module_spec); + commpage_image_module_sp = target.GetOrCreateModule(module_spec, + true /* notify */); if (!commpage_image_module_sp || commpage_image_module_sp->GetObjectFile() == NULL) { commpage_image_module_sp = m_process->ReadModuleFromMemory( diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 6583a809efc..31ab9faca70 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -543,7 +543,8 @@ ModuleSP DynamicLoaderPOSIXDYLD::LoadInterpreterModule() { FileSpec file(info.GetName().GetCString()); ModuleSpec module_spec(file, target.GetArchitecture()); - if (ModuleSP module_sp = target.GetSharedModule(module_spec)) { + if (ModuleSP module_sp = target.GetOrCreateModule(module_spec, + true /* notify */)) { UpdateLoadedSections(module_sp, LLDB_INVALID_ADDRESS, m_interpreter_base, false); return module_sp; diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp index a2a17b2d4bd..fa3fbe0d9fa 100644 --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -68,11 +68,9 @@ void DynamicLoaderWindowsDYLD::OnLoadModule(lldb::ModuleSP module_sp, // Resolve the module unless we already have one. if (!module_sp) { - // Confusingly, there is no Target::AddSharedModule. Instead, calling - // GetSharedModule() with a new module will add it to the module list and - // return a corresponding ModuleSP. Status error; - module_sp = m_process->GetTarget().GetSharedModule(module_spec, &error); + module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, + true /* notify */, &error); if (error.Fail()) return; } |

