[Lldb-commits] [lldb] r133778 - in /lldb/trunk/test/python_api/default-constructor: TestDefaultConstructorForAPIObjects.py sb_address.py

Johnny Chen johnny.chen at apple.com
Thu Jun 23 17:06:53 PDT 2011


Author: johnny
Date: Thu Jun 23 19:06:53 2011
New Revision: 133778

URL: http://llvm.org/viewvc/llvm-project?rev=133778&view=rev
Log:
Start adding API calls to the invalid SB API object after default construction.
It should not crash lldb.

This checkin adds calls for SBAddress.

Added:
    lldb/trunk/test/python_api/default-constructor/sb_address.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=133778&r1=133777&r2=133778&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Thu Jun 23 19:06:53 2011
@@ -22,6 +22,9 @@
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_address
+        sb_address.fuzz_obj(obj)
 
     @python_api_test
     def test_SBBlock(self):

Added: lldb/trunk/test/python_api/default-constructor/sb_address.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_address.py?rev=133778&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_address.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_address.py Thu Jun 23 19:06:53 2011
@@ -0,0 +1,12 @@
+"""
+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.GetFileAddress()
+    obj.GetLoadAddress(lldb.SBTarget())
+    obj.OffsetAddress(sys.maxint)
+    obj.GetDescription(lldb.SBStream())





More information about the lldb-commits mailing list