[Lldb-commits] [lldb] r134040 - in /lldb/trunk/test/python_api/default-constructor: TestDefaultConstructorForAPIObjects.py sb_address.py sb_broadcaster.py sb_debugger.py sb_error.py sb_event.py sb_frame.py sb_instructionlist.py sb_process.py sb_stringlist.py
Johnny Chen
johnny.chen at apple.com
Tue Jun 28 16:29:14 PDT 2011
Author: johnny
Date: Tue Jun 28 18:29:14 2011
New Revision: 134040
URL: http://llvm.org/viewvc/llvm-project?rev=134040&view=rev
Log:
Add fuzz calls for SBStringList and add obj.Clear() calls for some files.
Added:
lldb/trunk/test/python_api/default-constructor/sb_stringlist.py
Modified:
lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
lldb/trunk/test/python_api/default-constructor/sb_address.py
lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py
lldb/trunk/test/python_api/default-constructor/sb_debugger.py
lldb/trunk/test/python_api/default-constructor/sb_error.py
lldb/trunk/test/python_api/default-constructor/sb_event.py
lldb/trunk/test/python_api/default-constructor/sb_frame.py
lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py
lldb/trunk/test/python_api/default-constructor/sb_process.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=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Tue Jun 28 18:29:14 2011
@@ -239,6 +239,9 @@
if self.TraceOn():
print obj
self.assertFalse(obj)
+ # Do fuzz testing on the invalid obj, it should not crash lldb.
+ import sb_stringlist
+ sb_stringlist.fuzz_obj(obj)
@python_api_test
def test_SBSymbol(self):
Modified: 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=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_address.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_address.py Tue Jun 28 18:29:14 2011
@@ -10,3 +10,4 @@
obj.GetLoadAddress(lldb.SBTarget())
obj.OffsetAddress(sys.maxint)
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
Modified: lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py?rev=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py Tue Jun 28 18:29:14 2011
@@ -17,3 +17,4 @@
obj.EventTypeHasListeners(0)
obj.RemoveListener(listener, 0xffffffff)
obj.RemoveListener(listener, 0)
+ obj.Clear()
Modified: lldb/trunk/test/python_api/default-constructor/sb_debugger.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_debugger.py?rev=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_debugger.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_debugger.py Tue Jun 28 18:29:14 2011
@@ -49,3 +49,4 @@
obj.GetCloseInputOnEOF()
obj.SetCloseInputOnEOF(True)
obj.SetCloseInputOnEOF(False)
+ obj.Clear()
Modified: lldb/trunk/test/python_api/default-constructor/sb_error.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_error.py?rev=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_error.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_error.py Tue Jun 28 18:29:14 2011
@@ -17,3 +17,4 @@
obj.SetErrorString("xyz")
obj.SetErrorStringWithFormat("%s!", "error")
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
Modified: lldb/trunk/test/python_api/default-constructor/sb_event.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_event.py?rev=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_event.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_event.py Tue Jun 28 18:29:14 2011
@@ -15,3 +15,4 @@
obj.BroadcasterMatchesPtr(None)
obj.BroadcasterMatchesRef(broadcaster)
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
Modified: 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=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_frame.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_frame.py Tue Jun 28 18:29:14 2011
@@ -32,3 +32,4 @@
obj.FindVariable("my_var")
obj.FindVariable("my_var", lldb.eDynamicCanRunTarget)
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
Modified: lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py?rev=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py Tue Jun 28 18:29:14 2011
@@ -12,3 +12,4 @@
obj.Print(None)
obj.GetDescription(lldb.SBStream())
obj.DumpEmulationForAllInstructions("armv7")
+ obj.Clear()
Modified: lldb/trunk/test/python_api/default-constructor/sb_process.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_process.py?rev=134040&r1=134039&r2=134040&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_process.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_process.py Tue Jun 28 18:29:14 2011
@@ -40,3 +40,4 @@
obj.GetDescription(lldb.SBStream())
obj.LoadImage(lldb.SBFileSpec(), error)
obj.UnloadImage(0)
+ obj.Clear()
Added: lldb/trunk/test/python_api/default-constructor/sb_stringlist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_stringlist.py?rev=134040&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_stringlist.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_stringlist.py Tue Jun 28 18:29:14 2011
@@ -0,0 +1,14 @@
+"""
+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.AppendString("another string")
+ obj.AppendList(None, 0)
+ obj.AppendList(lldb.SBStringList())
+ obj.GetSize()
+ obj.GetStringAtIndex(0xffffffff)
+ obj.Clear()
More information about the lldb-commits
mailing list