summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py3
-rw-r--r--lldb/test/python_api/default-constructor/sb_address.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_broadcaster.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_debugger.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_error.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_event.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_frame.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_instructionlist.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_process.py1
-rw-r--r--lldb/test/python_api/default-constructor/sb_stringlist.py14
10 files changed, 25 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index d9b866a39cb..56f7fc4f841 100644
--- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -239,6 +239,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_stringlist
+ sb_stringlist.fuzz_obj(obj)
@python_api_test
def test_SBSymbol(self):
diff --git a/lldb/test/python_api/default-constructor/sb_address.py b/lldb/test/python_api/default-constructor/sb_address.py
index 372aafc97c4..0cafa865ac7 100644
--- a/lldb/test/python_api/default-constructor/sb_address.py
+++ b/lldb/test/python_api/default-constructor/sb_address.py
@@ -10,3 +10,4 @@ def fuzz_obj(obj):
obj.GetLoadAddress(lldb.SBTarget())
obj.OffsetAddress(sys.maxint)
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_broadcaster.py b/lldb/test/python_api/default-constructor/sb_broadcaster.py
index 14c7f29e181..27539e855cd 100644
--- a/lldb/test/python_api/default-constructor/sb_broadcaster.py
+++ b/lldb/test/python_api/default-constructor/sb_broadcaster.py
@@ -17,3 +17,4 @@ def fuzz_obj(obj):
obj.EventTypeHasListeners(0)
obj.RemoveListener(listener, 0xffffffff)
obj.RemoveListener(listener, 0)
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_debugger.py b/lldb/test/python_api/default-constructor/sb_debugger.py
index 16060edc644..6d4392abf12 100644
--- a/lldb/test/python_api/default-constructor/sb_debugger.py
+++ b/lldb/test/python_api/default-constructor/sb_debugger.py
@@ -49,3 +49,4 @@ def fuzz_obj(obj):
obj.GetCloseInputOnEOF()
obj.SetCloseInputOnEOF(True)
obj.SetCloseInputOnEOF(False)
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_error.py b/lldb/test/python_api/default-constructor/sb_error.py
index f38d079972e..c160f6e39bd 100644
--- a/lldb/test/python_api/default-constructor/sb_error.py
+++ b/lldb/test/python_api/default-constructor/sb_error.py
@@ -17,3 +17,4 @@ def fuzz_obj(obj):
obj.SetErrorString("xyz")
obj.SetErrorStringWithFormat("%s!", "error")
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_event.py b/lldb/test/python_api/default-constructor/sb_event.py
index e31f3091f2c..ae9d44ea492 100644
--- a/lldb/test/python_api/default-constructor/sb_event.py
+++ b/lldb/test/python_api/default-constructor/sb_event.py
@@ -15,3 +15,4 @@ def fuzz_obj(obj):
obj.BroadcasterMatchesPtr(None)
obj.BroadcasterMatchesRef(broadcaster)
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_frame.py b/lldb/test/python_api/default-constructor/sb_frame.py
index e433e63dab7..9010c938d33 100644
--- a/lldb/test/python_api/default-constructor/sb_frame.py
+++ b/lldb/test/python_api/default-constructor/sb_frame.py
@@ -32,3 +32,4 @@ def fuzz_obj(obj):
obj.FindVariable("my_var")
obj.FindVariable("my_var", lldb.eDynamicCanRunTarget)
obj.GetDescription(lldb.SBStream())
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_instructionlist.py b/lldb/test/python_api/default-constructor/sb_instructionlist.py
index b9c20b77056..59907030f16 100644
--- a/lldb/test/python_api/default-constructor/sb_instructionlist.py
+++ b/lldb/test/python_api/default-constructor/sb_instructionlist.py
@@ -12,3 +12,4 @@ def fuzz_obj(obj):
obj.Print(None)
obj.GetDescription(lldb.SBStream())
obj.DumpEmulationForAllInstructions("armv7")
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_process.py b/lldb/test/python_api/default-constructor/sb_process.py
index d80d8feaf12..a54dae2331c 100644
--- a/lldb/test/python_api/default-constructor/sb_process.py
+++ b/lldb/test/python_api/default-constructor/sb_process.py
@@ -40,3 +40,4 @@ def fuzz_obj(obj):
obj.GetDescription(lldb.SBStream())
obj.LoadImage(lldb.SBFileSpec(), error)
obj.UnloadImage(0)
+ obj.Clear()
diff --git a/lldb/test/python_api/default-constructor/sb_stringlist.py b/lldb/test/python_api/default-constructor/sb_stringlist.py
new file mode 100644
index 00000000000..7676bf2cc37
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_stringlist.py
@@ -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()
OpenPOWER on IntegriCloud