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>
This commit is contained in:
Andre Hartmann
2021-10-31 14:28:45 +01:00
committed by André Hartmann
parent 3857ef8258
commit f9f26570c9
3 changed files with 57 additions and 10 deletions

View File

@@ -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'

View File

@@ -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";

View File

@@ -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