diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2021-10-31 14:28:45 +0100 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2021-11-09 13:30:37 +0000 |
commit | f9f26570c9ac434d5783599a02bb888296d249d8 (patch) | |
tree | 5d910f7993578bdb910597ce2c84c4aa32278c96 | |
parent | 3857ef8258ca76329080cf8b22dcce271b280eed (diff) |
Debugger: Add even more std and Qt char and int types
Make more stdint, quint and char types known to the debugger.
Task-number: QTCREATORBUG-26501
Change-Id: I1e757af2a495142fa37fe2b7cefec56690adbf08
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | share/qtcreator/debugger/dumper.py | 34 | ||||
-rw-r--r-- | src/plugins/debugger/watchdata.cpp | 9 | ||||
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 24 |
3 files changed, 57 insertions, 10 deletions
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 7bdb028eba..3838e13965 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -1135,12 +1135,18 @@ class DumperBase(): if displayFormat != DisplayFormat.Raw and p: if innerType.name in ( 'char', + 'int8_t', + 'qint8', 'wchar_t', 'unsigned char', 'uint8_t', + 'quint8', 'signed char', 'CHAR', - 'WCHAR' + 'WCHAR', + 'char8_t', + 'char16_t', + 'char32_t' ): self.putCharArrayHelper(p, n, innerType, self.currentItemFormat(), makeExpandable=False) @@ -1406,11 +1412,17 @@ class DumperBase(): if innerType.name not in ( 'char', 'signed char', + 'int8_t', + 'qint8', 'unsigned char', 'uint8_t', + 'quint8', 'wchar_t', 'CHAR', - 'WCHAR' + 'WCHAR', + 'char8_t', + 'char16_t', + 'char32_t' ): self.putDerefedPointer(value) return @@ -3628,15 +3640,33 @@ class DumperBase(): res = { 'bool': 'int:1', 'char': 'int:1', + 'int8_t': 'int:1', + 'qint8': 'int:1', 'signed char': 'int:1', + 'char8_t': 'uint:1', 'unsigned char': 'uint:1', 'uint8_t': 'uint:1', + 'quint8': 'uint:1', 'short': 'int:2', + 'int16_t': 'int:2', + 'qint16': 'int:2', 'unsigned short': 'uint:2', + 'char16_t': 'uint:2', + 'uint16_t': 'uint:2', + 'quint16': 'uint:2', 'int': 'int:4', + 'int32_t': 'int:4', + 'qint32': 'int:4', 'unsigned int': 'uint:4', + 'char32_t': 'uint:4', + 'uint32_t': 'uint:4', + 'quint32': 'uint:4', 'long long': 'int:8', + 'int64_t': 'int:8', + 'qint64': 'int:8', 'unsigned long long': 'uint:8', + 'uint64_t': 'uint:8', + 'quint64': 'uint:8', 'float': 'float:4', 'double': 'float:8', 'QChar': 'uint:2' diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index 49a75cc86f..cf49aa250d 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -48,7 +48,11 @@ bool isIntType(const QString &type) case 'b': return type == "bool"; case 'c': - return type == "char"; + return type.startsWith("char") && + ( type == "char" + || type == "char8_t" + || type == "char16_t" + || type == "char32_t" ); case 'i': return type.startsWith("int") && ( type == "int" @@ -63,7 +67,8 @@ bool isIntType(const QString &type) case 'p': return type == "ptrdiff_t"; case 'q': - return type == "qint16" || type == "quint16" + return type == "qint8" || type == "quint8" + || type == "qint16" || type == "quint16" || type == "qint32" || type == "quint32" || type == "qint64" || type == "quint64" || type == "qlonglong" || type == "qulonglong"; diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 2b5373a042..1e347e6722 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -717,22 +717,34 @@ static QString formattedValue(const WatchItem *item) // Append quoted, printable character also for decimal. // FIXME: This is unreliable. - if (item->type.endsWith("char") || item->type.endsWith("int8_t")) { + const QString type = item->type; + if (type == "char8_t" || type.endsWith("char") || type.endsWith("int8_t")) { bool ok; const int code = item->value.toInt(&ok); - bool isUnsigned = item->type == "unsigned char" || item->type == "uchar" || item->type == "uint8_t"; + bool isUnsigned = type == "char8_t" + || type == "unsigned char" + || type == "uchar" + || type == "uint8_t"; if (ok) return reformatCharacter(code, 1, !isUnsigned); - } else if (item->type.endsWith("wchar_t")) { + } else if (type == "qint8" || type == "quint8") { + bool ok = false; + const int code = item->value.toInt(&ok); + bool isUnsigned = type == "quint8"; + if (ok) + return reformatCharacter(code, 1, !isUnsigned); + } else if (type == "char32_t" || type.endsWith("wchar_t")) { bool ok; const int code = item->value.toInt(&ok); + bool isUnsigned = type == "char32_t"; if (ok) - return reformatCharacter(code, 4, false); - } else if (item->type.endsWith("QChar")) { + return reformatCharacter(code, 4, !isUnsigned); + } else if (type == "char16_t" || type.endsWith("QChar")) { bool ok; const int code = item->value.toInt(&ok); + bool isUnsigned = type == "char16_t"; if (ok) - return reformatCharacter(code, 2, false); + return reformatCharacter(code, 2, !isUnsigned); } if (format == HexadecimalIntegerFormat |