Added new test file and fixing some problems related to it. not completely working yet
diff --git a/elftools/dwarf/lineprogram.py b/elftools/dwarf/lineprogram.py
index 361511f..45bca2d 100644
--- a/elftools/dwarf/lineprogram.py
+++ b/elftools/dwarf/lineprogram.py
@@ -6,6 +6,7 @@
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
+import os
import copy
from collections import namedtuple
@@ -181,6 +182,10 @@
self.structs.Dwarf_lineprog_file_entry, self.stream)
self['file_entry'].append(operand)
add_entry_old_state(ex_opcode, [operand], is_extended=True)
+ else:
+ # Unknown, but need to roll forward the stream because the
+ # length is specified
+ self.stream.seek(inst_len, os.SEEK_CUR)
else: # 0 < opcode < opcode_base
# Standard opcode
if opcode == DW_LNS_copy:
@@ -197,7 +202,7 @@
self.stream)
state.line += operand
elif opcode == DW_LNS_set_file:
- operand = struct_parse(self.structs.Dwarf_sleb128(''),
+ operand = struct_parse(self.structs.Dwarf_uleb128(''),
self.stream)
state.file = operand
add_entry_old_state(opcode, [operand])
diff --git a/tests/run_readelf_tests.py b/tests/run_readelf_tests.py
index 5a5fbd7..61cfbee 100755
--- a/tests/run_readelf_tests.py
+++ b/tests/run_readelf_tests.py
@@ -104,7 +104,8 @@
elif 'of the .debug_frame section' in line:
filter_out = False
if not filter_out:
- yield line
+ if not line.startswith('unknown: length'):
+ yield line
lines1 = prepare_lines(s1)
lines2 = prepare_lines(s2)
diff --git a/tests/testfiles/penalty_32_gcc.o.elf b/tests/testfiles/penalty_32_gcc.o.elf
new file mode 100644
index 0000000..4c5c5de
--- /dev/null
+++ b/tests/testfiles/penalty_32_gcc.o.elf
Binary files differ