Disassembling either every section or only executable code

This commit is contained in:
Pierre Pronchery 2011-09-05 21:30:33 +00:00
parent 0f27fe745e
commit fd9046bbd4

View File

@ -383,8 +383,8 @@ static int _elf_decode32(FormatPlugin * format, int raw)
{ {
if(shdr[i].sh_name >= shstrtab_cnt) if(shdr[i].sh_name >= shstrtab_cnt)
continue; continue;
if(shdr[i].sh_type == SHT_PROGBITS if(raw || (shdr[i].sh_type == SHT_PROGBITS
&& shdr[i].sh_flags & SHF_EXECINSTR) && shdr[i].sh_flags & SHF_EXECINSTR))
helper->decode(helper->format, helper->decode(helper->format,
&shstrtab[shdr[i].sh_name], &shstrtab[shdr[i].sh_name],
shdr[i].sh_offset, shdr[i].sh_size, shdr[i].sh_offset, shdr[i].sh_size,
@ -512,8 +512,7 @@ static int _elf_decode64(FormatPlugin * format, int raw)
return -1; return -1;
if(_decode64_addr(format, &ehdr, &base) != 0 if(_decode64_addr(format, &ehdr, &base) != 0
|| _decode64_strtab(format, shdr, ehdr.e_shnum, || _decode64_strtab(format, shdr, ehdr.e_shnum,
ehdr.e_shstrndx, &shstrtab, &shstrtab_cnt) ehdr.e_shstrndx, &shstrtab, &shstrtab_cnt) != 0)
!= 0)
{ {
free(shdr); free(shdr);
return -1; return -1;
@ -522,8 +521,8 @@ static int _elf_decode64(FormatPlugin * format, int raw)
{ {
if(shdr[i].sh_name >= shstrtab_cnt) if(shdr[i].sh_name >= shstrtab_cnt)
continue; continue;
if(shdr[i].sh_type == SHT_PROGBITS if(raw || (shdr[i].sh_type == SHT_PROGBITS
&& shdr[i].sh_flags & SHF_EXECINSTR) && shdr[i].sh_flags & SHF_EXECINSTR))
helper->decode(helper->format, helper->decode(helper->format,
&shstrtab[shdr[i].sh_name], &shstrtab[shdr[i].sh_name],
shdr[i].sh_offset, shdr[i].sh_size, shdr[i].sh_offset, shdr[i].sh_size,