summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-07-18 12:14:41 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2024-07-18 16:38:41 +0200
commitf2ec0058ec60da4f3617b5d68373946e4cfd1c0d (patch)
tree3781875357688300eebd051077a9754880f1f030
parent23ee72264ed802dc7839c1ae73b1b14382cf1f33 (diff)
solenv: gdb: adapt ItemSetPrinter to unordered_map
(regression from commit 290c8f6e048fedf63437e3fdf629555ac89dd3ad) Change-Id: I85f3dd2a719d13f35cf7246e0787604ddb9f47fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170685 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--solenv/gdb/libreoffice/svl.py35
1 files changed, 7 insertions, 28 deletions
diff --git a/solenv/gdb/libreoffice/svl.py b/solenv/gdb/libreoffice/svl.py
index d74238337e0c..38bffbba62a5 100644
--- a/solenv/gdb/libreoffice/svl.py
+++ b/solenv/gdb/libreoffice/svl.py
@@ -33,48 +33,27 @@ class ItemSetPrinter(object):
return whiches
def children(self):
- 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_ppItems'], size, whichids)
+ return self._iterator(self.value['m_aPoolItemMap'])
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 __init__(self, data):
+ self.iter = gdb.default_visualizer(data).children()
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
+ # unordered_map iter is rather weird?
+ (_, key) = self.iter.__next__()
+ (_, elem) = self.iter.__next__()
- 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
+ return ("[" + str(key) + "]", elem)
printer = None