From 1ce66f8d7a974817e3798d904549b9a72f17b120 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 6 Jul 2010 10:51:50 +0200 Subject: [PATCH] debugger: fix list of members in case gdb reports '_class_ SomeClass' --- share/qtcreator/gdbmacros/dumper.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py index 1bee0ed2c60..ea771f839ac 100644 --- a/share/qtcreator/gdbmacros/dumper.py +++ b/share/qtcreator/gdbmacros/dumper.py @@ -789,6 +789,21 @@ def stripTypedefs(typeobj): type = type.strip_typedefs().unqualified() return type +def extractFields(type): + # Insufficient, see http://sourceware.org/bugzilla/show_bug.cgi?id=10953: + #fields = value.type.fields() + # Insufficient, see http://sourceware.org/bugzilla/show_bug.cgi?id=11777: + #fields = stripTypedefs(value.type).fields() + # This seems to work. + #warn("TYPE 0: %s" % type) + type = stripTypedefs(type) + #warn("TYPE 1: %s" % type) + type = lookupType(str(type)) + #warn("TYPE 2: %s" % type) + fields = type.fields() + #warn("FIELDS: %s" % fields) + return fields + ####################################################################### # # Item @@ -1383,10 +1398,7 @@ class Dumper: #warn("INAME: %s " % item.iname) #warn("INAMES: %s " % self.expandedINames) #warn("EXPANDED: %s " % (item.iname in self.expandedINames)) - - # Insufficient, see http://sourceware.org/bugzilla/show_bug.cgi?id=10953 - #fields = value.type.fields() - fields = stripTypedefs(value.type).fields() + fields = extractFields(type) self.putType(item.value.type) try: @@ -1423,7 +1435,8 @@ class Dumper: def putFields(self, item, innerType = None): value = item.value - fields = value.type.strip_typedefs().fields() + type = stripTypedefs(value.type) + fields = extractFields(type) baseNumber = 0 for field in fields: #warn("FIELD: %s" % field) @@ -1434,9 +1447,9 @@ class Dumper: continue # A static class member(?). if field.name is None: - innerType = value.type.target() + innerType = type.target() p = value.cast(innerType.pointer()) - for i in xrange(value.type.sizeof / innerType.sizeof): + for i in xrange(type.sizeof / innerType.sizeof): self.putItem(Item(p.dereference(), item.iname, i, None)) p = p + 1 continue -- GitLab