solenv/gdb/libreoffice/basegfx.py |   32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 221f9aa5828aad420d0599f5a24f71b7f83c9244
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Wed Mar 5 21:46:04 2025 +0100
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Fri Mar 7 10:48:08 2025 +0100

    another try for Armin's problem with debuggers and pretty printers
    
    had to refine a typo, also all places with '\{\}\)->' that
    call functions at an incarnation have to be made safe, so
    added this also to getPrevControlPoint/getNextControlPoint
    calls.
    
    see commit 3c82f49fcee3f1e4ddae8919993dde57e8bbab2d for more details
    
    Change-Id: Id8c1abfeb41961a9cca85ef28b2ea70beb07f37c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182548
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/solenv/gdb/libreoffice/basegfx.py 
b/solenv/gdb/libreoffice/basegfx.py
index b6291605c5f2..f533dc7e4ce3 100644
--- a/solenv/gdb/libreoffice/basegfx.py
+++ b/solenv/gdb/libreoffice/basegfx.py
@@ -60,8 +60,11 @@ class B2DPolygonPrinter(object):
     def _count(self):
         # It's a call into the inferior (being debugged) process.
         # Will not work with core dumps and can cause a deadlock.
-        return int(gdb.parse_and_eval(
-                "(('basegfx::B2DPolygon' *) 
{})->count()".format(self.value.address)))
+        if self.value.__str__() == "<unavailable>":
+            return 0
+        else:
+            return int(gdb.parse_and_eval(
+                    "(('basegfx::B2DPolygon' *) 
{})->count()".format(self.value.address)))
 
     def _isEmpty(self):
         return self._count() == 0
@@ -69,8 +72,11 @@ class B2DPolygonPrinter(object):
     def _hasCurves(self):
         # It's a call into the inferior (being debugged) process.
         # Will not work with core dumps and can cause a deadlock.
-        return int(gdb.parse_and_eval(
-                "(('basegfx::B2DPolygon' *) 
{})->areControlPointsUsed()".format(self.value.address))) != 0
+        if self.value.__str__() == "<unavailable>":
+            return False
+        else:
+            return int(gdb.parse_and_eval(
+                    "(('basegfx::B2DPolygon' *) 
{})->areControlPointsUsed()".format(self.value.address))) != 0
 
     def _children(self):
         if self._hasCurves():
@@ -110,7 +116,9 @@ class B2DPolygonPrinter(object):
             return self
 
         def __next__(self):
-            if self.index >= self.count:
+            if self.value.__str__() == "<unavailable>":
+                raise StopIteration()
+           if self.index >= self.count:
                 raise StopIteration()
             points = 
self.value['mpPolygon']['m_pimpl'].dereference()['m_value']['maPoints']['maVector']
             currPoint = (points['_M_impl']['_M_start'] + 
self.index).dereference()
@@ -151,14 +159,20 @@ class B2DPolyPolygonPrinter(object):
     def _count(self):
         # It's a call into the inferior (being debugged) process.
         # Will not work with core dumps and can cause a deadlock.
-        return int(gdb.parse_and_eval(
-                "(('basegfx::B2DPolyPolygon' *) 
{})->count()".format(self.value.address)))
+        if self.value.__str__() == "<unavailable>":
+            return 0
+        else:
+            return int(gdb.parse_and_eval(
+                    "(('basegfx::B2DPolyPolygon' *) 
{})->count()".format(self.value.address)))
 
     def _isClosed(self):
         # It's a call into the inferior (being debugged) process.
         # Will not work with core dumps and can cause a deadlock.
-        return int(gdb.parse_and_eval(
-                "(('basegfx::B2DPolyPolygon' *) 
{})->isClosed()".format(self.value.address))) != 0
+        if self.value.__str__() == "<unavailable>":
+            return True
+        else:
+            return int(gdb.parse_and_eval(
+                    "(('basegfx::B2DPolyPolygon' *) 
{})->isClosed()".format(self.value.address))) != 0
 
     def _isEmpty(self):
         return self._count() == 0

Reply via email to