Commit bea159a7 authored by hjk's avatar hjk

Debugger: Some parser code consolidation

Change-Id: Icd3afb632cb935fdd95f13db91c9c11a3dea732e
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent 0d0a6d11
......@@ -4958,25 +4958,11 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
}
foreach (const GdbMi &child, data.children()) {
QByteArray iname = child["iname"].data();
QString name;
GdbMi wname = child["wname"];
if (wname.isValid()) // Happens (only) for watched expressions.
name = QString::fromUtf8(QByteArray::fromHex(wname.data()));
else
name = _(child["name"].data());
WatchItem *item = new WatchItem(iname, name);
item->parseWatchData(child);
WatchItem *item = new WatchItem(child);
const TypeInfo ti = m_typeInfoCache.value(item->d.type);
if (ti.size)
item->d.size = ti.size;
if (wname.isValid())
item->d.exp = name.toUtf8();
handler->insertItem(item);
toDelete.remove(item->d.iname);
}
......
......@@ -1019,21 +1019,7 @@ void LldbEngine::refreshLocals(const GdbMi &vars)
toDelete.insert(item->d.iname);
foreach (const GdbMi &child, vars.children()) {
QByteArray iname = child["iname"].data();
QString name;
GdbMi wname = child["wname"];
if (wname.isValid()) // Happens (only) for watched expressions.
name = QString::fromUtf8(QByteArray::fromHex(wname.data()));
else
name = QString::fromLatin1(child["name"].data());
WatchItem *item = new WatchItem(iname, name);
item->parseWatchData(child);
if (wname.isValid())
item->d.exp = name.toUtf8();
WatchItem *item = new WatchItem(child);
handler->insertItem(item);
toDelete.remove(item->d.iname);
}
......
......@@ -807,8 +807,7 @@ void PdbEngine::handleListLocals(const PdbResponse &response)
toDelete.insert(item->d.iname);
foreach (const GdbMi &child, all.children()) {
WatchItem *item = new WatchItem(child["iname"].data(), _(child["name"].data()));
item->parseWatchData(child);
WatchItem *item = new WatchItem(child);
handler->insertItem(item);
toDelete.remove(item->d.iname);
}
......
......@@ -1913,6 +1913,23 @@ WatchItem::WatchItem(const WatchData &data)
{
}
WatchItem::WatchItem(const GdbMi &data)
: fetchTriggered(false)
{
d.iname = data["iname"].data();
GdbMi wname = data["wname"];
if (wname.isValid()) // Happens (only) for watched expressions.
d.name = QString::fromUtf8(QByteArray::fromHex(wname.data()));
else
d.name = QString::fromLatin1(data["name"].data());
parseWatchData(data);
if (wname.isValid())
d.exp = d.name.toUtf8();
}
WatchItem *WatchItem::parentItem() const
{
return dynamic_cast<WatchItem *>(parent());
......
......@@ -50,6 +50,7 @@ public:
WatchItem();
WatchItem(const QByteArray &i, const QString &n);
explicit WatchItem(const WatchData &data);
explicit WatchItem(const GdbMi &data);
WatchItem *parentItem() const;
const WatchModel *watchModel() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment