[Lldb-commits] [lldb] r123466 - /lldb/trunk/include/lldb/Symbol/ObjectFile.h

Stephen Wilson wilsons at start.ca
Fri Jan 14 13:08:59 PST 2011


Author: wilsons
Date: Fri Jan 14 15:08:59 2011
New Revision: 123466

URL: http://llvm.org/viewvc/llvm-project?rev=123466&view=rev
Log:
Extend the ObjectFile interface to support dynamic loading on ELF platforms.

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 GetImageInfoAddress() method (morally equivalent to
Process::GetImageInfoAddress) 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.


Modified:
    lldb/trunk/include/lldb/Symbol/ObjectFile.h

Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=123466&r1=123465&r2=123466&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Fri Jan 14 15:08:59 2011
@@ -173,6 +173,17 @@
     //------------------------------------------------------------------
     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 @@
     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.





More information about the lldb-commits mailing list