diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index b93bb69a4a3e1f3443d2963307ba3118d3e8d5ab..9a92062d243a48db26fae1493398310cd5b72719 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -2744,6 +2744,9 @@ static void qDumpQTextCodec(QDumper &d) static void qDumpQVector(QDumper &d) { + QVectorTypedData<int> *dummy = 0; + const unsigned typeddatasize = (char*)(&dummy->array) - (char*)dummy; + QVectorData *v = *reinterpret_cast<QVectorData *const*>(d.data); // Try to provoke segfaults early to prevent the frontend @@ -2756,8 +2759,7 @@ static void qDumpQVector(QDumper &d) //qCheckAccess(&vec.back()); } - unsigned innersize = d.extraInt[0]; - unsigned typeddatasize = d.extraInt[1]; + const unsigned innersize = d.extraInt[0]; int n = nn; d.putItemCount("value", n); @@ -3348,7 +3350,8 @@ void *watchPoint(int x, int y) } #endif -// Helper to write out common expression values for CDB: +// Helpers to write out common expression values for CDB +#ifdef Q_CC_MSVC // Offsets of a map node value which looks like // "(size_t)&(('QMapNode<QString,QString >'*)0)->value")" in gdb syntax @@ -3394,6 +3397,8 @@ template <class Key, class Value> return d; } +#endif // Q_CC_MSVC + extern "C" Q_DECL_EXPORT void *qDumpObjectData440( int protocolVersion, @@ -3515,6 +3520,7 @@ void *qDumpObjectData440( .put(NS"QMapNode<"NS"QString,"NS"QVariant>=\"").put(sizeof(QMapNode<QString, QVariant>)) .put("\"}"); // Write out common expression values for CDB +#ifdef Q_CC_MSVC d.put(",expressions={"); putQMapNodeOffsetExpression<int,int>("int", "int", d).put(','); putQMapNodeOffsetExpression<int,QString>("int", NS"QString", d).put(','); @@ -3534,6 +3540,7 @@ void *qDumpObjectData440( putStdPairValueOffsetExpression<int,std::wstring>("int", stdWideStringTypeUShortC, d).put(','); putStdPairValueOffsetExpression<std::wstring,int>(stdWideStringTypeUShortC, "int", d); d.put('}'); +#endif // Q_CC_MSVC d.disarm(); } diff --git a/share/qtcreator/gdbmacros/test/main.cpp b/share/qtcreator/gdbmacros/test/main.cpp index 8b24d55aca60fbfe7c081c8ea84f9f3e84a2d6b8..22f68e1a3c6044e9f2731a34a2776fb2128018df 100644 --- a/share/qtcreator/gdbmacros/test/main.cpp +++ b/share/qtcreator/gdbmacros/test/main.cpp @@ -140,7 +140,7 @@ static int dumpQIntList() static int dumpQIntVector() { - QVector<int> test = QVector<int>() << 1 << 2; + QVector<int> test = QVector<int>() << 42 << 43; prepareInBuffer("QVector", "local.qintvector", "local.qintvector", "int"); qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0); fputs(qDumpOutBuffer, stdout); diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index d6daad15514058301f36b854229619f7df71d303..490fd2a64a89a35c3bbd392eb140a54541570a44 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -798,7 +798,6 @@ QtDumperHelper::ExpressionRequirement QtDumperHelper::expressionRequirements(Typ switch (t) { case QAbstractItemType: - case QVectorType: return NeedsComplexExpression; case QMapType: case QMultiMapType: @@ -1353,14 +1352,6 @@ void QtDumperHelper::evaluationParameters(const WatchData &data, case QAbstractItemType: inner = data.addr.mid(1); break; - case QVectorType: - if (m_qtVersion >= 0x040600) - extraArgs[1] = QString("(char*)&((%1).p->array)-(char*)((%2).p)") - .arg(data.exp).arg(data.exp); - else - extraArgs[1] = QString("(char*)&((%1).d->array)-(char*)((%2).d)") - .arg(data.exp).arg(data.exp); - break; case QObjectSlotType: case QObjectSignalType: { // we need the number out of something like @@ -1453,6 +1444,7 @@ void QtDumperHelper::evaluationParameters(const WatchData &data, qWarning("Unknown type encountered in %s.\n", Q_FUNC_INFO); break; case SupportedType: + case QVectorType: case QObjectType: case QWidgetType: break;