summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Windows
diff options
context:
space:
mode:
authorAaron Smith <aaron.smith@microsoft.com>2019-02-15 04:32:50 +0000
committerAaron Smith <aaron.smith@microsoft.com>2019-02-15 04:32:50 +0000
commiteb6671e7c88cbe6d5b01b8dbdd38b9f925b2f41b (patch)
treed5ad1911b714a1fab5d3545f95526ba2f3ad95b3 /lldb/source/Plugins/Process/Windows
parent2a5488b8770d5cc8eb93b6a21b5f85765df88290 (diff)
downloadbcm5719-llvm-eb6671e7c88cbe6d5b01b8dbdd38b9f925b2f41b.tar.gz
bcm5719-llvm-eb6671e7c88cbe6d5b01b8dbdd38b9f925b2f41b.zip
Implement GetLoadAddress for the Windows process plugin
Summary: When a process is loaded, update its sections with the load address to resolve any created breakpoints. For the remote debugging case, the debugged process is launched remotely so GetLoadAddress is intended to pass the load address from remote to LLDB (client). Reviewers: zturner, llvm-commits, clayborg, labath Reviewed By: labath Subscribers: mgorny, sas, Hui, clayborg, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56237 llvm-svn: 354099
Diffstat (limited to 'lldb/source/Plugins/Process/Windows')
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt1
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp41
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h3
3 files changed, 19 insertions, 26 deletions
diff --git a/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt b/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
index 09262908618..95ab64c1b83 100644
--- a/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
@@ -24,6 +24,7 @@ add_lldb_library(lldbPluginProcessWindowsCommon PLUGIN
lldbCore
lldbHost
lldbInterpreter
+ lldbPluginDynamicLoaderWindowsDYLD
lldbSymbol
lldbTarget
ws2_32
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index fad7aa388bb..93df360678c 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -864,6 +864,13 @@ lldb::addr_t ProcessWindows::GetImageInfoAddress() {
return LLDB_INVALID_ADDRESS;
}
+DynamicLoaderWindowsDYLD *ProcessWindows::GetDynamicLoader() {
+ if (m_dyld_ap.get() == NULL)
+ m_dyld_ap.reset(DynamicLoader::FindPlugin(
+ this, DynamicLoaderWindowsDYLD::GetPluginNameStatic().GetCString()));
+ return static_cast<DynamicLoaderWindowsDYLD *>(m_dyld_ap.get());
+}
+
void ProcessWindows::OnExitProcess(uint32_t exit_code) {
// No need to acquire the lock since m_session_data isn't accessed.
Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
@@ -916,12 +923,10 @@ void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) {
GetTarget().SetExecutableModule(module, eLoadDependentsNo);
}
- bool load_addr_changed;
- module->SetLoadAddress(GetTarget(), image_base, false, load_addr_changed);
-
- ModuleList loaded_modules;
- loaded_modules.Append(module);
- GetTarget().ModulesDidLoad(loaded_modules);
+ if (auto dyld = GetDynamicLoader())
+ dyld->OnLoadModule(
+ ModuleSpec(module->GetFileSpec(), module->GetArchitecture()),
+ 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
@@ -1027,29 +1032,13 @@ void ProcessWindows::OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) {
void ProcessWindows::OnLoadDll(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 = GetTarget().GetSharedModule(module_spec, &error);
- bool load_addr_changed = false;
- module->SetLoadAddress(GetTarget(), module_addr, false, load_addr_changed);
-
- ModuleList loaded_modules;
- loaded_modules.Append(module);
- GetTarget().ModulesDidLoad(loaded_modules);
+ if (auto dyld = GetDynamicLoader())
+ dyld->OnLoadModule(module_spec, module_addr);
}
void ProcessWindows::OnUnloadDll(lldb::addr_t module_addr) {
- Address resolved_addr;
- if (GetTarget().ResolveLoadAddress(module_addr, resolved_addr)) {
- ModuleSP module = resolved_addr.GetModule();
- if (module) {
- ModuleList unloaded_modules;
- unloaded_modules.Append(module);
- GetTarget().ModulesDidUnload(unloaded_modules, false);
- }
- }
+ if (auto dyld = GetDynamicLoader())
+ dyld->OnUnloadModule(module_addr);
}
void ProcessWindows::OnDebugString(const std::string &string) {}
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
index 184dab90ff3..3ef6d56dd2e 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
@@ -16,6 +16,7 @@
#include "llvm/Support/Mutex.h"
#include "IDebugDelegate.h"
+#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
namespace lldb_private {
@@ -90,6 +91,8 @@ public:
lldb::addr_t GetImageInfoAddress() override;
+ DynamicLoaderWindowsDYLD *GetDynamicLoader() override;
+
// IDebugDelegate overrides.
void OnExitProcess(uint32_t exit_code) override;
void OnDebuggerConnected(lldb::addr_t image_base) override;
OpenPOWER on IntegriCloud