Commit 9084855e authored by Mark Florisson's avatar Mark Florisson

Pretty print any supported python object (previously it only pretty printed...

Pretty print any supported python object (previously it only pretty printed objects recognized as PyObject * and PyFrameObject *)
parent efb417b6
......@@ -1108,12 +1108,16 @@ class PyObjectPtrPrinter:
proxyval = pyop.proxyval(set())
return stringify(proxyval)
def pretty_printer_lookup(gdbval):
type = gdbval.type.unqualified()
if type.code == gdb.TYPE_CODE_PTR:
type = type.target().unqualified()
t = str(type)
if t in ("PyObject", "PyFrameObject"):
# do this every time to allow new subclasses to "register"
# alternatively, we could use a metaclass to register all the typenames
classes = [PyObjectPtr]
classes.extend(PyObjectPtr.__subclasses__())
if str(type) in [cls._typename for cls in classes]:
return PyObjectPtrPrinter(gdbval)
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment