move some of the code for handling template types from creator proper

to the "user space" (gdbmacros.cpp)
This commit is contained in:
hjk
2008-12-18 10:11:10 +01:00
parent b7fe1e7937
commit 3bd633ef04
2 changed files with 25 additions and 45 deletions
+17 -12
View File
@@ -2439,23 +2439,23 @@ void qDumpObjectData440(
d.protocolVersion = protocolVersion; d.protocolVersion = protocolVersion;
d.token = token; d.token = token;
//qDebug() << "SOCKET: after connect: state: " << qDumperSocket.state(); // This is a list of all available dumpers. Note that some templates
// simpledumpers is a list of all available dumpers that are // currently require special hardcoded handling in the debugger plugin.
// _not_ templates. templates currently require special // They are mentioned here nevertheless. For types that not listed
// hardcoded handling in the debugger plugin. // here, dumpers won't be used.
// don't mention them here in this list d << "dumpers=["
d << "simpledumpers=["
"\""NS"QByteArray\"," "\""NS"QByteArray\","
"\""NS"QDateTime\","
"\""NS"QDir\"," "\""NS"QDir\","
"\""NS"QImage\","
"\""NS"QFile\"," "\""NS"QFile\","
"\""NS"QFileInfo\"," "\""NS"QFileInfo\","
"\""NS"QHash\","
"\""NS"QHashNode\","
"\""NS"QImage\","
"\""NS"QLocale\"," "\""NS"QLocale\","
"\""NS"QMap\","
"\""NS"QMapNode\","
"\""NS"QModelIndex\"," "\""NS"QModelIndex\","
//"\""NS"QHash\"," // handled on GH side
//"\""NS"QHashNode\","
//"\""NS"QMap\"," // handled on GH side
//"\""NS"QMapNode\","
"\""NS"QObject\"," "\""NS"QObject\","
"\""NS"QObjectMethodList\"," // hack to get nested properties display "\""NS"QObjectMethodList\"," // hack to get nested properties display
"\""NS"QObjectPropertyList\"," "\""NS"QObjectPropertyList\","
@@ -2465,15 +2465,20 @@ void qDumpObjectData440(
"\""NS"QObjectSlot\"," "\""NS"QObjectSlot\","
"\""NS"QObjectSlotList\"," "\""NS"QObjectSlotList\","
#endif // PRIVATE_OBJECT_ALLOWED #endif // PRIVATE_OBJECT_ALLOWED
"\""NS"QSet\","
"\""NS"QString\"," "\""NS"QString\","
"\""NS"QStringList\"," "\""NS"QStringList\","
"\""NS"QTextCodec\"," "\""NS"QTextCodec\","
"\""NS"QVariant\"," "\""NS"QVariant\","
"\""NS"QVector\","
"\""NS"QWidget\"," "\""NS"QWidget\","
"\""NS"QDateTime\","
"\"string\"," "\"string\","
"\"wstring\"," "\"wstring\","
"\"std::basic_string\","
"\"std::list\","
"\"std::map\","
"\"std::string\"," "\"std::string\","
"\"std::vector\","
"\"std::wstring\"," "\"std::wstring\","
// << "\""NS"QRegion\"," // << "\""NS"QRegion\","
"]"; "]";
+8 -33
View File
@@ -2916,42 +2916,17 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
return false; return false;
if (m_dataDumperState != DataDumperAvailable) if (m_dataDumperState != DataDumperAvailable)
return false; return false;
// simple types
if (m_availableSimpleDumpers.contains(type)) if (m_availableSimpleDumpers.contains(type))
return true; return true;
// templates
QString tmplate; QString tmplate;
QString inner; QString inner;
if (extractTemplate(type, &tmplate, &inner)) { if (!extractTemplate(type, &tmplate, &inner))
if (type.startsWith(m_namespace)) { return false;
tmplate = tmplate.mid(m_namespace.size()); return m_availableSimpleDumpers.contains(tmplate);
if (tmplate == "QList")
return true;
if (tmplate == "QVector")
return true;
if (tmplate == "QHash")
return true;
if (tmplate == "QHashNode")
return true;
if (tmplate == "QMap")
return true;
if (tmplate == "QMapNode")
return true;
if (tmplate == "QSet")
return true;
}
if (tmplate == "std::list")
return true;
if (tmplate == "std::map")
return true;
if (tmplate == "std::vector" && inner != "bool")
return true;
if (tmplate == "std::basic_string") {
if (inner.startsWith("char@") || inner.startsWith("wchar_t@"))
return true;
}
}
return false;
} }
void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren) void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
@@ -2968,7 +2943,7 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
inners[i] = inners[i].simplified(); inners[i] = inners[i].simplified();
QString outertype = isTemplate ? tmplate : data.type; QString outertype = isTemplate ? tmplate : data.type;
// adjust the data extract
if (outertype == "QWidget") if (outertype == "QWidget")
outertype = "QObject"; outertype = "QObject";
@@ -3334,7 +3309,7 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
//qDebug() << "DATA DUMPER TRIAL:" << record.toString(); //qDebug() << "DATA DUMPER TRIAL:" << record.toString();
GdbMi output = record.data.findChild("customvaluecontents"); GdbMi output = record.data.findChild("customvaluecontents");
GdbMi contents(output.data()); GdbMi contents(output.data());
GdbMi simple = contents.findChild("simpledumpers"); GdbMi simple = contents.findChild("dumpers");
m_namespace = contents.findChild("namespace").data(); m_namespace = contents.findChild("namespace").data();
//qDebug() << "OUTPUT: " << output.toString(); //qDebug() << "OUTPUT: " << output.toString();
//qDebug() << "CONTENTS: " << contents.toString(); //qDebug() << "CONTENTS: " << contents.toString();