def test_SBInstruction(self):
     obj = lldb.SBInstruction()
     if self.TraceOn():
         print obj
     self.assertFalse(obj)
     # Do fuzz testing on the invalid obj, it should not crash lldb.
     import sb_instruction
     sb_instruction.fuzz_obj(obj)
Example #2
0
    def run_a_single_test(self, filename):
        insn = lldb.SBInstruction()
        stream = lldb.SBStream()
        success = insn.TestEmulation(stream, filename)
        output = stream.GetData()
        if self.TraceOn():
            print '\nRunning test ' + os.path.basename(filename)
            print output

        self.assertTrue(success, 'Emulation test succeeded.')
Example #3
0
def fuzz_obj(obj):
    obj.GetSize()
    obj.GetInstructionAtIndex(0xffffffff)
    obj.AppendInstruction(lldb.SBInstruction())
    obj.Print(None)
    obj.GetDescription(lldb.SBStream())
    obj.DumpEmulationForAllInstructions("armv7")
    obj.Clear()
    for inst in obj:
        s = str(inst)