From 3f4200fd9dc4cca612d327f5264c122684d8dbd9 Mon Sep 17 00:00:00 2001 From: Stephen Wilson Date: Thu, 24 Feb 2011 19:16:15 +0000 Subject: 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. llvm-svn: 126405 --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp') diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 445518d9e64..8793cfac93e 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -74,8 +74,9 @@ ObjectFileELF::CreateInstance(Module *module, { std::auto_ptr 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 @@ ObjectFileELF::CreateInstance(Module *module, 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 @@ ObjectFileELF::DumpDependentModules(lldb_private::Stream *s) 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; -- cgit v1.2.3