Commit 9342dc1b authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: fix array element offsets

Addresses were produced in steps of sizeof(array), not sizeof(element)

Change-Id: Iaf883735a07e9f87d6c0c540e2cde15ebf9013bc
Reviewed-on: http://codereview.qt.nokia.com/1328


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent a33d12f4
...@@ -1364,29 +1364,22 @@ class Dumper: ...@@ -1364,29 +1364,22 @@ class Dumper:
return return
if value.type.code == gdb.TYPE_CODE_ARRAY: if value.type.code == gdb.TYPE_CODE_ARRAY:
baseptr = value.cast(realtype.pointer()) targettype = realtype.target()
if format == 0 or format == 1: self.putAddress(value.address)
# Explicityly requested Latin1 or UTF-8 formatting. self.putType(realtype)
if format == 0: self.putNumChild(1)
f = Hex2EncodedLatin1 if format == 0:
else: # Explicitly requested Latin1 formatting.
f = Hex2EncodedUtf8 self.putValue(encodeCharArray(value, 100), Hex2EncodedLatin1)
self.putAddress(value.address) elif format == 1:
self.putType(realtype) # Explicitly requested UTF-8 formatting.
self.putValue(encodeCharArray(value, 100), f) self.putValue(encodeCharArray(value, 100), Hex2EncodedUtf8)
self.putNumChild(1)
else: else:
self.putType(realtype) self.putValue("@0x%x" % long(value.cast(targettype.pointer())))
self.putAddress(value.address)
self.putValue("%s" % baseptr)
self.putNumChild(1)
if self.isExpanded(item): if self.isExpanded(item):
charptr = lookupType("unsigned char").pointer() self.put('addrbase="0x%x",' % long(value.cast(targettype.pointer())))
addr1 = (baseptr+1).cast(charptr) self.put('addrstep="%s",' % targettype.sizeof)
addr0 = baseptr.cast(charptr) with Children(self, 1, targettype):
self.put('addrbase="%s",' % cleanAddress(addr0))
self.put('addrstep="%s",' % (addr1 - addr0))
with Children(self, 1, realtype.target()):
child = Item(value, item.iname, None, item.name) child = Item(value, item.iname, None, item.name)
self.putFields(child) self.putFields(child)
return return
......
Supports Markdown
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