summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py6
-rw-r--r--lldb/test/python_api/default-constructor/sb_instruction.py16
-rw-r--r--lldb/test/python_api/default-constructor/sb_instructionlist.py14
3 files changed, 36 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index a5717c50bcb..df8b42eb70f 100644
--- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -171,6 +171,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_instruction
+ sb_instruction.fuzz_obj(obj)
@python_api_test
def test_SBInstructionList(self):
@@ -178,6 +181,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_instructionlist
+ sb_instructionlist.fuzz_obj(obj)
@python_api_test
def test_SBLineEntry(self):
diff --git a/lldb/test/python_api/default-constructor/sb_instruction.py b/lldb/test/python_api/default-constructor/sb_instruction.py
new file mode 100644
index 00000000000..91d2930cb2f
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_instruction.py
@@ -0,0 +1,16 @@
+"""
+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.GetAddress()
+ obj.GetByteSize
+ obj.DoesBranch()
+ obj.Print(None)
+ obj.GetDescription(lldb.SBStream())
+ obj.EmulateWithFrame(lldb.SBFrame(), 0)
+ obj.DumpEmulation("armv7")
+ obj.TestEmulation(lldb.SBStream(), "my-file")
diff --git a/lldb/test/python_api/default-constructor/sb_instructionlist.py b/lldb/test/python_api/default-constructor/sb_instructionlist.py
new file mode 100644
index 00000000000..b9c20b77056
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_instructionlist.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.GetSize()
+ obj.GetInstructionAtIndex(0xffffffff)
+ obj.AppendInstruction(lldb.SBInstruction())
+ obj.Print(None)
+ obj.GetDescription(lldb.SBStream())
+ obj.DumpEmulationForAllInstructions("armv7")
OpenPOWER on IntegriCloud