From d7aec6aba2cfed93e69dfe177cc161ccab42f15c Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Tue, 25 Aug 2015 05:18:45 -0700 Subject: [PATCH] Cosmetic changes --- elftools/dwarf/lineprogram.py | 18 ++++++------------ elftools/dwarf/structs.py | 8 +++----- test/test_dwarf_lineprogram.py | 1 - 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/elftools/dwarf/lineprogram.py b/elftools/dwarf/lineprogram.py index 51cfdb7..8996b5c 100644 --- a/elftools/dwarf/lineprogram.py +++ b/elftools/dwarf/lineprogram.py @@ -153,24 +153,18 @@ class LineProgram(object): if opcode >= self.header['opcode_base']: # Special opcode (follow the recipe in 6.2.5.1) maximum_operations_per_instruction = self['maximum_operations_per_instruction'] - - adjusted_opcode = opcode - self['opcode_base'] operation_advance = adjusted_opcode // self['line_range'] - - address_addend = self['minimum_instruction_length'] * ((state.op_index + operation_advance) // maximum_operations_per_instruction) - + address_addend = ( + self['minimum_instruction_length'] * + ((state.op_index + operation_advance) // + maximum_operations_per_instruction)) state.address += address_addend - state.op_index = (state.op_index + operation_advance) % maximum_operations_per_instruction - line_addend = self['line_base'] + (adjusted_opcode % self['line_range']) - state.line += line_addend - - add_entry_new_state(opcode, [line_addend, address_addend, state.op_index]) - - + add_entry_new_state( + opcode, [line_addend, address_addend, state.op_index]) elif opcode == 0: # Extended opcode: start with a zero byte, followed by # instruction size and the instruction itself. diff --git a/elftools/dwarf/structs.py b/elftools/dwarf/structs.py index 49ffd52..f90a80a 100644 --- a/elftools/dwarf/structs.py +++ b/elftools/dwarf/structs.py @@ -226,11 +226,9 @@ class DWARFStructs(object): self.Dwarf_uint16('version'), self.Dwarf_offset('header_length'), self.Dwarf_uint8('minimum_instruction_length'), - - If(lambda ctx: ctx['version'] >= 4, - self.Dwarf_uint8("maximum_operations_per_instruction"), - 1), - + If(lambda ctx: ctx['version'] >= 4, + self.Dwarf_uint8("maximum_operations_per_instruction"), + 1), self.Dwarf_uint8('default_is_stmt'), self.Dwarf_int8('line_base'), self.Dwarf_uint8('line_range'), diff --git a/test/test_dwarf_lineprogram.py b/test/test_dwarf_lineprogram.py index e592a82..0466926 100644 --- a/test/test_dwarf_lineprogram.py +++ b/test/test_dwarf_lineprogram.py @@ -107,4 +107,3 @@ class TestLineProgram(unittest.TestCase): if __name__ == '__main__': unittest.main() - -- 2.30.2