summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorStella Stamenova <stilis@microsoft.com>2019-02-15 21:40:59 +0000
committerStella Stamenova <stilis@microsoft.com>2019-02-15 21:40:59 +0000
commita2d9fdf5b65ab1b17409d7a7eae74802cb569c5d (patch)
tree053ab4c8efee2cba8b2ffe4e9ac9a63281918345 /lldb/source/Plugins
parent8220ecbce1a42410f07f0f3ea546661f76a6b896 (diff)
downloadbcm5719-llvm-a2d9fdf5b65ab1b17409d7a7eae74802cb569c5d.tar.gz
bcm5719-llvm-a2d9fdf5b65ab1b17409d7a7eae74802cb569c5d.zip
[win] Resolve the module only if there isn't one already
Summary: This commit modifies the OnLoadModule method to resolve the module unless we already have one Change by Hui Huang to fix the failing LLDB tests on Windows Reviewers: labath, asmith Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D58303 llvm-svn: 354172
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp28
-rw-r--r--lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h3
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp6
3 files changed, 23 insertions, 14 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
index f45d7116dcf..a2a17b2d4bd 100644
--- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -62,19 +62,26 @@ DynamicLoader *DynamicLoaderWindowsDYLD::CreateInstance(Process *process,
return nullptr;
}
-void DynamicLoaderWindowsDYLD::OnLoadModule(const ModuleSpec &module_spec,
+void DynamicLoaderWindowsDYLD::OnLoadModule(lldb::ModuleSP module_sp,
+ const ModuleSpec module_spec,
lldb::addr_t module_addr) {
- // 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;
- ModuleSP module_sp =
- m_process->GetTarget().GetSharedModule(module_spec, &error);
- if (error.Fail())
- return;
+
+ // 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);
+ if (error.Fail())
+ return;
+ }
m_loaded_modules[module_sp] = module_addr;
UpdateLoadedSectionsCommon(module_sp, module_addr, false);
+ ModuleList module_list;
+ module_list.Append(module_sp);
+ m_process->GetTarget().ModulesDidLoad(module_list);
}
void DynamicLoaderWindowsDYLD::OnUnloadModule(lldb::addr_t module_addr) {
@@ -86,6 +93,9 @@ void DynamicLoaderWindowsDYLD::OnUnloadModule(lldb::addr_t module_addr) {
if (module_sp) {
m_loaded_modules.erase(module_sp);
UnloadSectionsCommon(module_sp);
+ ModuleList module_list;
+ module_list.Append(module_sp);
+ m_process->GetTarget().ModulesDidUnload(module_list, false);
}
}
diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h
index ef859255db1..100689a6312 100644
--- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h
+++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h
@@ -29,7 +29,8 @@ public:
static DynamicLoader *CreateInstance(Process *process, bool force);
- void OnLoadModule(const ModuleSpec &module_spec, lldb::addr_t module_addr);
+ void OnLoadModule(lldb::ModuleSP module_sp, const ModuleSpec module_spec,
+ lldb::addr_t module_addr);
void OnUnloadModule(lldb::addr_t module_addr);
void DidAttach() override;
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index f3e8b7f0916..2a248f63f95 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -924,9 +924,7 @@ void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) {
}
if (auto dyld = GetDynamicLoader())
- dyld->OnLoadModule(
- ModuleSpec(module->GetFileSpec(), module->GetArchitecture()),
- image_base);
+ dyld->OnLoadModule(module, ModuleSpec(), image_base);
// Add the main executable module to the list of pending module loads. We
// can't call GetTarget().ModulesDidLoad() here because we still haven't
@@ -1033,7 +1031,7 @@ void ProcessWindows::OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) {
void ProcessWindows::OnLoadDll(const ModuleSpec &module_spec,
lldb::addr_t module_addr) {
if (auto dyld = GetDynamicLoader())
- dyld->OnLoadModule(module_spec, module_addr);
+ dyld->OnLoadModule(nullptr, module_spec, module_addr);
}
void ProcessWindows::OnUnloadDll(lldb::addr_t module_addr) {
OpenPOWER on IntegriCloud