[Lldb-commits] [PATCH 3/4] linux: Remove a local ObjectFileELF version of GetArchitecture.
Greg Clayton
gclayton at apple.com
Wed Feb 23 15:58:20 PST 2011
Looks good.
On Feb 23, 2011, at 1:16 PM, Stephen Wilson wrote:
> 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.
> ---
> source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 18 +++++++-----------
> source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 3 ---
> 2 files changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> index 445518d..c381a3b 100644
> --- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> +++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> @@ -74,8 +74,9 @@ ObjectFileELF::CreateInstance(Module *module,
> {
> 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 @@ 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;
> diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
> index ad97165..5de0a8a 100644
> --- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
> +++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
> @@ -116,9 +116,6 @@ public:
> virtual lldb_private::Address
> GetImageInfoAddress();
>
> - lldb_private::ArchSpec
> - GetArchitecture();
> -
> private:
> ObjectFileELF(lldb_private::Module* module,
> lldb::DataBufferSP& dataSP,
> --
> 1.7.3.5
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list