forked from qt-creator/qt-creator
debugger: make format for all integer types selectable
This commit is contained in:
@@ -482,7 +482,7 @@ QString niceType(QString type)
|
||||
static QString formattedValue(const WatchData &data,
|
||||
int individualFormat, int typeFormat)
|
||||
{
|
||||
if (data.type == "int") {
|
||||
if (isIntType(data.type)) {
|
||||
int format = individualFormat == -1 ? typeFormat : individualFormat;
|
||||
int value = data.value.toInt();
|
||||
if (format == 1)
|
||||
@@ -649,7 +649,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
|
||||
return true;
|
||||
|
||||
case TypeFormatListRole:
|
||||
if (data.type == "int")
|
||||
if (isIntType(data.type))
|
||||
return QStringList() << tr("decimal") << tr("hexadecimal")
|
||||
<< tr("binary") << tr("octal");
|
||||
break;
|
||||
|
||||
@@ -305,18 +305,25 @@ QString extractTypeFromPTypeOutput(const QString &str)
|
||||
return res.simplified();
|
||||
}
|
||||
|
||||
bool isIntOrFloatType(const QString &type)
|
||||
bool isIntType(const QString &type)
|
||||
{
|
||||
static const QStringList types = QStringList()
|
||||
<< QLatin1String("char") << QLatin1String("int") << QLatin1String("short")
|
||||
<< QLatin1String("float") << QLatin1String("double") << QLatin1String("long")
|
||||
<< QLatin1String("bool") << QLatin1String("signed char") << QLatin1String("unsigned")
|
||||
<< QLatin1String("long") << QLatin1String("bool")
|
||||
<< QLatin1String("signed char") << QLatin1String("unsigned")
|
||||
<< QLatin1String("unsigned char")
|
||||
<< QLatin1String("unsigned int") << QLatin1String("unsigned long")
|
||||
<< QLatin1String("long long") << QLatin1String("unsigned long long");
|
||||
return types.contains(type);
|
||||
}
|
||||
|
||||
bool isIntOrFloatType(const QString &type)
|
||||
{
|
||||
static const QStringList types = QStringList()
|
||||
<< QLatin1String("float") << QLatin1String("double");
|
||||
return isIntType(type) || types.contains(type);
|
||||
}
|
||||
|
||||
QString sizeofTypeExpression(const QString &type)
|
||||
{
|
||||
if (type.endsWith(QLatin1Char('*')))
|
||||
|
||||
@@ -72,6 +72,7 @@ QString gdbQuoteTypes(const QString &type);
|
||||
bool extractTemplate(const QString &type, QString *tmplate, QString *inner);
|
||||
QString extractTypeFromPTypeOutput(const QString &str);
|
||||
bool isIntOrFloatType(const QString &type);
|
||||
bool isIntType(const QString &type);
|
||||
QString sizeofTypeExpression(const QString &type);
|
||||
QString quoteUnprintableLatin1(const QByteArray &ba);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user