示例#1
0
 def testSuccessUnwind(self):
     self.assertEqual(
         [
             FunctionUnwind(address=0x100,
                            size=1024,
                            address_unwinds=(
                                AddressUnwind(
                                    address_offset=0x0,
                                    unwind_type=UnwindType.RETURN_TO_LR,
                                    sp_offset=0,
                                    registers=(),
                                ),
                                AddressUnwind(
                                    address_offset=0x200,
                                    unwind_type=UnwindType.RETURN_TO_LR,
                                    sp_offset=0,
                                    registers=(),
                                ),
                            ))
         ],
         list(
             GenerateUnwinds([
                 FunctionCfi(size=1024,
                             address_cfi=(
                                 AddressCfi(address=0x100,
                                            unwind_instructions='RETURN'),
                                 AddressCfi(address=0x300,
                                            unwind_instructions='RETURN'),
                             ))
             ],
                             parsers=[MockReturnParser()])))
示例#2
0
 def testInvalidInitialUnwindInstructionAsserts(self):
     self.assertRaises(
         AssertionError, lambda: list(
             GenerateUnwinds([
                 FunctionCfi(size=1024,
                             address_cfi=(
                                 AddressCfi(address=0x100,
                                            unwind_instructions='UNKNOWN'),
                                 AddressCfi(address=0x200,
                                            unwind_instructions='RETURN'),
                             ))
             ],
                             parsers=[MockReturnParser()])))