diff options
Diffstat (limited to 'lldb/examples/synthetic/libcxx.py')
| -rw-r--r-- | lldb/examples/synthetic/libcxx.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lldb/examples/synthetic/libcxx.py b/lldb/examples/synthetic/libcxx.py index 967b7f4b32b..8c58ae52faa 100644 --- a/lldb/examples/synthetic/libcxx.py +++ b/lldb/examples/synthetic/libcxx.py @@ -124,6 +124,10 @@ class stdvector_SynthProvider: except: pass + def has_children(self): + # retrieving the count is quick enough on a std::vector + return self.num_children() > 0 + # Just an example: the actual summary is produced by a summary string: size=${svar%#} def stdvector_SummaryProvider(valobj,dict): prov = stdvector_SynthProvider(valobj,None) @@ -317,6 +321,28 @@ class stdlist_SynthProvider: except: pass + def has_children(self): + logger = lldb.formatters.Logger.Logger() + if self.count == None: + self.update() + try: + next_val = self.head.GetValueAsUnsigned(0) + prev_val = self.tail.GetValueAsUnsigned(0) + if next_val == 0 or prev_val == 0: + return False + if next_val == self.node_address: + return False + # skip all the advanced logic to detect the exact count of children + # in the interest of speed from this point on, we MIGHT have children + # our loop detection logic will still make nothing show up :) + return True + except: + return 0; + if self.count == 0: + return False + return True + + # Just an example: the actual summary is produced by a summary string: size=${svar%#} def stdlist_SummaryProvider(valobj,dict): prov = stdlist_SynthProvider(valobj,None) @@ -477,6 +503,9 @@ class stdmap_SynthProvider: except: return 0; + def has_children(self): + return self.num_children_impl() > 0 + def get_data_type(self): logger = lldb.formatters.Logger.Logger() if self.data_type == None or self.data_size == None: @@ -599,6 +628,11 @@ class stddeque_SynthProvider: return 0 return min(self.count, _deque_capping_size) + def has_children(self): + if self.cont is None: + self.update() + return self.count > 0 + def get_child_index(self,name): logger = lldb.formatters.Logger.Logger() try: @@ -702,6 +736,9 @@ class stdsharedptr_SynthProvider: def num_children(self): return 1 + def has_children(self): + return True + def get_child_index(self,name): if name=="__ptr_": return 0 |

