[Lldb-commits] [lldb] r208265 - Change ProcessElfCore::CreateInstance() to check if the ELF magic bytes

Jason Molenda jmolenda at apple.com
Wed May 7 16:14:05 PDT 2014


Author: jmolenda
Date: Wed May  7 18:14:04 2014
New Revision: 208265

URL: http://llvm.org/viewvc/llvm-project?rev=208265&view=rev
Log:
Change ProcessElfCore::CreateInstance() to check if the ELF magic bytes
appear in the file before it assumes the file is ELF.  It was incorrectly
activating for Mach-O core files.
<rdar://problem/16836816> 

Modified:
    lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp

Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=208265&r1=208264&r2=208265&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Wed May  7 18:14:04 2014
@@ -63,7 +63,7 @@ ProcessElfCore::CreateInstance (Target &
         const size_t header_size = sizeof(llvm::ELF::Elf64_Ehdr);
 
         lldb::DataBufferSP data_sp (crash_file->ReadFileContents(0, header_size));
-        if (data_sp->GetByteSize() == header_size)
+        if (data_sp->GetByteSize() == header_size && elf::ELFHeader::MagicBytesMatch (data_sp->GetBytes()))
         {
             elf::ELFHeader elf_header;
             DataExtractor data(data_sp, lldb::eByteOrderLittle, 4);





More information about the lldb-commits mailing list