Debugger: Use GDB's own pretty printers more cautiously

Looks like there is no attempt made on the GDB/libstdc++ side
to recognize uninitialized objects, so we cannot convert
"all 932 million children, I swear" to a list.

Task-number: QTCREATORBUG-22887
Change-Id: I3bf7e53c8b11ece3e1182d8446e959a66a41665a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-09-27 15:40:35 +02:00
parent 094d20bde9
commit 3e2e0c6edc

View File

@@ -136,8 +136,6 @@ class PlainDumper:
printer = self.printer.gen_printer(value.nativeValue)
except:
printer = self.printer.invoke(value.nativeValue)
lister = getattr(printer, 'children', None)
children = [] if lister is None else list(lister())
d.putType(value.nativeValue.type.name)
val = printer.to_string()
if isinstance(val, str):
@@ -149,11 +147,20 @@ class PlainDumper:
d.putCharArrayValue(val.address, val.length,
val.type.target().sizeof)
d.putNumChild(len(children))
lister = getattr(printer, 'children', None)
if lister is None:
d.putNumChild(0)
else:
if d.isExpanded():
children = lister()
with Children(d):
for child in children:
d.putSubItem(child[0], d.fromNativeValue(gdb.Value(child[1])))
i = 0
for (name, child) in children:
d.putSubItem(name, d.fromNativeValue(child))
i += 1
if i > 1000:
break
d.putNumChild(1)
def importPlainDumpers(args):
if args == 'off':