Commit 5f9f95a4 authored by hjk's avatar hjk

Debugger: Work around wrongly reported array size

GCC 4.9.1 + GDB 7.8 (and likely more combinations) produce
sizeof(QProcess[3]) == 0, making the dumpers report no child
entries for the array.

To work around, try to parse the array size from the type name itself.

Task-number: QTCREATORBUG-14755
Change-Id: I1f17d5d6fde6bc5fe66d2ad4a73f77185503f9ab
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent dedcd259
......@@ -909,21 +909,28 @@ class DumperBase:
p = None
displayFormat = self.currentItemFormat()
n = int(arrayType.sizeof / ts)
arrayByteSize = arrayType.sizeof
if arrayByteSize == 0:
# This should not happen. But it does, see QTCREATORBUG-14755.
# GDB/GCC produce sizeof == 0 for QProcess arr[3]
s = str(value.type)
arrayByteSize = int(s[s.find('[')+1:s.find(']')]) * ts;
n = int(arrayByteSize / ts)
if displayFormat != RawFormat:
if innerTypeName == "char":
# Use Latin1 as default for char [].
blob = self.readMemory(self.addressOf(value), arrayType.sizeof)
blob = self.readMemory(self.addressOf(value), arrayByteSize)
self.putValue(blob, Hex2EncodedLatin1)
elif innerTypeName == "wchar_t":
blob = self.readMemory(self.addressOf(value), arrayType.sizeof)
blob = self.readMemory(self.addressOf(value), arrayByteSize)
if innerType.sizeof == 2:
self.putValue(blob, Hex4EncodedLittleEndian)
else:
self.putValue(blob, Hex8EncodedLittleEndian)
elif p:
self.tryPutSimpleFormattedPointer(p, arrayType, innerTypeName, displayFormat, arrayType.sizeof)
self.tryPutSimpleFormattedPointer(p, arrayType, innerTypeName,
displayFormat, arrayByteSize)
self.putNumChild(n)
if self.isExpanded():
......
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