solenv/gdb/libreoffice/basegfx.py |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 3c82f49fcee3f1e4ddae8919993dde57e8bbab2d
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Mon Sep 23 17:57:00 2024 +0200
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Wed Sep 25 10:56:18 2024 +0200

    Adapting basegfx.py due to blocking in some situations
    
    I have stumbled over the GDB integration in vscode hanging
    when there is a BP and *below* a declaration of e.g. a
    basegfx::B2DPolygon. This seems to happen due to the
    instance not yet being incarnated, but the variable view
    already listing it and triggering methods in basegfx.py
    to evalualte stuff.
    It just hangs/loops, I guess it's fetching the PointCount
    from a random mem ptr'ed Polygon, then tries to evaluate
    something with the Points.
    I do not really know about what to do here, but I figured
    out that testing 'if self.exists()' where the instance
    gets accessed (using gdb.parse_and_eval) helps.
    Thus this solves the problem for me and - after stepping
    over the incarnation of the object I can see it's true
    content.
    I hope someone who might have more knowledge about that
    GDB and python stuff can have a look and maybe tell if
    tis is OK or should be done in a different way.
    
    Change-Id: Ia844b0aded97220df7f4605fdcffeac5e2270db3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173826
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>
    Tested-by: Jenkins

diff --git a/solenv/gdb/libreoffice/basegfx.py 
b/solenv/gdb/libreoffice/basegfx.py
index b6291605c5f2..9e5fa4c88d00 100644
--- a/solenv/gdb/libreoffice/basegfx.py
+++ b/solenv/gdb/libreoffice/basegfx.py
@@ -60,8 +60,9 @@ 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.exists()
+            return int(gdb.parse_and_eval(
+                    "(('basegfx::B2DPolygon' *) 
{})->count()".format(self.value.address)))
 
     def _isEmpty(self):
         return self._count() == 0
@@ -69,8 +70,9 @@ 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.exists()
+            return int(gdb.parse_and_eval(
+                    "(('basegfx::B2DPolygon' *) 
{})->areControlPointsUsed()".format(self.value.address))) != 0
 
     def _children(self):
         if self._hasCurves():
@@ -151,14 +153,16 @@ 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.exists()
+            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.exists()
+            return int(gdb.parse_and_eval(
+                    "(('basegfx::B2DPolyPolygon' *) 
{})->isClosed()".format(self.value.address))) != 0
 
     def _isEmpty(self):
         return self._count() == 0
  • core.git: solenv/gdb Armin Le Grand (allotropia) (via logerrit)

Reply via email to