[Lldb-commits] [lldb] r126405 - in /lldb/trunk/source/Plugins/ObjectFile/ELF: ObjectFileELF.cpp ObjectFileELF.h

Stephen Wilson wilsons at start.ca
Thu Feb 24 11:16:15 PST 2011


Author: wilsons
Date: Thu Feb 24 13:16:15 2011
New Revision: 126405

URL: http://llvm.org/viewvc/llvm-project?rev=126405&view=rev
Log:
linux: Remove a local ObjectFileELF version of GetArchitecture.

Also fix a bug where we were not lazily parsing the ELF header and thus
returning an ArchSpec with invalid cpu type components.  Initialize the cpu
subtype as LLDB_INVALID_CPUTYPE for compatibility with the new ArchSpec
implementation.


Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=126405&r1=126404&r2=126405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Feb 24 13:16:15 2011
@@ -74,8 +74,9 @@
             {
                 std::auto_ptr<ObjectFileELF> objfile_ap(
                     new ObjectFileELF(module, data_sp, file, offset, length));
-                ArchSpec spec = objfile_ap->GetArchitecture();
-                if (spec.IsValid() && objfile_ap->SetModulesArchitecture(spec))
+                ArchSpec spec;
+                if (objfile_ap->GetArchitecture(spec) &&
+                    objfile_ap->SetModulesArchitecture(spec))
                     return objfile_ap.release();
             }
         }
@@ -83,14 +84,6 @@
     return NULL;
 }
 
-ArchSpec
-ObjectFileELF::GetArchitecture()
-{
-    if (!ParseHeader())
-        return ArchSpec();
-
-    return ArchSpec(eArchTypeELF, m_header.e_machine, m_header.e_flags);
-}
 
 //------------------------------------------------------------------
 // PluginInterface protocol
@@ -1046,7 +1039,10 @@
 bool
 ObjectFileELF::GetArchitecture (ArchSpec &arch)
 {
-    arch.SetArchitecture (lldb::eArchTypeELF, m_header.e_machine, m_header.e_flags);
+    if (!ParseHeader())
+        return false;
+
+    arch.SetArchitecture (lldb::eArchTypeELF, m_header.e_machine, LLDB_INVALID_CPUTYPE);
     arch.GetTriple().setOSName (Host::GetOSString().GetCString());
     arch.GetTriple().setVendorName(Host::GetVendorString().GetCString());
     return true;

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=126405&r1=126404&r2=126405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Thu Feb 24 13:16:15 2011
@@ -116,9 +116,6 @@
     virtual lldb_private::Address
     GetImageInfoAddress();
 
-    lldb_private::ArchSpec 
-    GetArchitecture();
-
 private:
     ObjectFileELF(lldb_private::Module* module,
                   lldb::DataBufferSP& dataSP,





More information about the lldb-commits mailing list