Add fuzz calls for SBFrame and SBFunction.

llvm-svn: 133965
This commit is contained in:
Johnny Chen 2011-06-27 23:53:55 +00:00
parent 105974d497
commit 40e978f7b3
3 changed files with 59 additions and 0 deletions

View File

@ -141,6 +141,9 @@ class APIDefaultConstructorTestCase(TestBase):
if self.TraceOn():
print obj
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_frame
sb_frame.fuzz_obj(obj)
@python_api_test
def test_SBFunction(self):
@ -148,6 +151,9 @@ class APIDefaultConstructorTestCase(TestBase):
if self.TraceOn():
print obj
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_function
sb_function.fuzz_obj(obj)
@python_api_test
def test_SBInputReader(self):

View File

@ -0,0 +1,34 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetFrameID()
obj.GetPC()
obj.SetPC(0xffffffff)
obj.GetSP()
obj.GetFP()
obj.GetPCAddress()
obj.GetSymbolContext(0)
obj.GetModule()
obj.GetCompileUnit()
obj.GetFunction()
obj.GetSymbol()
obj.GetBlock()
obj.GetFunctionName()
obj.IsInlined()
obj.EvaluateExpression("x + y")
obj.EvaluateExpression("x + y", lldb.eDynamicCanRunTarget)
obj.GetFrameBlock()
obj.GetLineEntry()
obj.GetThread()
obj.Disassemble()
obj.GetVariables(True, True, True, True)
obj.GetVariables(True, True, True, False, lldb.eDynamicCanRunTarget)
obj.GetRegisters()
obj.FindVariable("my_var")
obj.FindVariable("my_var", lldb.eDynamicCanRunTarget)
obj.GetDescription(lldb.SBStream())

View File

@ -0,0 +1,19 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.GetName()
obj.GetMangledName()
obj.GetInstructions(lldb.SBTarget())
sa = obj.GetStartAddress()
ea = obj.GetEndAddress()
# Do fuzz testing on the address obj, it should not crash lldb.
import sb_address
sb_address.fuzz_obj(sa)
sb_address.fuzz_obj(ea)
obj.GetPrologueByteSize
obj.GetDescription(lldb.SBStream())