forked from qt-creator/qt-creator
debugger: fix new dumpers in the context of base class types containing
spaces in its string representation
This commit is contained in:
@@ -6,8 +6,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import gdb
|
import gdb
|
||||||
#import base64
|
|
||||||
import types
|
|
||||||
import curses.ascii
|
import curses.ascii
|
||||||
|
|
||||||
verbosity = 0
|
verbosity = 0
|
||||||
@@ -268,11 +266,8 @@ class FrameCommand(gdb.Command):
|
|||||||
d.expandedINames = expandedINames
|
d.expandedINames = expandedINames
|
||||||
d.useFancy = useFancy
|
d.useFancy = useFancy
|
||||||
d.beginHash()
|
d.beginHash()
|
||||||
d.putField("iname", item.iname)
|
d.put('iname="%s",' % item.iname)
|
||||||
d.put(",")
|
|
||||||
|
|
||||||
d.safePutItemHelper(item)
|
d.safePutItemHelper(item)
|
||||||
|
|
||||||
d.endHash()
|
d.endHash()
|
||||||
|
|
||||||
# The outermost block in a function has the function member
|
# The outermost block in a function has the function member
|
||||||
@@ -339,22 +334,22 @@ class Dumper:
|
|||||||
childNumChild = -1
|
childNumChild = -1
|
||||||
if numChild == 0:
|
if numChild == 0:
|
||||||
type = None
|
type = None
|
||||||
|
self.putCommaIfNeeded()
|
||||||
if not type is None:
|
if not type is None:
|
||||||
childType = stripClassTag(str(type))
|
childType = stripClassTag(str(type))
|
||||||
self.putField("childtype", childType)
|
self.put('childtype="%s",' % childType)
|
||||||
if isSimpleType(type) or isStringType(self, type):
|
if isSimpleType(type) or isStringType(self, type):
|
||||||
self.putField("childnumchild", "0")
|
self.put('childnumchild="0",')
|
||||||
childNumChild = 0
|
childNumChild = 0
|
||||||
elif type.code == gdb.TYPE_CODE_PTR:
|
elif type.code == gdb.TYPE_CODE_PTR:
|
||||||
self.putField("childnumchild", "1")
|
self.put('childnumchild="1",')
|
||||||
childNumChild = 1
|
childNumChild = 1
|
||||||
if not children is None:
|
if not children is None:
|
||||||
self.putField("childnumchild", children)
|
self.put('childnumchild="%s",' % children)
|
||||||
childNumChild = children
|
childNumChild = children
|
||||||
self.childTypes.append(childType)
|
self.childTypes.append(childType)
|
||||||
self.childNumChilds.append(childNumChild)
|
self.childNumChilds.append(childNumChild)
|
||||||
#warn("BEGIN: %s" % self.childTypes)
|
#warn("BEGIN: %s" % self.childTypes)
|
||||||
self.putCommaIfNeeded()
|
|
||||||
self.put("children=[")
|
self.put("children=[")
|
||||||
|
|
||||||
def endChildren(self):
|
def endChildren(self):
|
||||||
@@ -377,13 +372,13 @@ class Dumper:
|
|||||||
#warn(" EQUAL 2: %s " % (str(type) == self.childTypes[-1]))
|
#warn(" EQUAL 2: %s " % (str(type) == self.childTypes[-1]))
|
||||||
type = stripClassTag(str(type))
|
type = stripClassTag(str(type))
|
||||||
if len(type) > 0 and type != self.childTypes[-1]:
|
if len(type) > 0 and type != self.childTypes[-1]:
|
||||||
self.putField("type", type)
|
self.putCommaIfNeeded()
|
||||||
#self.putField("type", str(type.unqualified()))
|
self.put('type="%s"' % type) # str(type.unqualified()) ?
|
||||||
|
|
||||||
def putNumChild(self, numchild):
|
def putNumChild(self, numchild):
|
||||||
#warn("NUM CHILD: '%s' '%s'" % (numchild, self.childNumChilds[-1]))
|
#warn("NUM CHILD: '%s' '%s'" % (numchild, self.childNumChilds[-1]))
|
||||||
if int(numchild) != int(self.childNumChilds[-1]):
|
if numchild != self.childNumChilds[-1]:
|
||||||
self.putField("numchild", numchild)
|
self.put(',numchild="%s"' % numchild)
|
||||||
|
|
||||||
def putValue(self, value, encoding = None):
|
def putValue(self, value, encoding = None):
|
||||||
if not encoding is None:
|
if not encoding is None:
|
||||||
@@ -613,7 +608,7 @@ class Dumper:
|
|||||||
#warn("COMMON TYPE: %s " % value.type)
|
#warn("COMMON TYPE: %s " % value.type)
|
||||||
#warn("INAME: %s " % item.iname)
|
#warn("INAME: %s " % item.iname)
|
||||||
#warn("INAMES: %s " % self.expandedINames)
|
#warn("INAMES: %s " % self.expandedINames)
|
||||||
#warn("EXPANDED: %self " % (item.iname in self.expandedINames))
|
#warn("EXPANDED: %s " % (item.iname in self.expandedINames))
|
||||||
|
|
||||||
# insufficient, see http://sourceware.org/bugzilla/show_bug.cgi?id=10953
|
# insufficient, see http://sourceware.org/bugzilla/show_bug.cgi?id=10953
|
||||||
#fields = value.type.fields()
|
#fields = value.type.fields()
|
||||||
@@ -637,6 +632,7 @@ class Dumper:
|
|||||||
innerType = value.type.target()
|
innerType = value.type.target()
|
||||||
self.beginChildren(1, innerType)
|
self.beginChildren(1, innerType)
|
||||||
|
|
||||||
|
baseNumber = 0
|
||||||
for field in fields:
|
for field in fields:
|
||||||
#warn("FIELD: %s" % field)
|
#warn("FIELD: %s" % field)
|
||||||
#warn(" BITSIZE: %s" % field.bitsize)
|
#warn(" BITSIZE: %s" % field.bitsize)
|
||||||
@@ -657,21 +653,26 @@ class Dumper:
|
|||||||
if field.name.startswith("_vptr."):
|
if field.name.startswith("_vptr."):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
child = Item(None, item.iname, field.name, field.name)
|
|
||||||
#warn("FIELD NAME: %s" % field.name)
|
#warn("FIELD NAME: %s" % field.name)
|
||||||
#warn("FIELD TYPE: %s" % field.type)
|
#warn("FIELD TYPE: %s" % field.type)
|
||||||
if field.name == stripClassTag(str(field.type)):
|
if field.name == stripClassTag(str(field.type)):
|
||||||
# Field is base type.
|
# Field is base type. We cannot use field.name as part
|
||||||
child.value = value.cast(field.type)
|
# of the iname as it might contain spaces and other
|
||||||
|
# strange characters.
|
||||||
|
child = Item(value.cast(field.type),
|
||||||
|
item.iname, "@%d" % baseNumber, field.name)
|
||||||
|
baseNumber += 1
|
||||||
|
self.beginHash()
|
||||||
|
self.putField("iname", child.iname)
|
||||||
|
self.safePutItemHelper(child)
|
||||||
|
self.endHash()
|
||||||
else:
|
else:
|
||||||
# Data member.
|
# Data member.
|
||||||
child.value = value[field.name]
|
child = Item(value[field.name],
|
||||||
if not child.name:
|
item.iname, field.name, field.name)
|
||||||
child.name = "<anon>"
|
if not child.name:
|
||||||
self.beginHash()
|
child.name = "<anon>"
|
||||||
#d.putField("iname", child.iname)
|
self.beginHash()
|
||||||
#d.putName(child.name)
|
self.safePutItemHelper(child)
|
||||||
#d.putType(child.value.type)
|
self.endHash()
|
||||||
self.safePutItemHelper(child)
|
|
||||||
self.endHash()
|
|
||||||
self.endChildren()
|
self.endChildren()
|
||||||
|
Reference in New Issue
Block a user