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,
|
||||
const WatchData &data0, const GdbMi &item,
|
||||
QList<WatchData> *list)
|
||||
void parseChildrenData(const QSet<QByteArray> &expandedINames,
|
||||
const WatchData &data0, const GdbMi &item,
|
||||
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();
|
||||
WatchData data = data0;
|
||||
@@ -640,7 +642,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||
setWatchDataValueEditable(data, item["valueeditable"]);
|
||||
data.updateChildCount(item["numchild"]);
|
||||
//qDebug() << "\nAPPEND TO LIST: " << data.toString() << "\n";
|
||||
list->append(data);
|
||||
itemHandler(data);
|
||||
|
||||
bool ok = false;
|
||||
qulonglong addressBase = item["addrbase"].data().toULongLong(&ok, 0);
|
||||
@@ -657,7 +659,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||
int encoding = item["arrayencoding"].toInt();
|
||||
childtemplate.iname = data.iname + '.';
|
||||
childtemplate.address = addressBase;
|
||||
decodeArray(list, childtemplate, mi.data(), encoding);
|
||||
arrayDecoder(childtemplate, mi.data(), encoding);
|
||||
} else {
|
||||
for (int i = 0, n = children.children().size(); i != n; ++i) {
|
||||
const GdbMi &child = children.children().at(i);
|
||||
@@ -687,11 +689,30 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
||||
int encoding = child["keyencoded"].toInt();
|
||||
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 Debugger
|
||||
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QMetaType>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
@@ -151,6 +153,16 @@ public:
|
||||
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,
|
||||
const WatchData &parent, const GdbMi &child,
|
||||
QList<WatchData> *insertions);
|
||||
|
Reference in New Issue
Block a user