diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-11-08 18:20:22 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-11-08 19:01:33 +0100 |
commit | 020a02c3477284daa3465e48afcc8257fb5a6201 (patch) | |
tree | 650d87408fb620a12efd82a36be81fc4078e0715 /solenv/gdb | |
parent | 899d7139355b8bea4bc1e6f9c05dededdb6f2c39 (diff) |
gdb pretty-printers: avoid segfauls in B2DPolygonPrinter
gdb 8.0.1 tends to sefault while evaluating the getB2DPoint()
calls; it passes some obviously wrong index instead of 0.
Also, add a children method to B2DPolyPolygonPrinter.
Change-Id: Ifbf52ad384d1f60b26ee95f87405eff2c6f2388a
Diffstat (limited to 'solenv/gdb')
-rw-r--r-- | solenv/gdb/libreoffice/basegfx.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/solenv/gdb/libreoffice/basegfx.py b/solenv/gdb/libreoffice/basegfx.py index ec564b99c903..81901fe8dae8 100644 --- a/solenv/gdb/libreoffice/basegfx.py +++ b/solenv/gdb/libreoffice/basegfx.py @@ -86,12 +86,12 @@ class B2DPolygonPrinter(object): def __next__(self): if self.index >= self.count: raise StopIteration() - currPoint = gdb.parse_and_eval( - '((basegfx::B2DPolygon*)%d)->getB2DPoint(%d)' % ( - self.value.address, self.index)) - currPoint = gdb.parse_and_eval( - '((basegfx::B2DPolygon*)%d)->getB2DPoint(%d)' % ( - self.value.address, self.index)) + points = self.value['mpPolygon']['m_pimpl'].dereference()['m_value']['maPoints']['maVector'] + currPoint = (points['_M_impl']['_M_start'] + self.index).dereference() + # doesn't work? + #currPoint = gdb.parse_and_eval( + # '((basegfx::B2DPolygon*)%d)->getB2DPoint(%d)' % ( + # self.value.address, self.index)) self.index += 1 return ('point %d' % (self.index-1), '(%15f, %15f)' % (currPoint['mfX'], currPoint['mfY'])) @@ -108,9 +108,11 @@ class B2DPolygonPrinter(object): def __next__(self): if self.index >= self.count: raise StopIteration() - currPoint = gdb.parse_and_eval( - '((basegfx::B2DPolygon*)%d)->getB2DPoint(%d)' % ( - self.value.address, self.index)) + points = self.value['mpPolygon']['m_pimpl'].dereference()['m_value']['maPoints']['maVector'] + currPoint = (points['_M_impl']['_M_start'] + self.index).dereference() + #currPoint = gdb.parse_and_eval( + # '((basegfx::B2DPolygon*)%d)->getB2DPoint(%d)' % ( + # self.value.address, self.index)) prevControl = gdb.parse_and_eval( '((basegfx::B2DPolygon*)%d)->getPrevControlPoint(%d)' % ( self.value.address, self.index)) @@ -150,6 +152,12 @@ class B2DPolyPolygonPrinter(object): def _isEmpty(self): return self._count() == 0 + def children(self): + impl = self.value['mpPolyPolygon']['m_pimpl'] + vector = self.value['mpPolyPolygon']['m_pimpl'].dereference()['m_value']['maPolygons'] + import libstdcxx.v6.printers as std + return std.StdVectorPrinter("std::vector", vector).children() + printer = None def build_pretty_printers(): |