Commit 1ae7f13d authored by hjk's avatar hjk

debugger: more general support for D arrays

Change-Id: Id8c4e585aa92616c40b9953be5bb9c3d121272b7
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 5117f5df
...@@ -1689,8 +1689,18 @@ class Dumper: ...@@ -1689,8 +1689,18 @@ class Dumper:
nsStrippedType = self.stripNamespaceFromType(dtypeName)\ nsStrippedType = self.stripNamespaceFromType(dtypeName)\
.replace("::", "__") .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(" STRIPPED: %s" % nsStrippedType)
#warn(" DUMPERS: %s" % (nsStrippedType in qqDumpers)) #warn(" DUMPERS: %s" % (nsStrippedType in qqDumpers))
if nsStrippedType in qqDumpers: if nsStrippedType in qqDumpers:
......
...@@ -2379,29 +2379,42 @@ def qdump__Eigen__Matrix(d, value): ...@@ -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"] n = value["length"]
p = value["ptr"] p = value["ptr"]
t = cleanDType(value.type)[7:]
d.putAddress(value.address) d.putAddress(value.address)
d.putType("char[%d]" % n) d.putType("%s[%d]" % (t, n))
d.putValue(encodeCharArray(p, 100), Hex2EncodedLocal8Bit) if t == "char":
d.putNumChild(0) 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): def qdump_AArray(d, value):
n = value["length"] #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"] p = value["ptr"]
t = cleanDType(value.type)[8:]
d.putAddress(value.address) d.putAddress(value.address)
d.putType("string[%d]" % n) d.putType("%s]" % t.replace("_", "["))
d.putValue(" ") d.putValue(" ")
d.putNumChild(n) d.putNumChild(1)
innerType = p.type
if d.isExpanded(): if d.isExpanded():
with Children(d, n, childType=innerType): with Children(d, 1):
for i in range(0, n): d.putSubItem("ptr", p)
d.putSubItem(i, p.dereference())
p = p + 1
####################################################################### #######################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment