forked from qt-creator/qt-creator
debugger: more QByteArray/type
This commit is contained in:
@@ -1520,7 +1520,7 @@ void GdbEngine::handleHasPython(const GdbResponse &response)
|
|||||||
data.fromStringMultiple(contents.data());
|
data.fromStringMultiple(contents.data());
|
||||||
const GdbMi dumpers = data.findChild("dumpers");
|
const GdbMi dumpers = data.findChild("dumpers");
|
||||||
foreach (const GdbMi &dumper, dumpers.children()) {
|
foreach (const GdbMi &dumper, dumpers.children()) {
|
||||||
QString type = _(dumper.findChild("type").data());
|
QByteArray type = dumper.findChild("type").data();
|
||||||
QStringList formats(tr("Raw structure"));
|
QStringList formats(tr("Raw structure"));
|
||||||
QString reported = _(dumper.findChild("formats").data());
|
QString reported = _(dumper.findChild("formats").data());
|
||||||
formats.append(reported.split(_(","), QString::SkipEmptyParts));
|
formats.append(reported.split(_(","), QString::SkipEmptyParts));
|
||||||
|
|||||||
@@ -251,13 +251,13 @@ static QByteArray parentName(const QByteArray &iname)
|
|||||||
static QString chopConst(QString type)
|
static QString chopConst(QString type)
|
||||||
{
|
{
|
||||||
while (1) {
|
while (1) {
|
||||||
if (type.startsWith("const"))
|
if (type.startsWith(QLatin1String("const")))
|
||||||
type = type.mid(5);
|
type = type.mid(5);
|
||||||
else if (type.startsWith(' '))
|
else if (type.startsWith(QLatin1Char(' ')))
|
||||||
type = type.mid(1);
|
type = type.mid(1);
|
||||||
else if (type.endsWith("const"))
|
else if (type.endsWith(QLatin1String("const")))
|
||||||
type.chop(5);
|
type.chop(5);
|
||||||
else if (type.endsWith(' '))
|
else if (type.endsWith(QLatin1Char(' ')))
|
||||||
type.chop(1);
|
type.chop(1);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@@ -279,14 +279,14 @@ static inline QRegExp stdStringRegExp(const QString &charType)
|
|||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString niceTypeHelper(const QString typeIn)
|
static QByteArray niceTypeHelper(const QByteArray typeIn)
|
||||||
{
|
{
|
||||||
static QMap<QString, QString> cache;
|
static QMap<QByteArray, QByteArray> cache;
|
||||||
const QMap<QString, QString>::const_iterator it = cache.constFind(typeIn);
|
const QMap<QByteArray, QByteArray>::const_iterator it = cache.constFind(typeIn);
|
||||||
if (it != cache.constEnd())
|
if (it != cache.constEnd())
|
||||||
return it.value();
|
return it.value();
|
||||||
|
|
||||||
QString type = typeIn;
|
QString type = QString::fromUtf8(typeIn);
|
||||||
type.replace(QLatin1Char('*'), QLatin1Char('@'));
|
type.replace(QLatin1Char('*'), QLatin1Char('@'));
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
@@ -375,19 +375,20 @@ static QString niceTypeHelper(const QString typeIn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
type.replace(QLatin1Char('@'), QLatin1Char('*'));
|
QByteArray typeOut = type.toUtf8();
|
||||||
type.replace(QLatin1String(" >"), QString(QLatin1Char('>')));
|
typeOut.replace('@', '*');
|
||||||
cache.insert(typeIn, type); // For simplicity, also cache unmodified types
|
typeOut.replace(" >", ">");
|
||||||
return type;
|
cache.insert(typeIn, typeOut); // For simplicity, also cache unmodified types
|
||||||
|
return typeOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WatchModel::niceType(const QString &typeIn) const
|
QByteArray WatchModel::niceType(const QByteArray &typeIn) const
|
||||||
{
|
{
|
||||||
QString type = niceTypeHelper(typeIn);
|
QByteArray type = niceTypeHelper(typeIn);
|
||||||
if (!theDebuggerBoolSetting(ShowStdNamespace))
|
if (!theDebuggerBoolSetting(ShowStdNamespace))
|
||||||
type = type.remove("std::");
|
type.replace("std::", "");
|
||||||
if (!theDebuggerBoolSetting(ShowQtNamespace))
|
if (!theDebuggerBoolSetting(ShowQtNamespace))
|
||||||
type = type.remove(engine()->qtNamespace());
|
type.replace(engine()->qtNamespace(), "");
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,7 +627,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
|
|||||||
case 2: {
|
case 2: {
|
||||||
if (!data.displayedType.isEmpty())
|
if (!data.displayedType.isEmpty())
|
||||||
return data.displayedType;
|
return data.displayedType;
|
||||||
return niceType(data.type);
|
return QString::fromUtf8(niceType(data.type));
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@@ -1443,14 +1444,14 @@ void WatchHandler::loadTypeFormats()
|
|||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
if (!it.key().isEmpty())
|
if (!it.key().isEmpty())
|
||||||
m_typeFormats.insert(it.key(), it.value().toInt());
|
m_typeFormats.insert(it.key().toUtf8(), it.value().toInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::saveTypeFormats()
|
void WatchHandler::saveTypeFormats()
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> typeFormats;
|
QMap<QString, QVariant> typeFormats;
|
||||||
QHashIterator<QString, int> it(m_typeFormats);
|
QHashIterator<QByteArray, int> it(m_typeFormats);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
const int format = it.value();
|
const int format = it.value();
|
||||||
@@ -1535,7 +1536,7 @@ WatchData *WatchHandler::findItem(const QByteArray &iname) const
|
|||||||
return model->findItem(iname, model->m_root);
|
return model->findItem(iname, model->m_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::setFormat(const QString &type, int format)
|
void WatchHandler::setFormat(const QByteArray &type, int format)
|
||||||
{
|
{
|
||||||
if (format == -1)
|
if (format == -1)
|
||||||
m_typeFormats.remove(type);
|
m_typeFormats.remove(type);
|
||||||
@@ -1580,10 +1581,10 @@ QByteArray WatchHandler::typeFormatRequests() const
|
|||||||
{
|
{
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
if (!m_typeFormats.isEmpty()) {
|
if (!m_typeFormats.isEmpty()) {
|
||||||
QHashIterator<QString, int> it(m_typeFormats);
|
QHashIterator<QByteArray, int> it(m_typeFormats);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
ba.append(it.key().toLatin1().toHex());
|
ba.append(it.key().toHex());
|
||||||
ba.append('=');
|
ba.append('=');
|
||||||
ba.append(QByteArray::number(it.value()));
|
ba.append(QByteArray::number(it.value()));
|
||||||
ba.append(',');
|
ba.append(',');
|
||||||
@@ -1610,7 +1611,7 @@ QByteArray WatchHandler::individualFormatRequests() const
|
|||||||
return ba;
|
return ba;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::addTypeFormats(const QString &type, const QStringList &formats)
|
void WatchHandler::addTypeFormats(const QByteArray &type, const QStringList &formats)
|
||||||
{
|
{
|
||||||
m_reportedTypeFormats.insert(type, formats);
|
m_reportedTypeFormats.insert(type, formats);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ signals:
|
|||||||
void enableUpdates(bool);
|
void enableUpdates(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString niceType(const QString &typeIn) const;
|
QByteArray niceType(const QByteArray &typeIn) const;
|
||||||
void formatRequests(QByteArray *out, const WatchItem *item) const;
|
void formatRequests(QByteArray *out, const WatchItem *item) const;
|
||||||
DebuggerEngine *engine() const;
|
DebuggerEngine *engine() const;
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ public:
|
|||||||
|
|
||||||
int format(const QByteArray &iname) const;
|
int format(const QByteArray &iname) const;
|
||||||
|
|
||||||
void addTypeFormats(const QString &type, const QStringList &formats);
|
void addTypeFormats(const QByteArray &type, const QStringList &formats);
|
||||||
|
|
||||||
QByteArray watcherName(const QByteArray &exp);
|
QByteArray watcherName(const QByteArray &exp);
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ private:
|
|||||||
|
|
||||||
void loadTypeFormats();
|
void loadTypeFormats();
|
||||||
void saveTypeFormats();
|
void saveTypeFormats();
|
||||||
void setFormat(const QString &type, int format);
|
void setFormat(const QByteArray &type, int format);
|
||||||
void updateWatchersWindow();
|
void updateWatchersWindow();
|
||||||
|
|
||||||
bool m_inChange;
|
bool m_inChange;
|
||||||
@@ -195,7 +195,7 @@ private:
|
|||||||
EditHandlers m_editHandlers;
|
EditHandlers m_editHandlers;
|
||||||
|
|
||||||
QHash<QByteArray, int> m_watcherNames;
|
QHash<QByteArray, int> m_watcherNames;
|
||||||
QHash<QString, int> m_typeFormats;
|
QHash<QByteArray, int> m_typeFormats;
|
||||||
QHash<QByteArray, int> m_individualFormats; // Indexed by iname.
|
QHash<QByteArray, int> m_individualFormats; // Indexed by iname.
|
||||||
QHash<QString, QStringList> m_reportedTypeFormats;
|
QHash<QString, QStringList> m_reportedTypeFormats;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user