4 class jasSynthProvider
:
5 def __init__(self
, valobj
, dict):
8 def num_children(self
):
11 def get_child_at_index(self
, index
):
14 child
= self
.valobj
.GetChildMemberWithName("A")
16 child
= self
.valobj
.CreateValueFromExpression("X", "(int)1")
19 def get_child_index(self
, name
):
27 def ccc_summary(sbvalue
, internal_dict
):
28 sbvalue
= sbvalue
.GetNonSyntheticValue()
29 # This tests that the SBValue.GetNonSyntheticValue() actually returns a
30 # non-synthetic value. If it does not, then sbvalue.GetChildMemberWithName("a")
31 # in the following statement will call the 'get_child_index' method of the
32 # synthetic child provider CCCSynthProvider below (which return the "b" field").
33 return "CCC object with leading value " + str(sbvalue
.GetChildMemberWithName("a"))
36 def ccc_synthetic(sbvalue
, internal_dict
):
37 sbvalue
= sbvalue
.GetSyntheticValue()
38 # This tests that the SBValue.GetSyntheticValue() actually returns a
39 # synthetic value. If it does, then sbvalue.GetChildMemberWithName("a")
40 # in the following statement will call the 'get_child_index' method of the
41 # synthetic child provider CCCSynthProvider below (which return the "b" field").
42 return "CCC object with leading synthetic value " + str(
43 sbvalue
.GetChildMemberWithName("a")
47 def bar_int_synthetic(sbvalue
, internal_dict
):
48 sbvalue
= sbvalue
.GetSyntheticValue()
49 # This tests that the SBValue.GetSyntheticValue() actually returns no
50 # value when the value has no synthetic representation.
51 return "bar_int synthetic: " + str(sbvalue
)
54 class CCCSynthProvider(object):
55 def __init__(self
, sbvalue
, internal_dict
):
56 self
._sbvalue
= sbvalue
58 def num_children(self
):
61 def get_child_index(self
, name
):
65 raise RuntimeError("I don't want to be called!")
67 def get_child_at_index(self
, index
):
69 return self
._sbvalue
.GetChildMemberWithName("a")
71 return self
._sbvalue
.GetChildMemberWithName("b")
73 return self
._sbvalue
.GetChildMemberWithName("c")
76 def empty1_summary(sbvalue
, internal_dict
):
77 return "I am an empty Empty1"
80 class Empty1SynthProvider(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 empty2_summary(sbvalue
, internal_dict
):
92 return "I am an empty Empty2"
95 class Empty2SynthProvider(object):
96 def __init__(self
, sbvalue
, internal_dict
):
97 self
._sbvalue
= sbvalue
99 def num_children(self
):
102 def get_child_at_index(self
, index
):
106 def __lldb_init_module(debugger
, dict):
107 debugger
.CreateCategory("JASSynth").AddTypeSynthetic(
108 lldb
.SBTypeNameSpecifier("JustAStruct"),
109 lldb
.SBTypeSynthetic
.CreateWithClassName("synth.jasSynthProvider"),
111 cat
= debugger
.CreateCategory("CCCSynth")
112 cat
.AddTypeSynthetic(
113 lldb
.SBTypeNameSpecifier("CCC"),
114 lldb
.SBTypeSynthetic
.CreateWithClassName(
115 "synth.CCCSynthProvider", lldb
.eTypeOptionCascade
119 lldb
.SBTypeNameSpecifier("CCC"),
120 lldb
.SBTypeSummary
.CreateWithFunctionName(
121 "synth.ccc_summary", lldb
.eTypeOptionCascade
124 cat
.AddTypeSynthetic(
125 lldb
.SBTypeNameSpecifier("Empty1"),
126 lldb
.SBTypeSynthetic
.CreateWithClassName("synth.Empty1SynthProvider"),
129 lldb
.SBTypeNameSpecifier("Empty1"),
130 lldb
.SBTypeSummary
.CreateWithFunctionName("synth.empty1_summary"),
132 cat
.AddTypeSynthetic(
133 lldb
.SBTypeNameSpecifier("Empty2"),
134 lldb
.SBTypeSynthetic
.CreateWithClassName("synth.Empty2SynthProvider"),
137 lldb
.SBTypeNameSpecifier("Empty2"),
138 lldb
.SBTypeSummary
.CreateWithFunctionName(
139 "synth.empty2_summary", lldb
.eTypeOptionHideEmptyAggregates
142 cat2
= debugger
.CreateCategory("CCCSynth2")
143 cat2
.AddTypeSynthetic(
144 lldb
.SBTypeNameSpecifier("CCC"),
145 lldb
.SBTypeSynthetic
.CreateWithClassName(
146 "synth.CCCSynthProvider", lldb
.eTypeOptionCascade
150 lldb
.SBTypeNameSpecifier("CCC"),
151 lldb
.SBTypeSummary
.CreateWithFunctionName(
152 "synth.ccc_synthetic", lldb
.eTypeOptionCascade
155 cat3
= debugger
.CreateCategory("BarIntSynth")
157 lldb
.SBTypeNameSpecifier("int"),
158 lldb
.SBTypeSummary
.CreateWithFunctionName(
159 "synth.bar_int_synthetic", lldb
.eTypeOptionCascade