4 class jasSynthProvider
:
6 def __init__(self
, valobj
, dict):
9 def num_children(self
):
12 def get_child_at_index(self
, index
):
15 child
= self
.valobj
.GetChildMemberWithName('A')
17 child
= self
.valobj
.CreateValueFromExpression('X', '(int)1')
20 def get_child_index(self
, name
):
28 def ccc_summary(sbvalue
, internal_dict
):
29 sbvalue
= sbvalue
.GetNonSyntheticValue()
30 # This tests that the SBValue.GetNonSyntheticValue() actually returns a
31 # non-synthetic value. If it does not, then sbvalue.GetChildMemberWithName("a")
32 # in the following statement will call the 'get_child_index' method of the
33 # synthetic child provider CCCSynthProvider below (which raises an
35 return "CCC object with leading value " + \
36 str(sbvalue
.GetChildMemberWithName("a"))
39 class CCCSynthProvider(object):
41 def __init__(self
, sbvalue
, internal_dict
):
42 self
._sbvalue
= sbvalue
44 def num_children(self
):
47 def get_child_index(self
, name
):
48 raise RuntimeError("I don't want to be called!")
50 def get_child_at_index(self
, index
):
52 return self
._sbvalue
.GetChildMemberWithName("a")
54 return self
._sbvalue
.GetChildMemberWithName("b")
56 return self
._sbvalue
.GetChildMemberWithName("c")
59 def empty1_summary(sbvalue
, internal_dict
):
60 return "I am an empty Empty1"
63 class Empty1SynthProvider(object):
65 def __init__(self
, sbvalue
, internal_dict
):
66 self
._sbvalue
= sbvalue
68 def num_children(self
):
71 def get_child_at_index(self
, index
):
75 def empty2_summary(sbvalue
, internal_dict
):
76 return "I am an empty Empty2"
79 class Empty2SynthProvider(object):
81 def __init__(self
, sbvalue
, internal_dict
):
82 self
._sbvalue
= sbvalue
84 def num_children(self
):
87 def get_child_at_index(self
, index
):
91 def __lldb_init_module(debugger
, dict):
92 debugger
.CreateCategory("JASSynth").AddTypeSynthetic(
93 lldb
.SBTypeNameSpecifier("JustAStruct"),
94 lldb
.SBTypeSynthetic
.CreateWithClassName("synth.jasSynthProvider"))
95 cat
= debugger
.CreateCategory("CCCSynth")
97 lldb
.SBTypeNameSpecifier("CCC"),
98 lldb
.SBTypeSynthetic
.CreateWithClassName("synth.CCCSynthProvider",
99 lldb
.eTypeOptionCascade
))
101 lldb
.SBTypeNameSpecifier("CCC"),
102 lldb
.SBTypeSummary
.CreateWithFunctionName("synth.ccc_summary",
103 lldb
.eTypeOptionCascade
))
104 cat
.AddTypeSynthetic(
105 lldb
.SBTypeNameSpecifier("Empty1"),
106 lldb
.SBTypeSynthetic
.CreateWithClassName("synth.Empty1SynthProvider"))
108 lldb
.SBTypeNameSpecifier("Empty1"),
109 lldb
.SBTypeSummary
.CreateWithFunctionName("synth.empty1_summary"))
110 cat
.AddTypeSynthetic(
111 lldb
.SBTypeNameSpecifier("Empty2"),
112 lldb
.SBTypeSynthetic
.CreateWithClassName("synth.Empty2SynthProvider"))
114 lldb
.SBTypeNameSpecifier("Empty2"),
115 lldb
.SBTypeSummary
.CreateWithFunctionName(
116 "synth.empty2_summary",
117 lldb
.eTypeOptionHideEmptyAggregates
))