Debugger: Remove unneeded expression for dumping QVector.

...thus enabling dumping of it in CDB.
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Friedemann Kleint
2009-07-16 12:09:24 +02:00
parent d34bf41a37
commit 562b417036
3 changed files with 12 additions and 13 deletions

View File

@@ -2744,6 +2744,9 @@ static void qDumpQTextCodec(QDumper &d)
static void qDumpQVector(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); QVectorData *v = *reinterpret_cast<QVectorData *const*>(d.data);
// Try to provoke segfaults early to prevent the frontend // Try to provoke segfaults early to prevent the frontend
@@ -2756,8 +2759,7 @@ static void qDumpQVector(QDumper &d)
//qCheckAccess(&vec.back()); //qCheckAccess(&vec.back());
} }
unsigned innersize = d.extraInt[0]; const unsigned innersize = d.extraInt[0];
unsigned typeddatasize = d.extraInt[1];
int n = nn; int n = nn;
d.putItemCount("value", n); d.putItemCount("value", n);
@@ -3348,7 +3350,8 @@ void *watchPoint(int x, int y)
} }
#endif #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 // Offsets of a map node value which looks like
// "(size_t)&(('QMapNode<QString,QString >'*)0)->value")" in gdb syntax // "(size_t)&(('QMapNode<QString,QString >'*)0)->value")" in gdb syntax
@@ -3394,6 +3397,8 @@ template <class Key, class Value>
return d; return d;
} }
#endif // Q_CC_MSVC
extern "C" Q_DECL_EXPORT extern "C" Q_DECL_EXPORT
void *qDumpObjectData440( void *qDumpObjectData440(
int protocolVersion, int protocolVersion,
@@ -3515,6 +3520,7 @@ void *qDumpObjectData440(
.put(NS"QMapNode<"NS"QString,"NS"QVariant>=\"").put(sizeof(QMapNode<QString, QVariant>)) .put(NS"QMapNode<"NS"QString,"NS"QVariant>=\"").put(sizeof(QMapNode<QString, QVariant>))
.put("\"}"); .put("\"}");
// Write out common expression values for CDB // Write out common expression values for CDB
#ifdef Q_CC_MSVC
d.put(",expressions={"); d.put(",expressions={");
putQMapNodeOffsetExpression<int,int>("int", "int", d).put(','); putQMapNodeOffsetExpression<int,int>("int", "int", d).put(',');
putQMapNodeOffsetExpression<int,QString>("int", NS"QString", 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<int,std::wstring>("int", stdWideStringTypeUShortC, d).put(',');
putStdPairValueOffsetExpression<std::wstring,int>(stdWideStringTypeUShortC, "int", d); putStdPairValueOffsetExpression<std::wstring,int>(stdWideStringTypeUShortC, "int", d);
d.put('}'); d.put('}');
#endif // Q_CC_MSVC
d.disarm(); d.disarm();
} }

View File

@@ -140,7 +140,7 @@ static int dumpQIntList()
static int dumpQIntVector() static int dumpQIntVector()
{ {
QVector<int> test = QVector<int>() << 1 << 2; QVector<int> test = QVector<int>() << 42 << 43;
prepareInBuffer("QVector", "local.qintvector", "local.qintvector", "int"); prepareInBuffer("QVector", "local.qintvector", "local.qintvector", "int");
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0); qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0);
fputs(qDumpOutBuffer, stdout); fputs(qDumpOutBuffer, stdout);

View File

@@ -798,7 +798,6 @@ QtDumperHelper::ExpressionRequirement QtDumperHelper::expressionRequirements(Typ
switch (t) { switch (t) {
case QAbstractItemType: case QAbstractItemType:
case QVectorType:
return NeedsComplexExpression; return NeedsComplexExpression;
case QMapType: case QMapType:
case QMultiMapType: case QMultiMapType:
@@ -1353,14 +1352,6 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
case QAbstractItemType: case QAbstractItemType:
inner = data.addr.mid(1); inner = data.addr.mid(1);
break; 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 QObjectSlotType:
case QObjectSignalType: { case QObjectSignalType: {
// we need the number out of something like // 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); qWarning("Unknown type encountered in %s.\n", Q_FUNC_INFO);
break; break;
case SupportedType: case SupportedType:
case QVectorType:
case QObjectType: case QObjectType:
case QWidgetType: case QWidgetType:
break; break;