From 3bd633ef048f13987fbc204d0b790587e0060d5b Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Thu, 18 Dec 2008 10:11:10 +0100 Subject: [PATCH] move some of the code for handling template types from creator proper to the "user space" (gdbmacros.cpp) --- bin/gdbmacros/gdbmacros.cpp | 29 ++++++++++++--------- src/plugins/debugger/gdbengine.cpp | 41 ++++++------------------------ 2 files changed, 25 insertions(+), 45 deletions(-) diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp index e99c4dc8a1f..0802d54a70a 100644 --- a/bin/gdbmacros/gdbmacros.cpp +++ b/bin/gdbmacros/gdbmacros.cpp @@ -2439,23 +2439,23 @@ void qDumpObjectData440( d.protocolVersion = protocolVersion; d.token = token; - //qDebug() << "SOCKET: after connect: state: " << qDumperSocket.state(); - // simpledumpers is a list of all available dumpers that are - // _not_ templates. templates currently require special - // hardcoded handling in the debugger plugin. - // don't mention them here in this list - d << "simpledumpers=[" + // This is a list of all available dumpers. Note that some templates + // currently require special hardcoded handling in the debugger plugin. + // They are mentioned here nevertheless. For types that not listed + // here, dumpers won't be used. + d << "dumpers=[" "\""NS"QByteArray\"," + "\""NS"QDateTime\"," "\""NS"QDir\"," - "\""NS"QImage\"," "\""NS"QFile\"," "\""NS"QFileInfo\"," + "\""NS"QHash\"," + "\""NS"QHashNode\"," + "\""NS"QImage\"," "\""NS"QLocale\"," + "\""NS"QMap\"," + "\""NS"QMapNode\"," "\""NS"QModelIndex\"," - //"\""NS"QHash\"," // handled on GH side - //"\""NS"QHashNode\"," - //"\""NS"QMap\"," // handled on GH side - //"\""NS"QMapNode\"," "\""NS"QObject\"," "\""NS"QObjectMethodList\"," // hack to get nested properties display "\""NS"QObjectPropertyList\"," @@ -2465,15 +2465,20 @@ void qDumpObjectData440( "\""NS"QObjectSlot\"," "\""NS"QObjectSlotList\"," #endif // PRIVATE_OBJECT_ALLOWED + "\""NS"QSet\"," "\""NS"QString\"," "\""NS"QStringList\"," "\""NS"QTextCodec\"," "\""NS"QVariant\"," + "\""NS"QVector\"," "\""NS"QWidget\"," - "\""NS"QDateTime\"," "\"string\"," "\"wstring\"," + "\"std::basic_string\"," + "\"std::list\"," + "\"std::map\"," "\"std::string\"," + "\"std::vector\"," "\"std::wstring\"," // << "\""NS"QRegion\"," "]"; diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index e2bbfb3766e..957a223db47 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -2916,42 +2916,17 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const return false; if (m_dataDumperState != DataDumperAvailable) return false; + + // simple types if (m_availableSimpleDumpers.contains(type)) return true; + // templates QString tmplate; QString inner; - if (extractTemplate(type, &tmplate, &inner)) { - if (type.startsWith(m_namespace)) { - tmplate = tmplate.mid(m_namespace.size()); - 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; + if (!extractTemplate(type, &tmplate, &inner)) + return false; + return m_availableSimpleDumpers.contains(tmplate); } 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(); QString outertype = isTemplate ? tmplate : data.type; - + // adjust the data extract if (outertype == "QWidget") outertype = "QObject"; @@ -3334,7 +3309,7 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record) //qDebug() << "DATA DUMPER TRIAL:" << record.toString(); GdbMi output = record.data.findChild("customvaluecontents"); GdbMi contents(output.data()); - GdbMi simple = contents.findChild("simpledumpers"); + GdbMi simple = contents.findChild("dumpers"); m_namespace = contents.findChild("namespace").data(); //qDebug() << "OUTPUT: " << output.toString(); //qDebug() << "CONTENTS: " << contents.toString(); -- GitLab