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