diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api/formatters/synth.py')
-rw-r--r-- | packages/Python/lldbsuite/test/python_api/formatters/synth.py | 96 |
1 files changed, 54 insertions, 42 deletions
diff --git a/packages/Python/lldbsuite/test/python_api/formatters/synth.py b/packages/Python/lldbsuite/test/python_api/formatters/synth.py index 5a30c9a94bb5..33a45e9c93de 100644 --- a/packages/Python/lldbsuite/test/python_api/formatters/synth.py +++ b/packages/Python/lldbsuite/test/python_api/formatters/synth.py @@ -1,23 +1,28 @@ import lldb + class jasSynthProvider: - def __init__(self, valobj, dict): - self.valobj = valobj; - def num_children(self): - return 2; - def get_child_at_index(self, index): - child = None - if index == 0: - child = self.valobj.GetChildMemberWithName('A'); - if index == 1: - child = self.valobj.CreateValueFromExpression('X', '(int)1') - return child; - def get_child_index(self, name): - if name == 'A': - return 0; - if name == 'X': - return 1; - return None; + + def __init__(self, valobj, dict): + self.valobj = valobj + + def num_children(self): + return 2 + + def get_child_at_index(self, index): + child = None + if index == 0: + child = self.valobj.GetChildMemberWithName('A') + if index == 1: + child = self.valobj.CreateValueFromExpression('X', '(int)1') + return child + + def get_child_index(self, name): + if name == 'A': + return 0 + if name == 'X': + return 1 + return None def ccc_summary(sbvalue, internal_dict): @@ -25,11 +30,14 @@ def ccc_summary(sbvalue, internal_dict): # This tests that the SBValue.GetNonSyntheticValue() actually returns a # non-synthetic value. If it does not, then sbvalue.GetChildMemberWithName("a") # in the following statement will call the 'get_child_index' method of the - # synthetic child provider CCCSynthProvider below (which raises an exception). - return "CCC object with leading value " + str(sbvalue.GetChildMemberWithName("a")) + # synthetic child provider CCCSynthProvider below (which raises an + # exception). + return "CCC object with leading value " + \ + str(sbvalue.GetChildMemberWithName("a")) class CCCSynthProvider(object): + def __init__(self, sbvalue, internal_dict): self._sbvalue = sbvalue @@ -53,6 +61,7 @@ def empty1_summary(sbvalue, internal_dict): class Empty1SynthProvider(object): + def __init__(self, sbvalue, internal_dict): self._sbvalue = sbvalue @@ -68,6 +77,7 @@ def empty2_summary(sbvalue, internal_dict): class Empty2SynthProvider(object): + def __init__(self, sbvalue, internal_dict): self._sbvalue = sbvalue @@ -78,28 +88,30 @@ class Empty2SynthProvider(object): return None -def __lldb_init_module(debugger,dict): - debugger.CreateCategory("JASSynth").AddTypeSynthetic(lldb.SBTypeNameSpecifier("JustAStruct"), +def __lldb_init_module(debugger, dict): + debugger.CreateCategory("JASSynth").AddTypeSynthetic( + lldb.SBTypeNameSpecifier("JustAStruct"), lldb.SBTypeSynthetic.CreateWithClassName("synth.jasSynthProvider")) - cat = lldb.debugger.CreateCategory("CCCSynth") - cat.AddTypeSynthetic( - lldb.SBTypeNameSpecifier("CCC"), - lldb.SBTypeSynthetic.CreateWithClassName("synth.CCCSynthProvider", + cat = lldb.debugger.CreateCategory("CCCSynth") + cat.AddTypeSynthetic( + lldb.SBTypeNameSpecifier("CCC"), + lldb.SBTypeSynthetic.CreateWithClassName("synth.CCCSynthProvider", + lldb.eTypeOptionCascade)) + cat.AddTypeSummary( + lldb.SBTypeNameSpecifier("CCC"), + lldb.SBTypeSummary.CreateWithFunctionName("synth.ccc_summary", lldb.eTypeOptionCascade)) - cat.AddTypeSummary( - lldb.SBTypeNameSpecifier("CCC"), - lldb.SBTypeSummary.CreateWithFunctionName("synth.ccc_summary", - lldb.eTypeOptionCascade)) - cat.AddTypeSynthetic( - lldb.SBTypeNameSpecifier("Empty1"), - lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty1SynthProvider")) - cat.AddTypeSummary( - lldb.SBTypeNameSpecifier("Empty1"), - lldb.SBTypeSummary.CreateWithFunctionName("synth.empty1_summary")) - cat.AddTypeSynthetic( - lldb.SBTypeNameSpecifier("Empty2"), - lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty2SynthProvider")) - cat.AddTypeSummary( - lldb.SBTypeNameSpecifier("Empty2"), - lldb.SBTypeSummary.CreateWithFunctionName("synth.empty2_summary", - lldb.eTypeOptionHideEmptyAggregates)) + cat.AddTypeSynthetic( + lldb.SBTypeNameSpecifier("Empty1"), + lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty1SynthProvider")) + cat.AddTypeSummary( + lldb.SBTypeNameSpecifier("Empty1"), + lldb.SBTypeSummary.CreateWithFunctionName("synth.empty1_summary")) + cat.AddTypeSynthetic( + lldb.SBTypeNameSpecifier("Empty2"), + lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty2SynthProvider")) + cat.AddTypeSummary( + lldb.SBTypeNameSpecifier("Empty2"), + lldb.SBTypeSummary.CreateWithFunctionName( + "synth.empty2_summary", + lldb.eTypeOptionHideEmptyAggregates)) |