summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-01-08 11:50:20 +0100
committerhjk <qtc-committer@nokia.com>2009-01-08 11:50:20 +0100
commitc9b2dfc363cbd56255290c12106dd35e2846d17e (patch)
tree6adda2fa2a1a3e9bf323be148a84f9641f241d8e /bin
parent2d8af0709dd98925ab1a5886abfde8073d82b8c4 (diff)
downloadqt-creator-c9b2dfc363cbd56255290c12106dd35e2846d17e.tar.gz
implement QLinkedList dumper
Diffstat (limited to 'bin')
-rw-r--r--bin/gdbmacros/gdbmacros.cpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp
index b88f077232..2af0e4b230 100644
--- a/bin/gdbmacros/gdbmacros.cpp
+++ b/bin/gdbmacros/gdbmacros.cpp
@@ -42,6 +42,7 @@
#include <QFile>
#include <QFileInfo>
#include <QHash>
+#include <QLinkedList>
#include <QLocale>
#include <QMap>
#include <QMetaObject>
@@ -1265,6 +1266,48 @@ static void qDumpQList(QDumper &d)
d.disarm();
}
+static void qDumpQLinkedList(QDumper &d)
+{
+ // This uses the knowledge that QLinkedList<T> has only a single member
+ // of type union { QLinkedListData *d; QLinkedListNode<T> *e; };
+ const QLinkedListData *ldata =
+ reinterpret_cast<const QLinkedListData*>(deref(d.data));
+ int nn = ldata->size;
+ if (nn < 0)
+ qCheck(false);
+
+ int n = nn;
+ P(d, "value", "<" << n << " items>");
+ P(d, "valuedisabled", "true");
+ P(d, "numchild", n);
+ P(d, "childtype", d.innertype);
+ if (d.dumpChildren) {
+ unsigned innerSize = d.extraInt[0];
+ bool innerTypeIsPointer = isPointerType(d.innertype);
+ QByteArray strippedInnerType = stripPointerType(d.innertype);
+ const char *stripped =
+ isPointerType(d.innertype) ? strippedInnerType.data() : 0;
+
+ P(d, "childtype", d.innertype);
+ if (n > 1000)
+ n = 1000;
+ d << ",children=[";
+ const void *p = deref(ldata);
+ for (int i = 0; i != n; ++i) {
+ d.beginHash();
+ P(d, "name", "[" << i << "]");
+ const void *addr = addOffset(p, 2 * sizeof(void*));
+ qDumpInnerValueOrPointer(d, d.innertype, stripped, addr);
+ p = deref(p);
+ d.endHash();
+ }
+ if (n < nn)
+ d.putEllipsis();
+ d << "]";
+ }
+ d.disarm();
+}
+
static void qDumpQLocale(QDumper &d)
{
const QLocale &locale = *reinterpret_cast<const QLocale *>(d.data);
@@ -2356,6 +2399,8 @@ static void handleProtocolVersion2and3(QDumper & d)
case 'L':
if (isEqual(type, "QList"))
qDumpQList(d);
+ else if (isEqual(type, "QLinkedList"))
+ qDumpQLinkedList(d);
else if (isEqual(type, "QLocale"))
qDumpQLocale(d);
break;
@@ -2367,7 +2412,7 @@ static void handleProtocolVersion2and3(QDumper & d)
else if (isEqual(type, "QModelIndex"))
qDumpQModelIndex(d);
else if (isEqual(type, "QMultiMap"))
- qDumpQMap(d);
+ qDumpQMultiMap(d);
break;
case 'O':
if (isEqual(type, "QObject"))
@@ -2465,6 +2510,7 @@ void qDumpObjectData440(
"\""NS"QHash\","
"\""NS"QHashNode\","
"\""NS"QImage\","
+ "\""NS"QLinkedList\","
"\""NS"QList\","
"\""NS"QLocale\","
"\""NS"QMap\","