forked from qt-creator/qt-creator
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:
@@ -136,8 +136,6 @@ class PlainDumper:
|
|||||||
printer = self.printer.gen_printer(value.nativeValue)
|
printer = self.printer.gen_printer(value.nativeValue)
|
||||||
except:
|
except:
|
||||||
printer = self.printer.invoke(value.nativeValue)
|
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)
|
d.putType(value.nativeValue.type.name)
|
||||||
val = printer.to_string()
|
val = printer.to_string()
|
||||||
if isinstance(val, str):
|
if isinstance(val, str):
|
||||||
@@ -149,11 +147,20 @@ class PlainDumper:
|
|||||||
d.putCharArrayValue(val.address, val.length,
|
d.putCharArrayValue(val.address, val.length,
|
||||||
val.type.target().sizeof)
|
val.type.target().sizeof)
|
||||||
|
|
||||||
d.putNumChild(len(children))
|
lister = getattr(printer, 'children', None)
|
||||||
if d.isExpanded():
|
if lister is None:
|
||||||
with Children(d):
|
d.putNumChild(0)
|
||||||
for child in children:
|
else:
|
||||||
d.putSubItem(child[0], d.fromNativeValue(gdb.Value(child[1])))
|
if d.isExpanded():
|
||||||
|
children = lister()
|
||||||
|
with Children(d):
|
||||||
|
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):
|
def importPlainDumpers(args):
|
||||||
if args == 'off':
|
if args == 'off':
|
||||||
|
Reference in New Issue
Block a user