[Lldb-commits] [lldb] r133965 - in /lldb/trunk/test/python_api/default-constructor: TestDefaultConstructorForAPIObjects.py sb_frame.py sb_function.py

Johnny Chen johnny.chen at apple.com
Mon Jun 27 16:53:55 PDT 2011


Author: johnny
Date: Mon Jun 27 18:53:55 2011
New Revision: 133965

URL: http://llvm.org/viewvc/llvm-project?rev=133965&view=rev
Log:
Add fuzz calls for SBFrame and SBFunction.

Added:
    lldb/trunk/test/python_api/default-constructor/sb_frame.py
    lldb/trunk/test/python_api/default-constructor/sb_function.py
Modified:
    lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py

Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=133965&r1=133964&r2=133965&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Mon Jun 27 18:53:55 2011
@@ -141,6 +141,9 @@
         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 @@
         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):

Added: lldb/trunk/test/python_api/default-constructor/sb_frame.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_frame.py?rev=133965&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_frame.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_frame.py Mon Jun 27 18:53:55 2011
@@ -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())

Added: lldb/trunk/test/python_api/default-constructor/sb_function.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_function.py?rev=133965&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_function.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_function.py Mon Jun 27 18:53:55 2011
@@ -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())





More information about the lldb-commits mailing list