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,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