diff options
Diffstat (limited to 'lldb')
3 files changed, 59 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index e7c65495283..7e62453d089 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -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): diff --git a/lldb/test/python_api/default-constructor/sb_frame.py b/lldb/test/python_api/default-constructor/sb_frame.py new file mode 100644 index 00000000000..e433e63dab7 --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_frame.py @@ -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()) diff --git a/lldb/test/python_api/default-constructor/sb_function.py b/lldb/test/python_api/default-constructor/sb_function.py new file mode 100644 index 00000000000..fb88d37ac19 --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_function.py @@ -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()) |