Debugger: Fix display of wchar_t[]

Task-number: QTCREATORBUG-12492
Change-Id: I5668c0727a36a1529d28b36d0361922f7acb3083
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-06-25 16:25:34 +02:00
parent 06112d13aa
commit a253feee77
2 changed files with 14 additions and 4 deletions

View File

@@ -753,13 +753,19 @@ class DumperBase:
self.putType(type) self.putType(type)
self.putNumChild(1) self.putNumChild(1)
format = self.currentItemFormat() format = self.currentItemFormat()
isDefault = format == None and str(innerType.unqualified()) == "char" isDefault1 = format == None and str(innerType.unqualified()) == "char"
if isDefault or format == 0 or format == 1 or format == 2: isDefault2 = format == None and str(innerType.unqualified()) == "wchar_t"
if isDefault1 or isDefault2 or format == 0 or format == 1 or format == 2:
blob = self.readMemory(self.addressOf(value), type.sizeof) blob = self.readMemory(self.addressOf(value), type.sizeof)
if isDefault: if isDefault1:
# Use Latin1 as default for char []. # Use Latin1 as default for char [].
self.putValue(blob, Hex2EncodedLatin1) self.putValue(blob, Hex2EncodedLatin1)
elif isDefault2:
if type.sizeof == 2:
self.putValue(blob, Hex4EncodedLittleEndian)
else:
self.putValue(blob, Hex8EncodedLittleEndian)
elif format == 0: elif format == 0:
# Explicitly requested Latin1 formatting. # Explicitly requested Latin1 formatting.
self.putValue(blob, Hex2EncodedLatin1) self.putValue(blob, Hex2EncodedLatin1)

View File

@@ -5352,7 +5352,11 @@ namespace basic {
// Locals and Expressions view. It is only support on gdb with Python. // Locals and Expressions view. It is only support on gdb with Python.
const char *s = "aöa"; const char *s = "aöa";
const char cs[] = "aöa";
char cc[] = "aöa";
const wchar_t *w = L"aöa"; const wchar_t *w = L"aöa";
const wchar_t cw[] = L"aöa";
wchar_t ww[] = L"aöa";
QString u; QString u;
BREAK_HERE; BREAK_HERE;
// Expand s. // Expand s.
@@ -5372,7 +5376,7 @@ namespace basic {
u = QString::fromUtf16((ushort *)w); u = QString::fromUtf16((ushort *)w);
// Make sure to undo "Change Format". // Make sure to undo "Change Format".
dummyStatement(s, w); dummyStatement(s, w, &ww, &cw, &cc, &cs);
} }
typedef void *VoidPtr; typedef void *VoidPtr;