Debugger: Don't try to iterate on non-existent subprinters

gobject_gdb.py puts the pretty_printer_lookup function into
gdb.pretty_printers. Trying to access subprinters of it causes the
AttributeError exception.

Change-Id: I00ce7b62866dd9c06a1f0abef0c7043ece023d34
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Łukasz Wojniłowicz
2023-01-08 16:57:53 +01:00
parent 585a4ad92a
commit b05a34b81e

View File

@@ -1004,8 +1004,11 @@ class Dumper(DumperBase):
def importPlainDumpersForObj(self, obj):
for printers in obj.pretty_printers + gdb.pretty_printers:
for printer in printers.subprinters:
self.importPlainDumper(printer)
if hasattr(printers, "subprinters"):
for printer in printers.subprinters:
self.importPlainDumper(printer)
else:
self.warn('Loading a printer without the subprinters attribute not supported.')
def importPlainDumpers(self):
for obj in gdb.objfiles():