summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp
diff options
context:
space:
mode:
authorStephen Wilson <wilsons@start.ca>2011-01-16 19:45:39 +0000
committerStephen Wilson <wilsons@start.ca>2011-01-16 19:45:39 +0000
commit2103e25e19183990657339178669253148dec54f (patch)
tree384e26d886a8b80838045876fab1a6d287600005 /lldb/source/Plugins/Process/Linux/ProcessLinux.cpp
parentec517cdf24a44bce1e4342578703c1449025d18a (diff)
downloadbcm5719-llvm-2103e25e19183990657339178669253148dec54f.tar.gz
bcm5719-llvm-2103e25e19183990657339178669253148dec54f.zip
Initial support for a DynamicLoader plugin on Linux.
This patch is enough to have shared objects recognized by LLDB. We can handle position independent executables. We can handle dynamically loaded modules brought in via dlopen. The DYLDRendezvous class provides an interface to a structure present in the address space of ELF-based processes. This structure provides the address of a function which is called by the linker each time a shared object is loaded and unloaded (thus a breakpoint at that address will let LLDB intercept such events), a list of entries describing the currently loaded shared objects, plus a few other things. On Linux, processes are brought up with an auxiliary vector on the stack. One element in this vector contains the (possibly dynamic) entry address of the process. One does not need to walk the stack to find this information as it is also available under /proc/<pid>/auxv. The new AuxVector class provides a convenient read-only view of this auxiliary vector information. We use the dynamic entry address and the address as specified in the object file to compute the actual load address of the inferior image. This strategy works for both normal executables and PIE's. llvm-svn: 123592
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/ProcessLinux.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/ProcessLinux.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp
index 00bdda51036..d7fe1dae0a1 100644
--- a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Target.h"
#include "ProcessLinux.h"
@@ -102,6 +103,19 @@ ProcessLinux::DoAttachToProcessWithID(lldb::pid_t pid)
}
Error
+ProcessLinux::WillLaunch(Module* module)
+{
+ Error error;
+
+ m_dyld_ap.reset(DynamicLoader::FindPlugin(this, "dynamic-loader.linux-dyld"));
+ if (m_dyld_ap.get() == NULL)
+ error.SetErrorString("unable to find the dynamic loader named "
+ "'dynamic-loader.linux-dyld'");
+
+ return error;
+}
+
+Error
ProcessLinux::DoLaunch(Module *module,
char const *argv[],
char const *envp[],
@@ -128,6 +142,13 @@ ProcessLinux::DoLaunch(Module *module,
return error;
}
+void
+ProcessLinux::DidLaunch()
+{
+ if (m_dyld_ap.get() != NULL)
+ m_dyld_ap->DidLaunch();
+}
+
Error
ProcessLinux::DoResume()
{
@@ -371,6 +392,12 @@ ProcessLinux::GetByteOrder() const
return m_byte_order;
}
+DynamicLoader *
+ProcessLinux::GetDynamicLoader()
+{
+ return m_dyld_ap.get();
+}
+
//------------------------------------------------------------------------------
// ProcessInterface protocol.
OpenPOWER on IntegriCloud