summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Sezer <sas@cd80.net>2015-08-21 19:28:34 +0000
committerStephane Sezer <sas@cd80.net>2015-08-21 19:28:34 +0000
commit705ffc1794449ffedf85444582c92c9636b9b987 (patch)
tree60ec7948443d9e7f7fcade9ad3e63c4f40a736ee
parent75296901f7bf272fa79b1a62388aaa11bcfa5e2b (diff)
downloadbcm5719-llvm-705ffc1794449ffedf85444582c92c9636b9b987.tar.gz
bcm5719-llvm-705ffc1794449ffedf85444582c92c9636b9b987.zip
Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.
Summary: This commit implements basic DidAttach and DidLaunch for the windows DynamicLoader plugin which allow us to load shared libraries from the inferior. At the moment, I'm unsure how we're going to gather the load address of the main module over gdb protocol so I always use an offset of 0, which works well for processes we create ourselves (no randomization). I will address this point later on. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12245 llvm-svn: 245725
-rw-r--r--lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
index dd391b4ca4d..0b95630e25b 100644
--- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -9,6 +9,7 @@
#include "DynamicLoaderWindowsDYLD.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@ DynamicLoaderWindowsDYLD::CreateInstance(Process *process, bool force)
void
DynamicLoaderWindowsDYLD::DidAttach()
{
+ Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+ if (log)
+ log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ DidLaunch();
+
+ m_process->LoadModules();
}
void
DynamicLoaderWindowsDYLD::DidLaunch()
{
+ Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+ if (log)
+ log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ ModuleSP executable = GetTargetExecutable();
+
+ if (!executable.get())
+ return;
+
+ ModuleList module_list;
+ module_list.Append(executable);
+ // FIXME: We probably should not always use 0 as the load address
+ // here. Testing showed that when debugging a process that we start
+ // ourselves, there's no randomization of the load address of the
+ // main module, therefore an offset of 0 will be valid.
+ // If we attach to an already running process, this is probably
+ // going to be wrong and we'll have to get the load address somehow.
+ UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+ m_process->GetTarget().ModulesDidLoad(module_list);
}
Error
OpenPOWER on IntegriCloud