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.Grand@me.com>
Tested-by: Jenkins
This commit is contained in:
Armin Le Grand (allotropia) 2024-09-23 17:57:00 +02:00 committed by Armin Le Grand
parent e0808a1f84
commit 3c82f49fce

View file

@ -60,6 +60,7 @@ 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.
if self.exists()
return int(gdb.parse_and_eval(
"(('basegfx::B2DPolygon' *) {})->count()".format(self.value.address)))
@ -69,6 +70,7 @@ 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.
if self.exists()
return int(gdb.parse_and_eval(
"(('basegfx::B2DPolygon' *) {})->areControlPointsUsed()".format(self.value.address))) != 0
@ -151,12 +153,14 @@ 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.
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.
if self.exists()
return int(gdb.parse_and_eval(
"(('basegfx::B2DPolyPolygon' *) {})->isClosed()".format(self.value.address))) != 0