def _dump_debug_info(self):
""" Dump the debugging info section.
"""
+ self._emitline('Contents of the .debug_info section:\n')
+
# Offset of the .debug_info section in the stream
section_offset = self._dwarfinfo.debug_info_loc.offset
for cu in self._dwarfinfo.iter_CUs():
- self._emitline(' Compilation Unit @ offset %s' %
+ self._emitline(' Compilation Unit @ offset %s:' %
self._format_hex(cu.cu_offset - section_offset))
self._emitline(' Length: %s (%s)' % (
self._format_hex(cu['unit_length']),
# read a little-endian, 64-bit file
es = ELFStructs(True, 64)
-stream = open('tests/testfiles/exe_simple64.elf', 'rb')
+stream = open('tests/testfiles/penalty_64.o.elf', 'rb')
#stream = open('binfiles/z32.elf', 'rb')
efile = ELFFile(stream)
-print efile.elfclass, efile.little_endian
+print 'elfclass', efile.elfclass
print '===> %s sections!' % efile.num_sections()
#~ print efile.has_dwarf_info()
-#~ dwarfinfo = efile.get_dwarf_info()
+dwarfinfo = efile.get_dwarf_info()
+print dwarfinfo.get_string_from_table(0x4bc0)
+cu = dwarfinfo.get_CU(0)
-#~ cu = dwarfinfo.get_CU(3)
-#~ print 'CU header', cu.header
-#~ topdie = cu.get_top_DIE()
+print cu.structs.Dwarf_dw_form['DW_FORM_strp'].parse('\x01\x00\x00\x00\x01\x00\x00\x00')
+print 'CU header', cu.header
+topdie = cu.get_top_DIE()
-#~ c = topdie.iter_children().next()
-
-#~ print c
+print topdie
#~ print 'siblings.....'
#~ for s in c.iter_siblings():
#~ print s
-from elftools.dwarf.location_expr import DW_OP_name2opcode, DW_OP_opcode2name
+#~ from elftools.dwarf.location_expr import DW_OP_name2opcode, DW_OP_opcode2name
-print hex(DW_OP_name2opcode['DW_OP_lit14'])
-print DW_OP_opcode2name[0x0e]
+#~ print hex(DW_OP_name2opcode['DW_OP_lit14'])
+#~ print DW_OP_opcode2name[0x0e]