diff options
author | Greg Clayton <gclayton@apple.com> | 2010-07-07 21:52:01 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-07-07 21:52:01 +0000 |
commit | 51dc1882166894ce3dadb587488f8101c4fb9dca (patch) | |
tree | 2ba7edccbee26e806bbd0ba4b793c1e0fc3aac07 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | fb617d5365c2063eebf73170ee8ea7ad1f4cc98e (diff) | |
download | bcm5719-llvm-51dc1882166894ce3dadb587488f8101c4fb9dca.tar.gz bcm5719-llvm-51dc1882166894ce3dadb587488f8101c4fb9dca.zip |
64 bit ELF support from Stephen Wilson.
llvm-svn: 107817
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index ab4c9936079..d20a8d6b7d8 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -70,16 +70,22 @@ ObjectFileELF::CreateInstance (Module* module, DataBufferSP& dataSP, const FileS } bool -ObjectFileELF::MagicBytesMatch (DataBufferSP& dataSP) +ObjectFileELF::MagicBytesMatch (DataBufferSP& data_sp) { - DataExtractor data(dataSP, eByteOrderHost, 4); - const uint8_t* magic = data.PeekData(0, 4); - if (magic != NULL) + if (data_sp && data_sp->GetByteSize() > EI_PAD) { - return magic[EI_MAG0] == 0x7f - && magic[EI_MAG1] == 'E' - && magic[EI_MAG2] == 'L' - && magic[EI_MAG3] == 'F'; + const uint8_t* magic = data_sp->GetBytes(); + if (magic != NULL) + { + bool have_magic = (magic[EI_MAG0] == 0x7f && + magic[EI_MAG1] == 'E' && + magic[EI_MAG2] == 'L' && + magic[EI_MAG3] == 'F'); + + bool have_32bit = magic[EI_CLASS] == ELFCLASS32; + + return have_magic && have_32bit; + } } return false; } @@ -376,7 +382,7 @@ ParseSymbols (Symtab *symtab, SectionList *section_list, const Elf32_Shdr &symta break; } - switch (ELF32_ST_BIND (symbol.st_info)) + switch (ELF_ST_BIND (symbol.st_info)) { default: case STT_NOTYPE: @@ -442,7 +448,7 @@ ParseSymbols (Symtab *symtab, SectionList *section_list, const Elf32_Shdr &symta symbol_name, // symbol name false, // Is the symbol name mangled? symbol_type, // type of this symbol - ELF32_ST_BIND (symbol.st_info) == STB_GLOBAL, // Is this globally visible? + ELF_ST_BIND (symbol.st_info) == STB_GLOBAL, // Is this globally visible? false, // Is this symbol debug info? false, // Is this symbol a trampoline? false, // Is this symbol artificial? |