summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py10
-rw-r--r--lldb/test/python_api/default-constructor/sb_typemember.py18
2 files changed, 28 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index f49a3a20d72..b7a73bdd0a8 100644
--- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -302,6 +302,16 @@ class APIDefaultConstructorTestCase(TestBase):
sb_type.fuzz_obj(obj)
@python_api_test
+ def test_SBTypeMember(self):
+ obj = lldb.SBTypeMember()
+ if self.TraceOn():
+ print obj
+ self.assertFalse(obj)
+ # Do fuzz testing on the invalid obj, it should not crash lldb.
+ import sb_typemember
+ sb_typemember.fuzz_obj(obj)
+
+ @python_api_test
def test_SBValue(self):
obj = lldb.SBValue()
if self.TraceOn():
diff --git a/lldb/test/python_api/default-constructor/sb_typemember.py b/lldb/test/python_api/default-constructor/sb_typemember.py
new file mode 100644
index 00000000000..25e3b82005f
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_typemember.py
@@ -0,0 +1,18 @@
+"""
+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.IsBaseClass()
+ obj.IsBitfield()
+ obj.GetBitfieldWidth()
+ obj.GetBitfieldOffset()
+ obj.GetOffset()
+ obj.GetName()
+ obj.GetType()
+ obj.GetParentType()
+ obj.SetName("my_type_member_name")
+ obj.Clear()
OpenPOWER on IntegriCloud