summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/default-constructor
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-06-29 21:19:39 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-06-29 21:19:39 +0000
commit6999f86617f371784be2b6f8d2ae38c8030dfd31 (patch)
tree02cbdbc515bda5998169028d22c01ea29d7ee011 /lldb/test/python_api/default-constructor
parent1b8b9419bab268fcbd78022669a30433b40ad875 (diff)
downloadbcm5719-llvm-6999f86617f371784be2b6f8d2ae38c8030dfd31.tar.gz
bcm5719-llvm-6999f86617f371784be2b6f8d2ae38c8030dfd31.zip
Add fuzz calls to SBType, SBValue, and SBValueList.
Fixed crashes for SBValue fuzz calls. And change 'bool SBType::IsPointerType(void)' to 'bool SBType::IsAPointerType(void)' to avoid name collision with the static 'bool SBType::IsPointerType(void *)' function, which SWIG cannot handle. llvm-svn: 134096
Diffstat (limited to 'lldb/test/python_api/default-constructor')
-rw-r--r--lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py9
-rw-r--r--lldb/test/python_api/default-constructor/sb_type.py19
-rw-r--r--lldb/test/python_api/default-constructor/sb_value.py35
-rw-r--r--lldb/test/python_api/default-constructor/sb_valuelist.py12
4 files changed, 75 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index f46ce835abf..f49a3a20d72 100644
--- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -297,6 +297,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_type
+ sb_type.fuzz_obj(obj)
@python_api_test
def test_SBValue(self):
@@ -304,6 +307,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_value
+ sb_value.fuzz_obj(obj)
@python_api_test
def test_SBValueList(self):
@@ -311,6 +317,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_valuelist
+ sb_valuelist.fuzz_obj(obj)
if __name__ == '__main__':
diff --git a/lldb/test/python_api/default-constructor/sb_type.py b/lldb/test/python_api/default-constructor/sb_type.py
new file mode 100644
index 00000000000..689b48cbddf
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_type.py
@@ -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.GetByteSize()
+ #obj.GetEncoding(5)
+ obj.GetNumberChildren(True)
+ member = lldb.SBTypeMember()
+ obj.GetChildAtIndex(True, 0, member)
+ obj.GetChildIndexForName(True, "_member_field")
+ obj.IsAPointerType()
+ obj.GetPointeeType()
+ obj.GetDescription(lldb.SBStream())
+
diff --git a/lldb/test/python_api/default-constructor/sb_value.py b/lldb/test/python_api/default-constructor/sb_value.py
new file mode 100644
index 00000000000..f3929a6cb29
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_value.py
@@ -0,0 +1,35 @@
+"""
+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.GetError()
+ obj.GetName()
+ obj.GetTypeName()
+ obj.GetByteSize()
+ obj.IsInScope()
+ obj.GetFormat()
+ obj.SetFormat(lldb.eFormatBoolean)
+ obj.GetValue()
+ obj.GetValueType()
+ obj.GetValueDidChange()
+ obj.GetSummary()
+ obj.GetObjectDescription()
+ obj.GetLocation()
+ obj.SetValueFromCString("my_new_value")
+ obj.GetChildAtIndex(1)
+ obj.GetChildAtIndex(2, lldb.eNoDynamicValues)
+ obj.GetIndexOfChildWithName("my_first_child")
+ obj.GetChildMemberWithName("my_first_child")
+ obj.GetChildMemberWithName("my_first_child", lldb.eNoDynamicValues)
+ obj.GetNumChildren()
+ obj.GetOpaqueType()
+ obj.Dereference()
+ obj.TypeIsPointerType()
+ stream = lldb.SBStream()
+ obj.GetDescription(stream)
+ obj.GetExpressionPath(stream)
+ obj.GetExpressionPath(stream, True)
diff --git a/lldb/test/python_api/default-constructor/sb_valuelist.py b/lldb/test/python_api/default-constructor/sb_valuelist.py
new file mode 100644
index 00000000000..6d659097c18
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_valuelist.py
@@ -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.Append(lldb.SBValue())
+ obj.GetSize()
+ obj.GetValueAtIndex(100)
+ obj.FindValueObjectByUID(200)
OpenPOWER on IntegriCloud