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> 

llvm-svn: 208265
This commit is contained in:
Jason Molenda 2014-05-07 23:14:04 +00:00
parent e60adfdbd0
commit 8cb27bb911
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ ProcessElfCore::CreateInstance (Target &target, Listener &listener, const FileSp
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);