Debugger: Fix display selection of char arrays

... by re-using the logic we had for std::string already.

A plain char[] value did not react to Change Display Format,
Latin1 was used unconditionally.

Also rename putStdStringHelper to putCharArrayHelper.

Change-Id: I01fdf796ff49a4c99ead7b9b46274684e18e962b
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-08-12 09:05:28 +02:00
parent 07e1f78ca8
commit d7c5ee7edd
3 changed files with 10 additions and 18 deletions
+5 -13
View File
@@ -569,7 +569,7 @@ class DumperBase:
elided, shown = self.computeLimit(size, limit)
return elided, self.readMemory(data, shown)
def putStdStringHelper(self, data, size, charSize, displayFormat = AutomaticFormat):
def putCharArrayHelper(self, data, size, charSize, displayFormat = AutomaticFormat):
bytelen = size * charSize
elided, shown = self.computeLimit(bytelen, self.displayStringLimit)
mem = self.readMemory(data, shown)
@@ -917,18 +917,10 @@ class DumperBase:
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), arrayByteSize)
self.putValue(blob, Hex2EncodedLatin1)
elif innerTypeName == "wchar_t":
blob = self.readMemory(self.addressOf(value), arrayByteSize)
if innerType.sizeof == 2:
self.putValue(blob, Hex4EncodedLittleEndian)
else:
self.putValue(blob, Hex8EncodedLittleEndian)
elif p:
if displayFormat != RawFormat and p:
if innerTypeName == "char" or innerTypeName == "wchar_t":
self.putCharArrayHelper(p, n, ts, self.currentItemFormat())
else:
self.tryPutSimpleFormattedPointer(p, arrayType, innerTypeName,
displayFormat, arrayByteSize)
self.putNumChild(n)