Commit 75ade294 authored by hjk's avatar hjk

debugger: allow dumpers to return children in more than one nesting level

parent 62d7ea19
...@@ -1309,6 +1309,7 @@ static void qDumpQFileInfo(QDumper &d) ...@@ -1309,6 +1309,7 @@ static void qDumpQFileInfo(QDumper &d)
if (d.dumpChildren) { if (d.dumpChildren) {
d.beginChildren(); d.beginChildren();
d.putHash("absolutePath", info.absolutePath()); d.putHash("absolutePath", info.absolutePath());
#if 0
d.putHash("absoluteFilePath", info.absoluteFilePath()); d.putHash("absoluteFilePath", info.absoluteFilePath());
d.putHash("canonicalPath", info.canonicalPath()); d.putHash("canonicalPath", info.canonicalPath());
d.putHash("canonicalFilePath", info.canonicalFilePath()); d.putHash("canonicalFilePath", info.canonicalFilePath());
...@@ -1324,15 +1325,35 @@ static void qDumpQFileInfo(QDumper &d) ...@@ -1324,15 +1325,35 @@ static void qDumpQFileInfo(QDumper &d)
d.putHash("group", info.group()); d.putHash("group", info.group());
d.putHash("owner", info.owner()); d.putHash("owner", info.owner());
d.putHash("path", info.path()); d.putHash("path", info.path());
#endif
d.putHash("groupid", (long)info.groupId()); d.putHash("groupid", (long)info.groupId());
d.putHash("ownerid", (long)info.ownerId()); d.putHash("ownerid", (long)info.ownerId());
//QFile::Permissions permissions () const //QFile::Permissions permissions () const
d.putHash("permissions", (long)info.permissions()); long perms = info.permissions();
d.beginHash();
d.putItem("name", "permissions");
d.putItem("value", " ");
d.putItem("type", NS"QFile::Permissions");
d.putItem("numchild", 10);
d.beginChildren();
d.putHash("ReadOwner", bool(perms & QFile::ReadOwner));
d.putHash("WriteOwner", bool(perms & QFile::WriteOwner));
d.putHash("ExeOwner", bool(perms & QFile::ExeOwner));
d.putHash("ReadUser", bool(perms & QFile::ReadUser));
d.putHash("WriteUser", bool(perms & QFile::WriteUser));
d.putHash("ExeUser", bool(perms & QFile::ExeUser));
d.putHash("ReadGroup", bool(perms & QFile::ReadGroup));
d.putHash("WriteGroup", bool(perms & QFile::WriteGroup));
d.putHash("ExeGroup", bool(perms & QFile::ExeGroup));
d.putHash("ReadOther", bool(perms & QFile::ReadOther));
d.putHash("WriteOther", bool(perms & QFile::WriteOther));
d.putHash("ExeOther", bool(perms & QFile::ExeOther));
d.endChildren();
d.endHash();
//QDir absoluteDir () const //QDir absoluteDir () const
//QDir dir () const //QDir dir () const
#if 0
d.putHash("caching", info.caching()); d.putHash("caching", info.caching());
d.putHash("exists", info.exists()); d.putHash("exists", info.exists());
d.putHash("isAbsolute", info.isAbsolute()); d.putHash("isAbsolute", info.isAbsolute());
...@@ -1378,6 +1399,7 @@ static void qDumpQFileInfo(QDumper &d) ...@@ -1378,6 +1399,7 @@ static void qDumpQFileInfo(QDumper &d)
d.putItem("type", NS"QDateTime"); d.putItem("type", NS"QDateTime");
d.putItem("numchild", "1"); d.putItem("numchild", "1");
d.endHash(); d.endHash();
#endif
d.endChildren(); d.endChildren();
} }
......
...@@ -3401,41 +3401,50 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record, ...@@ -3401,41 +3401,50 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
setWatchDataType(data, record.data.findChild("type")); setWatchDataType(data, record.data.findChild("type"));
setWatchDataDisplayedType(data, record.data.findChild("displaytype")); setWatchDataDisplayedType(data, record.data.findChild("displaytype"));
setWatchDataValue(data, contents.findChild("value"), handleChildren(data, contents);
contents.findChild("valueencoded").data().toInt()); }
setWatchDataAddress(data, contents.findChild("addr"));
setWatchDataSAddress(data, contents.findChild("saddr")); void GdbEngine::handleChildren(const WatchData &data0, const GdbMi &item)
setWatchDataChildCount(data, contents.findChild("numchild")); {
setWatchDataValueToolTip(data, contents.findChild("valuetooltip"), WatchData data = data0;
contents.findChild("valuetooltipencoded").data().toInt()); if (!qq->watchHandler()->isExpandedIName(data.iname))
setWatchDataValueDisabled(data, contents.findChild("valuedisabled")); data.setChildrenUnneeded();
setWatchDataEditValue(data, contents.findChild("editvalue"));
GdbMi children = item.findChild("children");
if (children.isValid() || !qq->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
if (qq->watchHandler()->isDisplayedIName(data.iname)) { if (qq->watchHandler()->isDisplayedIName(data.iname)) {
GdbMi editvalue = contents.findChild("editvalue"); GdbMi editvalue = item.findChild("editvalue");
if (editvalue.isValid()) { if (editvalue.isValid()) {
setWatchDataEditValue(data, editvalue); setWatchDataEditValue(data, editvalue);
qq->watchHandler()->showEditValue(data); qq->watchHandler()->showEditValue(data);
} }
} }
if (!qq->watchHandler()->isExpandedIName(data.iname)) setWatchDataType(data, item.findChild("type"));
data.setChildrenUnneeded(); setWatchDataEditValue(data, item.findChild("editvalue"));
GdbMi children = contents.findChild("children"); setWatchDataExpression(data, item.findChild("exp"));
if (children.isValid() || !qq->watchHandler()->isExpandedIName(data.iname)) setWatchDataChildCount(data, item.findChild("numchild"));
data.setChildrenUnneeded(); setWatchDataValue(data, item.findChild("value"),
data.setValueUnneeded(); item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data, item.findChild("addr"));
setWatchDataSAddress(data, item.findChild("saddr"));
setWatchDataValueToolTip(data, item.findChild("valuetooltip"),
item.findChild("valuetooltipencoded").data().toInt());
setWatchDataValueDisabled(data, item.findChild("valuedisabled"));
// try not to repeat data too often // try not to repeat data too often
WatchData childtemplate; WatchData childtemplate;
setWatchDataType(childtemplate, contents.findChild("childtype")); setWatchDataType(childtemplate, item.findChild("childtype"));
setWatchDataChildCount(childtemplate, contents.findChild("childnumchild")); setWatchDataChildCount(childtemplate, item.findChild("childnumchild"));
//qDebug() << "CHILD TEMPLATE:" << childtemplate.toString(); //qDebug() << "CHILD TEMPLATE:" << childtemplate.toString();
qq->watchHandler()->insertData(data); qq->watchHandler()->insertData(data);
int i = 0; int i = 0;
QList<WatchData> list; QList<WatchData> list;
foreach (GdbMi item, children.children()) { foreach (GdbMi child, children.children()) {
WatchData data1 = childtemplate; WatchData data1 = childtemplate;
GdbMi name = item.findChild("name"); GdbMi name = child.findChild("name");
if (name.isValid()) if (name.isValid())
data1.name = _(name.data()); data1.name = _(name.data());
else else
...@@ -3443,9 +3452,9 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record, ...@@ -3443,9 +3452,9 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
data1.iname = data.iname + _c('.') + data1.name; data1.iname = data.iname + _c('.') + data1.name;
if (!data1.name.isEmpty() && data1.name.at(0).isDigit()) if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
data1.name = _c('[') + data1.name + _c(']'); data1.name = _c('[') + data1.name + _c(']');
QByteArray key = item.findChild("key").data(); QByteArray key = child.findChild("key").data();
if (!key.isEmpty()) { if (!key.isEmpty()) {
int encoding = item.findChild("keyencoded").data().toInt(); int encoding = child.findChild("keyencoded").data().toInt();
QString skey = decodeData(key, encoding); QString skey = decodeData(key, encoding);
if (skey.size() > 13) { if (skey.size() > 13) {
skey = skey.left(12); skey = skey.left(12);
...@@ -3454,19 +3463,7 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record, ...@@ -3454,19 +3463,7 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
//data1.name += " (" + skey + ")"; //data1.name += " (" + skey + ")";
data1.name = skey; data1.name = skey;
} }
setWatchDataType(data1, item.findChild("type")); handleChildren(data1, child);
setWatchDataExpression(data1, item.findChild("exp"));
setWatchDataChildCount(data1, item.findChild("numchild"));
setWatchDataValue(data1, item.findChild("value"),
item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data1, item.findChild("addr"));
setWatchDataSAddress(data1, item.findChild("saddr"));
setWatchDataValueToolTip(data1, item.findChild("valuetooltip"),
contents.findChild("valuetooltipencoded").data().toInt());
setWatchDataValueDisabled(data1, item.findChild("valuedisabled"));
if (!qq->watchHandler()->isExpandedIName(data1.iname))
data1.setChildrenUnneeded();
//qDebug() << "HANDLE CUSTOM SUBCONTENTS:" << data1.toString();
list.append(data1); list.append(data1);
++i; ++i;
} }
......
...@@ -241,6 +241,7 @@ private: ...@@ -241,6 +241,7 @@ private:
void debugMessage(const QString &msg); void debugMessage(const QString &msg);
bool showToolTip(); bool showToolTip();
void handleChildren(const WatchData &parent, const GdbMi &child);
const bool m_dumperInjectionLoad; const bool m_dumperInjectionLoad;
OutputCollector m_outputCollector; OutputCollector m_outputCollector;
......
...@@ -843,7 +843,9 @@ void WatchModel::insertData(const WatchData &data) ...@@ -843,7 +843,9 @@ void WatchModel::insertData(const WatchData &data)
void WatchModel::insertBulkData(const QList<WatchData> &list) void WatchModel::insertBulkData(const QList<WatchData> &list)
{ {
// qDebug() << "WMI:" << list.toString(); //qDebug() << "WMI:" << list.toString();
//foreach (const WatchItem &data, list)
// qDebug() << data.toString();
QTC_ASSERT(!list.isEmpty(), return); QTC_ASSERT(!list.isEmpty(), return);
QString parentIName = parentName(list.at(0).iname); QString parentIName = parentName(list.at(0).iname);
WatchItem *parent = findItem(parentIName, m_root); WatchItem *parent = findItem(parentIName, m_root);
......
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