solenv/gdb/libreoffice/vcl.py | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
New commits: commit 40f093ae2c4a6b6a3178db7a0b8be384dc75ef04 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Mar 26 18:12:06 2025 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Apr 2 15:51:57 2025 +0200 solenv: gdb: add Region prettyprinter Works for RegionBand, which is the common case apparently. Change-Id: I1b26f6ff8486094003685522ed23e44c2040db6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183621 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/solenv/gdb/libreoffice/vcl.py b/solenv/gdb/libreoffice/vcl.py index ce595747587a..899c1a77f16a 100644 --- a/solenv/gdb/libreoffice/vcl.py +++ b/solenv/gdb/libreoffice/vcl.py @@ -106,6 +106,70 @@ class ImplSchedulerContextPrinter(object): res = res + key.replace('TaskPriority::', '') + ", " + str(first.dereference()) return res + "}" +class ImplRegionBandPrinter(object): + + class iterator(six.Iterator): + '''RegionBand iterator''' + + def __init__(self, first): + self.pimplband = first + if self.pimplband: + self.sep = self.pimplband.dereference()['mpFirstSep'] + else: + self.sep = None + + def __iter__(self): + return self + + def __next__(self): + if not(self.pimplband): + raise StopIteration + implband = self.pimplband.dereference() + top = implband['mnYTop'] + bot = implband['mnYBottom'] + touched = implband['mbTouched'] + if self.sep: + sep = self.sep.dereference() + left = sep['mnXLeft'] + right = sep['mnXRight'] + removed = sep['mbRemoved'] + self.sep = self.sep.dereference()['mpNextSep'] + return ('Y [%d,%d] %s' % (top,bot,touched), 'X (%d,%d) %s' % (left,right,removed)) + else: + self.pimplband = self.pimplband.dereference()['mpNextBand'] + if self.pimplband: + self.sep = self.pimplband.dereference()['mpFirstSep'] + return ('Y [%d,%d] %s' % (top,bot,touched), 'END') + + def __init__(self, typename, value): + self.typename = typename + self.value = value + + def children(self): + first = self.value['mpFirstBand'] + return self.iterator(first) + +class ImplRegionPrinter(object): + + def __init__(self, typename, value): + self.typename = typename + self.value = value + + def children(self): + b2dpp = self.value['mpB2DPolyPolygon'] + polypoly = self.value['mpPolyPolygon'] + regionband = self.value['mpRegionBand'] + children = [('mbIsNull', self.value['mbIsNull'])] + if b2dpp: + # TODO: dereference() doesn't work on std::optional + children.append(('mpB2DPolyPolygon', b2dpp)) + if polypoly: + children.append(('mpPolyPolygon', polypoly)) + if regionband['_M_ptr']: + children.append(('mpRegionBand', regionband['_M_ptr'].dereference())) + return children.__iter__() + + printer = None def build_pretty_printers(): @@ -114,6 +178,8 @@ def build_pretty_printers(): printer = printing.Printer("libreoffice/vcl") printer.add('ImplSchedulerData', ImplSchedulerDataPrinter) printer.add('ImplSchedulerContext', ImplSchedulerContextPrinter) + printer.add('RegionBand', ImplRegionBandPrinter) + printer.add('vcl::Region', ImplRegionPrinter) def register_pretty_printers(obj): printing.register_pretty_printer(printer, obj)