brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 9e31a70 Raw
68 lines · python
1"""2Fuzz tests an object after the default construction to make sure it does not crash lldb.3"""4 5import lldb6 7 8def fuzz_obj(obj):9    obj.GetError()10    obj.GetID()11    obj.GetName()12    obj.GetTypeName()13    obj.GetByteSize()14    obj.IsInScope()15    obj.GetFormat()16    obj.SetFormat(lldb.eFormatBoolean)17    obj.GetValue()18    obj.GetValueType()19    obj.GetValueDidChange()20    obj.GetSummary()21    obj.GetObjectDescription()22    obj.GetLocation()23    obj.SetValueFromCString("my_new_value")24    obj.GetChildAtIndex(1)25    obj.GetChildAtIndex(2, lldb.eNoDynamicValues, False)26    obj.GetIndexOfChildWithName("my_first_child")27    obj.GetChildMemberWithName("my_first_child")28    obj.GetChildMemberWithName("my_first_child", lldb.eNoDynamicValues)29    obj.GetNumChildren()30    obj.GetOpaqueType()31    obj.Dereference()32    obj.TypeIsPointerType()33    stream = lldb.SBStream()34    obj.GetDescription(stream)35    obj.GetExpressionPath(stream)36    obj.GetExpressionPath(stream, True)37    error = lldb.SBError()38    obj.Watch(True, True, False, error)39    obj.WatchPointee(True, False, True, error)40    for child_val in obj:41        s = str(child_val)42    error = lldb.SBError()43    obj.GetValueAsSigned(error, 0)44    obj.GetValueAsUnsigned(error, 0)45    obj.GetValueAsSigned(0)46    obj.GetValueAsUnsigned(0)47    obj.GetDynamicValue(lldb.eNoDynamicValues)48    obj.GetStaticValue()49    obj.IsDynamic()50    invalid_type = lldb.SBType()51    obj.CreateChildAtOffset("a", 12, invalid_type)52    obj.Cast(invalid_type)53    obj.CreateValueFromExpression("pt->x", "pt->x")54    obj.CreateValueFromAddress("x", 0x123, invalid_type)55    invalid_data = lldb.SBData()56    obj.CreateValueFromData("x", invalid_data, invalid_type)57    obj.GetValueForExpressionPath("[0]")58    obj.AddressOf()59    obj.GetLoadAddress()60    obj.GetAddress()61    obj.GetPointeeData(0, 1)62    obj.GetData()63    obj.GetTarget()64    obj.GetProcess()65    obj.GetThread()66    obj.GetFrame()67    obj.GetType()68