diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index c763e425dbc508afd875fe44a6c54c3f18a57e2b..ba607ecb9877c06c252d41182df0afbfae796909 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -1992,39 +1992,21 @@ static void qDumpQObject(QDumper &d) // using 'addr' does not work in gdb as 'exp' is recreated as // (type *)addr, and here we have different 'types': // QObject vs QObjectPropertyList! -#ifdef Q_CC_MSVC d.putItem("addr", d.data); -#else - d.beginItem("exp"); - d.put("*(class "NSX"QObject"NSY"*)").put(d.data); - d.endItem(); -#endif d.putItem("type", NS"QObjectPropertyList"); d.putItemCount("value", mo->propertyCount()); d.putItem("numchild", mo->propertyCount()); d.endHash(); d.beginHash(); d.putItem("name", "signals"); -#ifdef Q_CC_MSVC d.putItem("addr", d.data); -#else - d.beginItem("exp"); - d.put("*(class "NSX"QObject"NSY"*)").put(d.data); - d.endItem(); -#endif d.putItem("type", NS"QObjectSignalList"); d.putItemCount("value", signalCount); d.putItem("numchild", signalCount); d.endHash(); d.beginHash(); d.putItem("name", "slots"); -#ifdef Q_CC_MSVC d.putItem("addr", d.data); -#else - d.beginItem("exp"); - d.put("*(class "NSX"QObject"NSY"*)").put(d.data); - d.endItem(); -#endif d.putItem("type", NS"QObjectSlotList"); d.putItemCount("value", slotCount); d.putItem("numchild", slotCount); @@ -2033,13 +2015,7 @@ static void qDumpQObject(QDumper &d) if (!objectChildren.empty()) { d.beginHash(); d.putItem("name", "children"); -#ifdef Q_CC_MSVC d.putItem("addr", d.data); -#else - d.beginItem("exp"); - d.put("*(class "NSX"QObject"NSY"*)").put(d.data); - d.endItem(); -#endif d.putItem("type", NS"QObjectChildList"); d.putItemCount("value", objectChildren.size()); d.putItem("numchild", objectChildren.size()); @@ -2052,7 +2028,7 @@ static void qDumpQObject(QDumper &d) #if 1 d.beginHash(); d.putItem("name", "className"); - d.putItem("value",ob->metaObject()->className()); + d.putItem("value", ob->metaObject()->className()); d.putItem("type", ""); d.putItem("numchild", "0"); d.endHash(); @@ -2131,13 +2107,16 @@ static void qDumpQVariantHelper(const QVariant *v, QString *value, break; case QVariant::Size: { const QSize size = v->toSize(); - *value = QString::fromLatin1("%1x%2").arg(size.width()).arg(size.height()); + *value = QString::fromLatin1("%1x%2") + .arg(size.width()).arg(size.height()); } *numchild = 0; break; case QVariant::Rect: { const QRect rect = v->toRect(); - *value = QString::fromLatin1("%1x%2+%3+%4").arg(rect.width()).arg(rect.height()).arg(rect.x()).arg(rect.y()); + *value = QString::fromLatin1("%1x%2+%3+%4") + .arg(rect.width()).arg(rect.height()) + .arg(rect.x()).arg(rect.y()); } *numchild = 0; break; @@ -2150,13 +2129,16 @@ static void qDumpQVariantHelper(const QVariant *v, QString *value, case QVariant::SizeF: { const QSizeF size = v->toSizeF(); - *value = QString::fromLatin1("%1x%2").arg(size.width()).arg(size.height()); + *value = QString::fromLatin1("%1x%2") + .arg(size.width()).arg(size.height()); } *numchild = 0; break; case QVariant::RectF: { const QRectF rect = v->toRectF(); - *value = QString::fromLatin1("%1x%2+%3+%4").arg(rect.width()).arg(rect.height()).arg(rect.x()).arg(rect.y()); + *value = QString::fromLatin1("%1x%2+%3+%4") + .arg(rect.width()).arg(rect.height()) + .arg(rect.x()).arg(rect.y()); } *numchild = 0; break; diff --git a/tests/auto/debugger/main.cpp b/tests/auto/debugger/main.cpp index 6396eb7621d4e5b9b930277eef3f9925c1de0567..ae0c6e65cb04a640385572b0451d9263bc44121c 100644 --- a/tests/auto/debugger/main.cpp +++ b/tests/auto/debugger/main.cpp @@ -18,12 +18,8 @@ # define STRINGIFY0(s) #s # define STRINGIFY1(s) STRINGIFY0(s) # define NS STRINGIFY1(QT_NAMESPACE) "::" -# define NSX "'" -# define NSY "'" #else # define NS "" -# define NSX "" -# define NSY "" #endif using namespace Debugger; @@ -135,7 +131,9 @@ private slots: void dumpQList_Int3(); void dumpQObject(); void dumpQString(); - void dumpQVariant(); + void dumpQVariant_invalid(); + void dumpQVariant_QString(); + void dumpQVariant_QStringList(); void dumpStdVector(); public slots: @@ -497,11 +495,11 @@ void tst_Debugger::dumpQObject() &parent, NS"QObject", false); testDumper("value='',valueencoded='2',type='$T',displayedtype='QObject'," "numchild='4',children=[" - "{name='properties',exp='*(class "NSX"$T"NSY"*)$A',type='$TPropertyList'," + "{name='properties',addr='$A',type='$TPropertyList'," "value='<1 items>',numchild='1'}," - "{name='signals',exp='*(class "NSX"$T"NSY"*)$A',type='$TSignalList'," + "{name='signals',addr='$A',type='$TSignalList'," "value='<2 items>',numchild='2'}," - "{name='slots',exp='*(class "NSX"$T"NSY"*)$A',type='$TSlotList'," + "{name='slots',addr='$A',type='$TSlotList'," "value='<2 items>',numchild='2'}," "{name='parent',value='0x0',type='$T *',numchild='0'}," "{name='className',value='QObject',type='',numchild='0'}]", @@ -510,9 +508,9 @@ void tst_Debugger::dumpQObject() #if 0 testDumper("numchild='2',value='<2 items>',type='QObjectSlotList'," "children=[{name='2',value='deleteLater()'," - "numchild='0',exp='*(class "NSX"QObject"NSY"*)$A',type='QObjectSlot'}," + "numchild='0',addr='$A',type='QObjectSlot'}," "{name='3',value='_q_reregisterTimers(void*)'," - "numchild='0',exp='*(class 'QObject'*)$A',type='QObjectSlot'}]", + "numchild='0',addr='$A',type='QObjectSlot'}]", &parent, NS"QObjectSlotList", true); #endif @@ -527,11 +525,11 @@ void tst_Debugger::dumpQObject() child.setObjectName("A Child"); QByteArray ba ="value='QQAgAEMAaABpAGwAZAA=',valueencoded='2',type='$T'," "displayedtype='QObject',numchild='4',children=[" - "{name='properties',exp='*(class "NSX"$T"NSY"*)$A',type='$TPropertyList'," + "{name='properties',addr='$A',type='$TPropertyList'," "value='<1 items>',numchild='1'}," - "{name='signals',exp='*(class "NSX"$T"NSY"*)$A',type='$TSignalList'," + "{name='signals',addr='$A',type='$TSignalList'," "value='<2 items>',numchild='2'}," - "{name='slots',exp='*(class "NSX"$T"NSY"*)$A',type='$TSlotList'," + "{name='slots',addr='$A',type='$TSlotList'," "value='<2 items>',numchild='2'}," "{name='parent',addr='" + str(&parent) + "'," "value='QQAgAFAAYQByAGUAbgB0AA==',valueencoded='2',type='$T'," @@ -558,17 +556,31 @@ void tst_Debugger::dumpQString() &s, NS"QString", false); } -void tst_Debugger::dumpQVariant() +void tst_Debugger::dumpQVariant_invalid() { QVariant v; testDumper("value='(invalid)',type='$T',numchild='0'", &v, NS"QVariant", false); - v = "abc"; +} + +void tst_Debugger::dumpQVariant_QString() +{ + QVariant v = "abc"; + testDumper("value='KFFTdHJpbmcpICJhYmMi',valueencoded='5',type='$T'," + "numchild='0'", + &v, NS"QVariant", true); +/* + FIXME: the QString version should have a child: testDumper("value='KFFTdHJpbmcpICJhYmMi',valueencoded='5',type='$T'," "numchild='1',children=[{name='value',value='IgBhAGIAYwAiAA=='," "valueencoded='4',type='QString',numchild='0'}]", &v, NS"QVariant", true); - v = QStringList() << "Hi"; +*/ +} + +void tst_Debugger::dumpQVariant_QStringList() +{ + QVariant v = QStringList() << "Hi"; return; // FIXME testDumper("value='(QStringList) ',type='$T'," "numchild='1',children=[{name='value',"