Open
Description
I'm getting the following error when the script tries to build the new dbg binary:
Traceback (most recent call last):
File "/my/path/ghidra2dwarf/src/ghidra2dwarf.py", line 521, in <module>
add_sections_to_elf(exe_path, out_path, sections)
File "/my/path/ghidra2dwarf/src/elf.py", line 195, in add_sections_to_elf
out = e.generate_updated_elf()
File "/my/path/ghidra2dwarf/src/elf.py", line 155, in generate_updated_elf
section_headers = self.extract_section_headers()
File "/my/path/ghidra2dwarf/src/elf.py", line 140, in extract_section_headers
self.section_names = self.extract_section(self.section_headers[h.shstrndx])
IndexError: index out of range: 0
ghidra2dwarf.py> Finished!
It appears this occurs when there are no section headers in the elf binary:
readelf -h /another/path/squashfs-root/bin/busybox
ELF Header:
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x403220
Start of program headers: 52 (bytes into file)
Start of section headers: 0 (bytes into file)
Flags: 0x70001007, noreorder, pic, cpic, o32, mips32r2
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 0 (bytes)
Number of section headers: 0
Section header string table index: 0
Would it be reasonable to add the following to elf.py
if self.section_headers:
self.section_names = self.extract_section(self.section_headers[h.shstrndx])
Metadata
Metadata
Assignees
Labels
No labels