From: Eli Bendersky Date: Fri, 16 Dec 2011 11:05:54 +0000 (+0200) Subject: Added new test file and fixing some problems related to it. not completely working yet X-Git-Tag: v0.10~28 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b98299ee57b62261cb4aaed62f02c6f80d162af6;p=pyelftools.git 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 @@ class LineProgram(object): 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 @@ class LineProgram(object): 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 @@ def compare_output(s1, s2): 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 Binary files /dev/null and b/tests/testfiles/penalty_32_gcc.o.elf differ