forked from qt-creator/qt-creator
debugger: more general support for D arrays
Change-Id: Id8c4e585aa92616c40b9953be5bb9c3d121272b7 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -1689,8 +1689,18 @@ class Dumper:
|
||||
|
||||
nsStrippedType = self.stripNamespaceFromType(dtypeName)\
|
||||
.replace("::", "__")
|
||||
# The following line is only needed for D:
|
||||
#nsStrippedType = nsStrippedType.replace(" ", "__")
|
||||
|
||||
# The following block is only needed for D.
|
||||
if nsStrippedType.startswith("_A"):
|
||||
# DMD v2.058 encodes string[] as _Array_uns long long.
|
||||
# With spaces.
|
||||
if nsStrippedType.startswith("_Array_"):
|
||||
qdump_Array(self, value)
|
||||
return
|
||||
if nsStrippedType.startswith("_AArray_"):
|
||||
qdump_AArray(self, value)
|
||||
return
|
||||
|
||||
#warn(" STRIPPED: %s" % nsStrippedType)
|
||||
#warn(" DUMPERS: %s" % (nsStrippedType in qqDumpers))
|
||||
if nsStrippedType in qqDumpers:
|
||||
|
||||
@@ -2379,29 +2379,42 @@ def qdump__Eigen__Matrix(d, value):
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
def cleanDType(type):
|
||||
return stripClassTag(str(type)).replace("uns long long", "string")
|
||||
|
||||
def qdump___Array_char(d, value):
|
||||
def qdump_Array(d, value):
|
||||
n = value["length"]
|
||||
p = value["ptr"]
|
||||
t = cleanDType(value.type)[7:]
|
||||
d.putAddress(value.address)
|
||||
d.putType("char[%d]" % n)
|
||||
d.putValue(encodeCharArray(p, 100), Hex2EncodedLocal8Bit)
|
||||
d.putNumChild(0)
|
||||
d.putType("%s[%d]" % (t, n))
|
||||
if t == "char":
|
||||
d.putValue(encodeCharArray(p, 100), Hex2EncodedLocal8Bit)
|
||||
d.putNumChild(0)
|
||||
else:
|
||||
d.putValue(" ")
|
||||
d.putNumChild(n)
|
||||
innerType = p.type
|
||||
if d.isExpanded():
|
||||
with Children(d, n, childType=innerType):
|
||||
for i in range(0, n):
|
||||
d.putSubItem(i, p.dereference())
|
||||
p = p + 1
|
||||
|
||||
# DMD v2.058 encodes string[] as _Array_uns long long. With spaces.
|
||||
def qdump___Array_uns__long__long(d, value):
|
||||
n = value["length"]
|
||||
|
||||
def qdump_AArray(d, value):
|
||||
#n = value["length"]
|
||||
# This ends up as _AArray_<key>_<value> with a single .ptr
|
||||
# member of type void *. Not much that can be done here.
|
||||
p = value["ptr"]
|
||||
t = cleanDType(value.type)[8:]
|
||||
d.putAddress(value.address)
|
||||
d.putType("string[%d]" % n)
|
||||
d.putType("%s]" % t.replace("_", "["))
|
||||
d.putValue(" ")
|
||||
d.putNumChild(n)
|
||||
innerType = p.type
|
||||
d.putNumChild(1)
|
||||
if d.isExpanded():
|
||||
with Children(d, n, childType=innerType):
|
||||
for i in range(0, n):
|
||||
d.putSubItem(i, p.dereference())
|
||||
p = p + 1
|
||||
with Children(d, 1):
|
||||
d.putSubItem("ptr", p)
|
||||
|
||||
|
||||
#######################################################################
|
||||
|
||||
Reference in New Issue
Block a user