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'),
value = (value << 7) + (ord(b) & 0x7F)
if ord(obj[-1]) & 0x40:
# negative -> sign extend
- #
value |= - (1 << (7 * len(obj)))
return value
""" A construct creator for SLEB128 encoding.
"""
return Rename(name, _SLEB128Adapter(_LEB128_reader()))
-
-
# 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')
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',
all_CUs = list(dwarfinfo.iter_CUs())
self.assertEqual(len(all_CUs), 9)
+
if __name__ == '__main__':
unittest.main()
-
# 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])
if __name__ == '__main__':
unittest.main()
-
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):
if __name__ == '__main__':
unittest.main()
-
-
-