diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index d8112360b0083c814eb9bdc0dc02f073c4200f60..8d6ed6bce5a0c90db4691f871c5d089415c85f30 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -83,10 +83,11 @@ bool isIntType(const QByteArray &type) case 'c': return type == "char"; case 'i': - return type == "int" || type == "int64"; + return type == "int"; case 'l': return type == "long" - || type.startsWith("long "); + || type == "long int" + || type == "long unsigned int"; case 'p': return type == "ptrdiff_t"; case 'q': @@ -100,10 +101,24 @@ bool isIntType(const QByteArray &type) || type == "size_t" || type == "std::size_t" || type == "std::ptrdiff_t" - || type.startsWith("signed "); + || (type.startsWith("signed") && + ( type == "signed char" + || type == "signed short" + || type == "signed short int" + || type == "signed long" + || type == "signed long int" + || type == "signed long long" + || type == "signed long long int")); case 'u': return type == "unsigned" - || type.startsWith("unsigned "); + || (type.startsWith("unsigned") && + ( type == "unsigned char" + || type == "unsigned short" + || type == "unsigned short int" + || type == "unsigned long" + || type == "unsigned long int" + || type == "unsigned long long" + || type == "unsigned long long int")); default: return false; } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 720a2232c3eb14d60fb62402c9d400c23743bd67..95e066fd201b629e755b19fa8a802b23ecbc8097 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -378,8 +378,9 @@ static QString reformatCharacter(int code, int format) const QString codeS = reformatInteger(code, format); if (code < 0) // Append unsigned value. return codeS + QLatin1String(" / ") + reformatInteger(256 + code, format); - if (code >= 32 && code < 128) - return codeS + QLatin1String(" '") + QChar(code) + QLatin1Char('\''); + const QChar c = QLatin1Char(code); + if (c.isPrint()) + return codeS + QLatin1String(" '") + c + QLatin1Char('\''); switch (code) { case 0: return codeS + QLatin1String(" '\\0'"); @@ -402,7 +403,7 @@ static QString quoteUnprintable(const QString &str) if (WatchHandler::unprintableBase() == -1) { foreach (const QChar c, str) { int u = c.unicode(); - if (u >= 32 && u < 127) + if (c.isPrint()) encoded += c; else if (u == '\r') encoded += QLatin1String("\\r"); @@ -473,9 +474,6 @@ QString WatchModel::formattedValue(const WatchData &data) const return value; } - const QByteArray qtNamespace = engine()->qtNamespace(); - int format = itemFormat(data); - if (isIntType(data.type)) { if (value.isEmpty()) return value; @@ -483,7 +481,9 @@ QString WatchModel::formattedValue(const WatchData &data) const const QChar firstChar = value.at(0); if (!firstChar.isDigit() && firstChar != QLatin1Char('-')) return value; + // Append quoted, printable character also for decimal. + const int format = itemFormat(data); if (data.type.endsWith("char")) { bool ok; const int code = value.toInt(&ok); @@ -504,8 +504,10 @@ QString WatchModel::formattedValue(const WatchData &data) const if (!isPointerType(data.type) && !data.isVTablePointer()) { bool ok = false; qulonglong integer = value.toULongLong(&ok, 0); - if (ok) - return reformatInteger(integer, format); + if (ok) { + const int format = itemFormat(data); + return reformatInteger(integer, format); + } } return translate(value);