forked from qt-creator/qt-creator
Debugger: Generalize Locals&Expression tree item parsing
An intermediate step to move the engines one by one to direct WatchItem construction. Change-Id: I563582498c4eeb3d604dfa046722133ab6d24650 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -585,9 +585,11 @@ static void decodeArray(QList<WatchData> *list, const WatchData &tmplate,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
void parseChildrenData(const QSet<QByteArray> &expandedINames,
|
||||||
const WatchData &data0, const GdbMi &item,
|
const WatchData &data0, const GdbMi &item,
|
||||||
QList<WatchData> *list)
|
std::function<void(const WatchData &)> itemHandler,
|
||||||
|
std::function<void(const QSet<QByteArray> &, const WatchData &, const GdbMi &)> childHandler,
|
||||||
|
std::function<void(const WatchData &childTemplate, const QByteArray &encodedData, int encoding)> arrayDecoder)
|
||||||
{
|
{
|
||||||
//qDebug() << "HANDLE CHILDREN: " << data0.toString() << item.toString();
|
//qDebug() << "HANDLE CHILDREN: " << data0.toString() << item.toString();
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
@@ -640,7 +642,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
setWatchDataValueEditable(data, item["valueeditable"]);
|
setWatchDataValueEditable(data, item["valueeditable"]);
|
||||||
data.updateChildCount(item["numchild"]);
|
data.updateChildCount(item["numchild"]);
|
||||||
//qDebug() << "\nAPPEND TO LIST: " << data.toString() << "\n";
|
//qDebug() << "\nAPPEND TO LIST: " << data.toString() << "\n";
|
||||||
list->append(data);
|
itemHandler(data);
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
qulonglong addressBase = item["addrbase"].data().toULongLong(&ok, 0);
|
qulonglong addressBase = item["addrbase"].data().toULongLong(&ok, 0);
|
||||||
@@ -657,7 +659,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
int encoding = item["arrayencoding"].toInt();
|
int encoding = item["arrayencoding"].toInt();
|
||||||
childtemplate.iname = data.iname + '.';
|
childtemplate.iname = data.iname + '.';
|
||||||
childtemplate.address = addressBase;
|
childtemplate.address = addressBase;
|
||||||
decodeArray(list, childtemplate, mi.data(), encoding);
|
arrayDecoder(childtemplate, mi.data(), encoding);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0, n = children.children().size(); i != n; ++i) {
|
for (int i = 0, n = children.children().size(); i != n; ++i) {
|
||||||
const GdbMi &child = children.children().at(i);
|
const GdbMi &child = children.children().at(i);
|
||||||
@@ -687,11 +689,30 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
int encoding = child["keyencoded"].toInt();
|
int encoding = child["keyencoded"].toInt();
|
||||||
data1.name = decodeData(key, encoding);
|
data1.name = decodeData(key, encoding);
|
||||||
}
|
}
|
||||||
parseWatchData(expandedINames, data1, child, list);
|
childHandler(expandedINames, data1, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||||
|
const WatchData &data0, const GdbMi &input,
|
||||||
|
QList<WatchData> *list)
|
||||||
|
{
|
||||||
|
auto itemHandler = [list](const WatchData &data) {
|
||||||
|
list->append(data);
|
||||||
|
};
|
||||||
|
auto childHandler = [list](const QSet<QByteArray> &expandedINames,
|
||||||
|
const WatchData &innerData, const GdbMi &innerInput) {
|
||||||
|
parseWatchData(expandedINames, innerData, innerInput, list);
|
||||||
|
};
|
||||||
|
auto arrayDecoder = [list](const WatchData &childTemplate,
|
||||||
|
const QByteArray &encodedData, int encoding) {
|
||||||
|
decodeArray(list, childTemplate, encodedData, encoding);
|
||||||
|
};
|
||||||
|
|
||||||
|
parseChildrenData(expandedINames, data0, input, itemHandler, childHandler, arrayDecoder);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -151,6 +153,16 @@ public:
|
|||||||
qint32 source; // Originated from dumper or symbol evaluation? (CDB only)
|
qint32 source; // Originated from dumper or symbol evaluation? (CDB only)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void parseChildrenData(const QSet<QByteArray> &expandedINames,
|
||||||
|
const WatchData &parent, const GdbMi &child,
|
||||||
|
std::function<void(const WatchData &)> itemHandler,
|
||||||
|
std::function<void(const QSet<QByteArray> &,
|
||||||
|
const WatchData &,
|
||||||
|
const GdbMi &)> childHandler,
|
||||||
|
std::function<void(const WatchData &childTemplate,
|
||||||
|
const QByteArray &encodedData,
|
||||||
|
int encoding)> arrayDecoder);
|
||||||
|
|
||||||
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||||
const WatchData &parent, const GdbMi &child,
|
const WatchData &parent, const GdbMi &child,
|
||||||
QList<WatchData> *insertions);
|
QList<WatchData> *insertions);
|
||||||
|
Reference in New Issue
Block a user