xref: /llvm-project/lldb/test/API/python_api/default-constructor/sb_error.py (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1"""
2Fuzz tests an object after the default construction to make sure it does not crash lldb.
3"""
4
5import lldb
6
7
8def fuzz_obj(obj):
9    obj.GetCString()
10    obj.Fail()
11    obj.Success()
12    obj.GetError()
13    obj.GetType()
14    obj.SetError(5, lldb.eErrorTypeGeneric)
15    obj.SetErrorToErrno()
16    obj.SetErrorToGenericError()
17    obj.SetErrorString("xyz")
18    obj.SetErrorString(None)
19    obj.SetErrorStringWithFormat("%s!", "error")
20    obj.SetErrorStringWithFormat(None)
21    obj.SetErrorStringWithFormat("error")
22    obj.SetErrorStringWithFormat("%s %s", "warning", "danger")
23    obj.SetErrorStringWithFormat("%s %s %s", "danger", "will", "robinson")
24    obj.GetDescription(lldb.SBStream())
25    obj.Clear()
26