summaryrefslogtreecommitdiffstats
path: root/lldb/examples/synthetic/gnu_libstdcpp.py
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-10-23 21:54:53 +0000
committerEnrico Granata <egranata@apple.com>2012-10-23 21:54:53 +0000
commit91fe01753d1e86f842ac1d4ca3e7d699d34ab206 (patch)
tree557def416075125a233dfc4643f1d6980a9b45de /lldb/examples/synthetic/gnu_libstdcpp.py
parentafaee3c3dafe4808f700c337c52109cdf692006e (diff)
downloadbcm5719-llvm-91fe01753d1e86f842ac1d4ca3e7d699d34ab206.tar.gz
bcm5719-llvm-91fe01753d1e86f842ac1d4ca3e7d699d34ab206.zip
<rdar://problem/12523238> Commit 2 of 3
Adding the new has_children (or MightHaveChildren() in C++) for the existing synthetic children providers In a few cases, the new call is going to be much more efficient than the previous num_children > 0 check When the optimization was marginal (e.g. std::vector<>), the choice was to use num_children in order to keep implementation details in one function instead of duplicating code Next step is to provide test cases llvm-svn: 166506
Diffstat (limited to 'lldb/examples/synthetic/gnu_libstdcpp.py')
-rw-r--r--lldb/examples/synthetic/gnu_libstdcpp.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/examples/synthetic/gnu_libstdcpp.py b/lldb/examples/synthetic/gnu_libstdcpp.py
index c08a42c6063..0d124d75865 100644
--- a/lldb/examples/synthetic/gnu_libstdcpp.py
+++ b/lldb/examples/synthetic/gnu_libstdcpp.py
@@ -132,6 +132,27 @@ class StdListSynthProvider:
except:
pass
+ def has_children(self):
+ logger = lldb.formatters.Logger.Logger()
+ if self.count == None:
+ self.update ()
+ try:
+ next_val = self.next.GetValueAsUnsigned(0)
+ prev_val = self.prev.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 False
+ if self.count == 0:
+ return False
+ return True
+
class StdVectorSynthProvider:
def __init__(self, valobj, dict):
@@ -225,6 +246,10 @@ class StdVectorSynthProvider:
self.count = 0
except:
pass
+
+
+ def has_children(self):
+ return self.num_children() > 0
class StdMapSynthProvider:
@@ -408,6 +433,8 @@ class StdMapSynthProvider:
x = y;
return x;
+ def has_children(self):
+ return self.num_children() > 0
_map_capping_size = 255
_list_capping_size = 255
OpenPOWER on IntegriCloud