From: Eli Bendersky Date: Wed, 26 Oct 2016 03:32:31 +0000 (-0700) Subject: Cosmetic changes X-Git-Tag: v0.25~56 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c40498b5660040b4fac8b738ea1a870869d0661;p=pyelftools.git Cosmetic changes --- diff --git a/elftools/dwarf/structs.py b/elftools/dwarf/structs.py index bdd79da..562cccd 100644 --- a/elftools/dwarf/structs.py +++ b/elftools/dwarf/structs.py @@ -235,7 +235,7 @@ class DWARFStructs(object): self.Dwarf_uint16('version'), self.Dwarf_offset('header_length'), self.Dwarf_uint8('minimum_instruction_length'), - If(lambda ctx: ctx['version'] >= 4, + If(lambda ctx: ctx['version'] >= 4, self.Dwarf_uint8("maximum_operations_per_instruction"), 1), self.Dwarf_uint8('default_is_stmt'), @@ -332,7 +332,6 @@ class _SLEB128Adapter(Adapter): value = (value << 7) + (ord(b) & 0x7F) if ord(obj[-1]) & 0x40: # negative -> sign extend - # value |= - (1 << (7 * len(obj))) return value @@ -347,5 +346,3 @@ def _SLEB128(name): """ A construct creator for SLEB128 encoding. """ return Rename(name, _SLEB128Adapter(_LEB128_reader())) - - diff --git a/elftools/elf/elffile.py b/elftools/elf/elffile.py index 1cb0f4a..64fd479 100644 --- a/elftools/elf/elffile.py +++ b/elftools/elf/elffile.py @@ -223,7 +223,6 @@ class ELFFile(object): # Note: this code reads the stream directly, without using ELFStructs, # since we don't yet know its exact format. ELF was designed to be # read like this - its e_ident field is word-size and endian agnostic. - # self.stream.seek(0) magic = self.stream.read(4) elf_assert(magic == b'\x7fELF', 'Magic number does not match') diff --git a/test/test_arm_support.py b/test/test_arm_support.py index 6493663..d31f2d1 100644 --- a/test/test_arm_support.py +++ b/test/test_arm_support.py @@ -13,6 +13,7 @@ import os from utils import setup_syspath; setup_syspath() from elftools.elf.elffile import ELFFile + class TestARMSupport(unittest.TestCase): def test_hello(self): with open(os.path.join('test', 'testfiles_for_unittests', @@ -39,6 +40,6 @@ class TestARMSupport(unittest.TestCase): all_CUs = list(dwarfinfo.iter_CUs()) self.assertEqual(len(all_CUs), 9) + if __name__ == '__main__': unittest.main() - diff --git a/test/test_dwarf_structs.py b/test/test_dwarf_structs.py index bd4a8fc..777ff2c 100644 --- a/test/test_dwarf_structs.py +++ b/test/test_dwarf_structs.py @@ -31,7 +31,7 @@ class TestDWARFStructs(unittest.TestCase): # and another entry b'\x45\x50\x51\x00\x86\x12\x07\x08' + # followed by NULL - b'\x00') + b'\x00') self.assertEqual(c.version, 2) self.assertEqual(c.opcode_base, 6) self.assertEqual(c.standard_opcode_lengths, [0, 1, 4, 8, 12]) @@ -44,4 +44,3 @@ class TestDWARFStructs(unittest.TestCase): if __name__ == '__main__': unittest.main() - diff --git a/test/test_elffile.py b/test/test_elffile.py index 5c7b2b8..d7d9602 100644 --- a/test/test_elffile.py +++ b/test/test_elffile.py @@ -12,6 +12,7 @@ except ImportError: from utils import setup_syspath; setup_syspath() from elftools.elf.elffile import ELFFile + class TestMap(unittest.TestCase): def test_address_offsets(self): class MockELF(ELFFile): diff --git a/test/test_utils.py b/test/test_utils.py index b74f2e5..5972b7d 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -60,6 +60,3 @@ class Test_preserve_stream_pos(unittest.TestCase): if __name__ == '__main__': unittest.main() - - -