forked from qt-creator/qt-creator
Debugger: Improve handling of stdint types
* Make (u)intX_t known as integral type * Handle uint8_t[] the same way as char[] and unsigned char[] Task-number: QTCREATORBUG-26501 Change-Id: I1eac21be198f8107f088e56daf435b5bb3217120 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
03bcdc9186
commit
78a1beb06e
@@ -1137,6 +1137,7 @@ class DumperBase():
|
|||||||
'char',
|
'char',
|
||||||
'wchar_t',
|
'wchar_t',
|
||||||
'unsigned char',
|
'unsigned char',
|
||||||
|
'uint8_t',
|
||||||
'signed char',
|
'signed char',
|
||||||
'CHAR',
|
'CHAR',
|
||||||
'WCHAR'
|
'WCHAR'
|
||||||
@@ -1243,7 +1244,7 @@ class DumperBase():
|
|||||||
if innerType.code == TypeCode.Typedef:
|
if innerType.code == TypeCode.Typedef:
|
||||||
targetType = innerType.ltarget
|
targetType = innerType.ltarget
|
||||||
|
|
||||||
if targetType.name in ('char', 'signed char', 'unsigned char', 'CHAR'):
|
if targetType.name in ('char', 'signed char', 'unsigned char', 'uint8_t', 'CHAR'):
|
||||||
# Use UTF-8 as default for char *.
|
# Use UTF-8 as default for char *.
|
||||||
self.putType(typeName)
|
self.putType(typeName)
|
||||||
(elided, shown, data) = self.readToFirstZero(ptr, 1, limit)
|
(elided, shown, data) = self.readToFirstZero(ptr, 1, limit)
|
||||||
@@ -1406,6 +1407,7 @@ class DumperBase():
|
|||||||
'char',
|
'char',
|
||||||
'signed char',
|
'signed char',
|
||||||
'unsigned char',
|
'unsigned char',
|
||||||
|
'uint8_t',
|
||||||
'wchar_t',
|
'wchar_t',
|
||||||
'CHAR',
|
'CHAR',
|
||||||
'WCHAR'
|
'WCHAR'
|
||||||
@@ -3628,6 +3630,7 @@ class DumperBase():
|
|||||||
'char': 'int:1',
|
'char': 'int:1',
|
||||||
'signed char': 'int:1',
|
'signed char': 'int:1',
|
||||||
'unsigned char': 'uint:1',
|
'unsigned char': 'uint:1',
|
||||||
|
'uint8_t': 'uint:1',
|
||||||
'short': 'int:2',
|
'short': 'int:2',
|
||||||
'unsigned short': 'uint:2',
|
'unsigned short': 'uint:2',
|
||||||
'int': 'int:4',
|
'int': 'int:4',
|
||||||
|
@@ -50,7 +50,12 @@ bool isIntType(const QString &type)
|
|||||||
case 'c':
|
case 'c':
|
||||||
return type == "char";
|
return type == "char";
|
||||||
case 'i':
|
case 'i':
|
||||||
return type == "int";
|
return type.startsWith("int") &&
|
||||||
|
( type == "int"
|
||||||
|
|| type == "int8_t"
|
||||||
|
|| type == "int16_t"
|
||||||
|
|| type == "int32_t"
|
||||||
|
|| type == "int64_t");
|
||||||
case 'l':
|
case 'l':
|
||||||
return type == "long"
|
return type == "long"
|
||||||
|| type == "long int"
|
|| type == "long int"
|
||||||
@@ -86,7 +91,12 @@ bool isIntType(const QString &type)
|
|||||||
|| type == "unsigned long"
|
|| type == "unsigned long"
|
||||||
|| type == "unsigned long int"
|
|| type == "unsigned long int"
|
||||||
|| type == "unsigned long long"
|
|| type == "unsigned long long"
|
||||||
|| type == "unsigned long long int"));
|
|| type == "unsigned long long int"))
|
||||||
|
|| (type.startsWith("uint") &&
|
||||||
|
( type == "uint8_t"
|
||||||
|
|| type == "uint16_t"
|
||||||
|
|| type == "uint32_t"
|
||||||
|
|| type == "uint64_t"));
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -718,10 +718,10 @@ static QString formattedValue(const WatchItem *item)
|
|||||||
|
|
||||||
// Append quoted, printable character also for decimal.
|
// Append quoted, printable character also for decimal.
|
||||||
// FIXME: This is unreliable.
|
// FIXME: This is unreliable.
|
||||||
if (item->type.endsWith("char")) {
|
if (item->type.endsWith("char") || item->type.endsWith("int8_t")) {
|
||||||
bool ok;
|
bool ok;
|
||||||
const int code = item->value.toInt(&ok);
|
const int code = item->value.toInt(&ok);
|
||||||
bool isUnsigned = item->type == "unsigned char" || item->type == "uchar";
|
bool isUnsigned = item->type == "unsigned char" || item->type == "uchar" || item->type == "uint8_t";
|
||||||
if (ok)
|
if (ok)
|
||||||
return reformatCharacter(code, 1, !isUnsigned);
|
return reformatCharacter(code, 1, !isUnsigned);
|
||||||
} else if (item->type.endsWith("wchar_t")) {
|
} else if (item->type.endsWith("wchar_t")) {
|
||||||
|
Reference in New Issue
Block a user