From c12593efc44b5e98a1c7d6c2561f4b67bdbf383f Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 1 Apr 2015 10:32:28 +0200 Subject: Debugger: Show unsigned chars as unsigned values Task-number: QTCREATORBUG-13809 Change-Id: I5dbb85c44cdc801edee1f33bc0c0cf47ec9916a3 Reviewed-by: David Schulz --- src/plugins/debugger/watchhandler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 4ac3f32082..9ac7dbbeda 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -400,9 +400,9 @@ static QString reformatInteger(quint64 value, int format, int size, bool isSigne } // Format printable (char-type) characters -static QString reformatCharacter(int code, int format) +static QString reformatCharacter(int code, int format, bool isSigned) { - const QString codeS = reformatInteger(code, format, 1, true); + const QString codeS = reformatInteger(code, format, 1, isSigned); if (code < 0) // Append unsigned value. return codeS + QLatin1String(" / ") + reformatInteger(256 + code, format, 1, false); const QChar c = QChar(uint(code)); @@ -500,10 +500,12 @@ QString WatchItem::formattedValue() const const int format = itemFormat(); // Append quoted, printable character also for decimal. + // FIXME: This is unreliable. if (type.endsWith("char") || type.endsWith("QChar")) { bool ok; const int code = value.toInt(&ok); - return ok ? reformatCharacter(code, format) : value; + bool isUnsigned = type == "unsigned char" || type == "uchar"; + return ok ? reformatCharacter(code, format, !isUnsigned) : value; } if (format == HexadecimalIntegerFormat -- cgit v1.2.1