Commit b4c1552e authored by hjk's avatar hjk
Browse files

handle Qt 4.4 and Qt 4.5's QMap in dumpers

parent cb78617e
......@@ -1367,14 +1367,22 @@ static void qDumpQMap(QDumper &d)
P(d, "addr", addOffset(node, valueOffset));
} else {
P(d, "name", "[" << i << "]");
P(d, "type", NS"QMapNode<" << keyType << "," << valueType << " >");
#if QT_VERSION >= 0x040500
// actually, any type (even 'char') will do...
P(d, "exp", "*('"NS"QMapNode<" << keyType << "," << valueType << " >'*)" << node);
P(d, "type", NS"QMapNode<"
<< keyType << "," << valueType << " >");
P(d, "exp", "*('"NS"QMapNode<"
<< keyType << "," << valueType << " >'*)" << node);
//P(d, "exp", "*('"NS"QMapData'*)" << (void*)node);
//P(d, "exp", "*(char*)" << (void*)node);
// P(d, "addr", node); does not work as gdb fails to parse
// e.g. &((*('"NS"QMapNode<QString,Foo>'*)0x616658))
#else
P(d, "type", NS"QMapData::Node<"
<< keyType << "," << valueType << " >");
P(d, "exp", "*('"NS"QMapData::Node<"
<< keyType << "," << valueType << " >'*)" << node);
#endif
}
d.endHash();
......@@ -2483,6 +2491,10 @@ void qDumpObjectData440(
"\"std::vector\","
"\"std::wstring\","
"]";
d << ",qtversion=["
"\"" << ((QT_VERSION >> 16) & 255) << "\","
"\"" << ((QT_VERSION >> 8) & 255) << "\","
"\"" << ((QT_VERSION) & 255) << "\"]";
d << ",namespace=\""NS"\"";
d.disarm();
}
......
......@@ -2944,8 +2944,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
QString outertype = isTemplate ? tmplate : data.type;
// adjust the data extract
if (outertype == "QWidget")
outertype = "QObject";
if (outertype == m_namespace + "QWidget")
outertype = m_namespace + "QObject";
QString extraArgs[4];
extraArgs[0] = "0";
......@@ -2978,9 +2978,15 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
slotNumber = data.iname.mid(lastOpened + 1, lastClosed - lastOpened - 1);
extraArgs[0] = slotNumber;
} else if (outertype == m_namespace + "QMap") {
QString nodetype = m_namespace + "QMapNode";
nodetype += data.type.mid(m_namespace.size() + 4);
//qDebug() << "OUTERTYPE: " << outertype << " NODETYPE: " << nodetype;
QString nodetype;
if (m_qtVersion >= (4 << 16) + (5 << 8) + 0) {
nodetype = m_namespace + "QMapNode";
nodetype += data.type.mid(m_namespace.size() + 4);
} else {
nodetype = data.type + "::Node";
}
//qDebug() << "OUTERTYPE: " << outertype << " NODETYPE: " << nodetype
// << "QT VERSION" << m_qtVersion << ((4 << 16) + (5 << 8) + 0);
extraArgs[2] = sizeofTypeExpression(nodetype);
extraArgs[3] = "(size_t)&(('" + nodetype + "'*)0)->value";
} else if (outertype == m_namespace + "QMapNode") {
......@@ -3311,6 +3317,16 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
GdbMi contents(output.data());
GdbMi simple = contents.findChild("dumpers");
m_namespace = contents.findChild("namespace").data();
GdbMi qtversion = contents.findChild("qtversion");
if (qtversion.children().size() == 3) {
m_qtVersion = (qtversion.childAt(0).data().toInt() << 16)
+ (qtversion.childAt(1).data().toInt() << 8)
+ qtversion.childAt(2).data().toInt();
//qDebug() << "FOUND QT VERSION: " << qtversion.toString() << m_qtVersion;
} else {
m_qtVersion = 0;
}
//qDebug() << "OUTPUT: " << output.toString();
//qDebug() << "CONTENTS: " << contents.toString();
//qDebug() << "SIMPLE DUMPERS: " << simple.toString();
......@@ -3951,6 +3967,9 @@ void GdbEngine::tryLoadCustomDumpers()
sendCommand("sharedlibrary " + dotEscape(lib));
if (qq->useFastStart())
sendCommand("set stop-on-solib-events 1");
} else {
qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: "
<< lib << QFileInfo(lib).isExecutable();
}
#endif
#if defined(Q_OS_MAC)
......@@ -3964,6 +3983,9 @@ void GdbEngine::tryLoadCustomDumpers()
sendCommand("sharedlibrary " + dotEscape(lib));
if (qq->useFastStart())
sendCommand("set stop-on-solib-events 1");
} else {
qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: "
<< lib << QFileInfo(lib).isExecutable();
}
#endif
#if defined(Q_OS_WIN)
......@@ -3977,6 +3999,9 @@ void GdbEngine::tryLoadCustomDumpers()
sendCommand("sharedlibrary " + dotEscape(lib));
if (qq->useFastStart())
sendCommand("set stop-on-solib-events 1");
} else {
qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: "
<< lib << QFileInfo(lib).isExecutable();
}
#endif
......
......@@ -333,6 +333,7 @@ private:
QStringList m_availableSimpleDumpers;
QString m_namespace; // namespace used in "namespaced Qt";
int m_qtVersion; // Qt version used in the debugged program
DataDumperState m_dataDumperState; // state of qt creator dumpers
QList<GdbMi> m_currentFunctionArgs;
......
Supports Markdown
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