From 1b3e9db04608547b470f7498bbd43d23b8b4ccef Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Fri, 28 May 2010 15:47:50 +0200 Subject: [PATCH] debugger: implement "old" QSize and QSizeF dumpers, re-enable QImage/QPixmap --- share/qtcreator/gdbmacros/gdbmacros.cpp | 47 +++++++++++++++++++++++-- tests/manual/gdbdebugger/simple/app.cpp | 3 ++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index de8aa350521..3135dacadc4 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -1584,7 +1584,8 @@ static void qDumpQImage(QDumper &d) d.put("(").put(im.width()).put("x").put(im.height()).put(")"); d.endItem(); d.putItem("type", NS"QImage"); - d.putItem("numchild", "1"); + d.putItem("numchild", "0"); +#if 0 if (d.dumpChildren) { d.beginChildren(); d.beginHash(); @@ -1594,6 +1595,7 @@ static void qDumpQImage(QDumper &d) d.endHash(); d.endChildren(); } +#endif d.disarm(); } #endif @@ -2844,6 +2846,40 @@ static void qDumpQSharedPointer(QDumper &d) #endif // QT_VERSION >= 0x040500 #endif // QT_BOOTSTRAPPED +static void qDumpQSize(QDumper &d) +{ + const QSize s = *reinterpret_cast<const QSize *>(d.data); + d.beginItem("value"); + d.put("(").put(s.width()).put("x").put(s.height()).put(")"); + d.endItem(); + d.putItem("type", NS"QSize"); + d.putItem("numchild", "2"); + if (d.dumpChildren) { + d.beginChildren(); + d.putHash("w", s.width()); + d.putHash("h", s.height()); + d.endChildren(); + } + d.disarm(); +} + +static void qDumpQSizeF(QDumper &d) +{ + const QSizeF s = *reinterpret_cast<const QSizeF *>(d.data); + d.beginItem("value"); + d.put("(").put(s.width()).put("x").put(s.height()).put(")"); + d.endItem(); + d.putItem("type", NS"QSizeF"); + d.putItem("numchild", "2"); + if (d.dumpChildren) { + d.beginChildren(); + d.putHash("w", s.width()); + d.putHash("h", s.height()); + d.endChildren(); + } + d.disarm(); +} + static void qDumpQString(QDumper &d) { //qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid @@ -3572,6 +3608,10 @@ static void handleProtocolVersion2and3(QDumper &d) qDumpQSharedPointer(d); #endif #endif // QT_BOOTSTRAPPED + else if (isEqual(type, "QSize")) + qDumpQSize(d); + else if (isEqual(type, "QSizeF")) + qDumpQSizeF(d); break; case 's': if (isEqual(type, "wstring")) @@ -3794,7 +3834,7 @@ void *qDumpObjectData440( "\""NS"QFileInfo\"," "\""NS"QHash\"," "\""NS"QHashNode\"," - //"\""NS"QImage\"," + "\""NS"QImage\"," //"\""NS"QImageData\"," "\""NS"QLinkedList\"," "\""NS"QList\"," @@ -3817,6 +3857,8 @@ void *qDumpObjectData440( "\""NS"QRectF\"," //"\""NS"QRegion\"," "\""NS"QSet\"," + "\""NS"QSize\"," + "\""NS"QSizeF\"," "\""NS"QStack\"," "\""NS"QString\"," "\""NS"QStringList\"," @@ -3830,6 +3872,7 @@ void *qDumpObjectData440( "\""NS"QWeakPointer\"," #endif #if USE_QT_GUI + "\""NS"QPixmap\"," "\""NS"QWidget\"," #endif #ifdef Q_OS_WIN diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index 22df9249ea9..831fe39af32 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -715,6 +715,7 @@ public: void testQObject(int &argc, char *argv[]) { QApplication app(argc, argv); + QPixmap pm; #if 1 Names::Bar::TestObject test; @@ -1716,6 +1717,8 @@ void testQSettings() int main(int argc, char *argv[]) { + QSize size(100, 100); + QSizeF sizef(100, 100); testQSettings(); //testWCout0(); //testWCout(); -- GitLab