summaryrefslogtreecommitdiff
path: root/solenv/gdb
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-23 10:38:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-23 13:19:56 +0200
commit00aa9f622c29aecc6bb9c5ee4b3aa35a9afb095d (patch)
tree6b10baae17781ad810d0f7b7c08cc30945fa6246 /solenv/gdb
parentb0730ff656848f005838b10bef0cf88f5ac0ba32 (diff)
Revert "used std::map in SfxItemSet"
This reverts commit 2757ee9fe610e253e4ccc37423fa420004d0f388. Besides causing a performance regression, I now notice that there is code in SW that relies on iterating over two different SfxItemSet's in parallel, and assumes that missing items are returned as nullptr, which is not the case for my std::map based change. Change-Id: I2b1110350fe4c4b74e5508558e9661ef1e1a103e
Diffstat (limited to 'solenv/gdb')
-rw-r--r--solenv/gdb/libreoffice/svl.py44
1 files changed, 42 insertions, 2 deletions
diff --git a/solenv/gdb/libreoffice/svl.py b/solenv/gdb/libreoffice/svl.py
index f7d5dbcc5e90..05049652c434 100644
--- a/solenv/gdb/libreoffice/svl.py
+++ b/solenv/gdb/libreoffice/svl.py
@@ -34,8 +34,48 @@ class ItemSetPrinter(object):
return whiches
def children(self):
- children = [ ( 'items', self.value['m_aItems'] ) ]
- return children.__iter__()
+ whichranges = self.which_ranges()
+ size = 0
+ whichids = []
+ for (whichfrom, whichto) in whichranges:
+ size += whichto - whichfrom + 1
+ whichids += [which for which in range(whichfrom, whichto+1)]
+ return self._iterator(self.value['m_pItems'], size, whichids)
+
+ class _iterator(six.Iterator):
+
+ def __init__(self, data, count, whichids):
+ self.data = data
+ self.whichids = whichids
+ self.count = count
+ self.pos = 0
+ self._check_invariant()
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ if self.pos == self.count:
+ raise StopIteration()
+
+ which = self.whichids[self.pos]
+ elem = self.data[self.pos]
+ self.pos = self.pos + 1
+
+ self._check_invariant()
+ if (elem == -1):
+ elem = "(Invalid)"
+ elif (elem != 0):
+ # let's try how well that works...
+ elem = elem.cast(elem.dynamic_type).dereference()
+ return (str(which), elem)
+
+ def _check_invariant(self):
+ assert self.count >= 0
+ assert self.data
+ assert self.pos >= 0
+ assert self.pos <= self.count
+ assert len(self.whichids) == self.count
printer = None