Commit 9884a768 authored by Ryan May's avatar Ryan May Committed by hjk
Browse files

Add processing for array types to a standalone dumper.



This way, it can be overridden to make a custom dumper for an array of
data (such as creating an image display).

Change-Id: I0fda56872293554c6235e24f9af467c82f0b0f21
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 29c448ed
......@@ -1542,38 +1542,7 @@ class Dumper:
return
if type.code == ArrayCode:
targetType = type.target()
self.putAddress(value.address)
self.putType(typeName)
self.putNumChild(1)
format = self.currentItemFormat()
isDefault = format == None and str(targetType.unqualified()) == "char"
if isDefault or (format >= 0 and format <= 2):
blob = readRawMemory(value.address, type.sizeof)
if isDefault:
# Use Latin1 as default for char [].
self.putValue(blob, Hex2EncodedLatin1)
elif format == 0:
# Explicitly requested Latin1 formatting.
self.putValue(blob, Hex2EncodedLatin1)
elif format == 1:
# Explicitly requested UTF-8 formatting.
self.putValue(blob, Hex2EncodedUtf8)
elif format == 2:
# Explicitly requested Local 8-bit formatting.
self.putValue(blob, Hex2EncodedLocal8Bit)
else:
self.putValue("@0x%x" % long(value.cast(targetType.pointer())))
if self.currentIName in self.expandedINames:
p = value.address
ts = targetType.sizeof
if not self.tryPutArrayContents(targetType, p, type.sizeof / ts):
with Children(self, childType=targetType,
addrBase=p, addrStep=ts):
self.putFields(value)
qdump____c_style_array__(self, value)
return
if type.code == PointerCode:
......
......@@ -1818,6 +1818,42 @@ def qdump__QxXmlAttributes(d, value):
#
#######################################################################
def qdump____c_style_array__(d, value):
type = value.type.unqualified()
targetType = type.target()
typeName = str(type)
d.putAddress(value.address)
d.putType(typeName)
d.putNumChild(1)
format = d.currentItemFormat()
isDefault = format == None and str(targetType.unqualified()) == "char"
if isDefault or (format >= 0 and format <= 2):
blob = readRawMemory(value.address, type.sizeof)
if isDefault:
# Use Latin1 as default for char [].
d.putValue(blob, Hex2EncodedLatin1)
elif format == 0:
# Explicitly requested Latin1 formatting.
d.putValue(blob, Hex2EncodedLatin1)
elif format == 1:
# Explicitly requested UTF-8 formatting.
d.putValue(blob, Hex2EncodedUtf8)
elif format == 2:
# Explicitly requested Local 8-bit formatting.
d.putValue(blob, Hex2EncodedLocal8Bit)
else:
d.putValue("@0x%x" % long(value.cast(targetType.pointer())))
if d.currentIName in d.expandedINames:
p = value.address
ts = targetType.sizeof
if not d.tryPutArrayContents(targetType, p, type.sizeof / ts):
with Children(d, childType=targetType,
addrBase=p, addrStep=ts):
d.putFields(value)
def qdump__std__array(d, value):
size = numericTemplateArgument(value.type, 1)
d.putItemCount(size)
......
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