Commit c12593ef authored by hjk's avatar hjk
Browse files

Debugger: Show unsigned chars as unsigned values



Task-number: QTCREATORBUG-13809
Change-Id: I5dbb85c44cdc801edee1f33bc0c0cf47ec9916a3
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent d4abde4c
...@@ -400,9 +400,9 @@ static QString reformatInteger(quint64 value, int format, int size, bool isSigne ...@@ -400,9 +400,9 @@ static QString reformatInteger(quint64 value, int format, int size, bool isSigne
} }
// Format printable (char-type) characters // 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. if (code < 0) // Append unsigned value.
return codeS + QLatin1String(" / ") + reformatInteger(256 + code, format, 1, false); return codeS + QLatin1String(" / ") + reformatInteger(256 + code, format, 1, false);
const QChar c = QChar(uint(code)); const QChar c = QChar(uint(code));
...@@ -500,10 +500,12 @@ QString WatchItem::formattedValue() const ...@@ -500,10 +500,12 @@ QString WatchItem::formattedValue() const
const int format = itemFormat(); const int format = itemFormat();
// Append quoted, printable character also for decimal. // Append quoted, printable character also for decimal.
// FIXME: This is unreliable.
if (type.endsWith("char") || type.endsWith("QChar")) { if (type.endsWith("char") || type.endsWith("QChar")) {
bool ok; bool ok;
const int code = value.toInt(&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 if (format == HexadecimalIntegerFormat
......
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