[Lldb-commits] [PATCH 3/3] Extend the ObjectFile interface to support dynamic loading on ELF platforms.
Stephen Wilson
wilsons at start.ca
Fri Jan 14 12:56:34 PST 2011
Debuggers on ELF platforms hook into the runtime linker by monitoring a special
"rendezvous" embedded in the address space of the inferior process. The exact
location of this structure is filled in by the runtime linker and can be
resolved by locating the DT_DEBUG entry in the processes .dynamic section. The
new GetImageInfo() method (morally equivalent to Process::GetImageInfo) provides
the mechanism to locate this information.
GetEntryPoint() simply returns the address of the start symbol in the executable
if present. It is useful to the dynamic loader plugin for ELF systems as this
is the earliest point where LLDB can break and probe the inferiors .dynamic
section and rendezvous structure. Also, this address can be used in the
computation of the virtual base address for position independent executables.
---
include/lldb/Symbol/ObjectFile.h | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h
index 184e80c..8e51571 100644
--- a/include/lldb/Symbol/ObjectFile.h
+++ b/include/lldb/Symbol/ObjectFile.h
@@ -173,6 +173,17 @@ public:
//------------------------------------------------------------------
virtual bool
IsExecutable () const = 0;
+
+ //------------------------------------------------------------------
+ /// Returns the virtual address of the entry point for this object
+ /// file.
+ ///
+ /// @return
+ /// The virtual address of the entry point or an invalid address
+ /// if an entry point is not defined.
+ //------------------------------------------------------------------
+ virtual lldb_private::Address
+ GetEntryPoint () const { return Address(); }
//------------------------------------------------------------------
/// Returns the offset into a file at which this object resides.
@@ -311,6 +322,22 @@ public:
virtual lldb_private::UnwindTable&
GetUnwindTable () { return m_unwind_table; }
+ //------------------------------------------------------------------
+ /// Similar to Process::GetImageInfoAddress().
+ ///
+ /// Some platforms embed auxiliary structures useful to debuggers in the
+ /// address space of the inferior process. This method returns the address
+ /// of such a structure if the information can be resolved via entries in
+ /// the object file. ELF, for example, provides a means to hook into the
+ /// runtime linker so that a debugger may monitor the loading and unloading
+ /// of shared libraries.
+ ///
+ /// @return
+ /// The address of any auxiliary tables, or an invalid address if this
+ /// object file format does not support or contain such information.
+ virtual lldb_private::Address
+ GetImageInfoAddress () { return Address(); }
+
protected:
//------------------------------------------------------------------
// Member variables.
--
1.7.3.5
More information about the lldb-commits
mailing list