Commit 462a2046 authored by hjk's avatar hjk
Browse files

debugger: add a dumper for QSharedPointer

parent 092d8ca9
......@@ -47,8 +47,11 @@
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QString>
#include <QtCore/QSharedPointer>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QTextCodec>
#include <QtCore/QVector>
#include <QtCore/QWeakPointer>
int qtGhVersion = QT_VERSION;
......@@ -1931,6 +1934,30 @@ static void qDumpQSet(QDumper &d)
d.disarm();
}
static void qDumpQSharedPointer(QDumper &d)
{
const QSharedPointer<int> &ptr =
*reinterpret_cast<const QSharedPointer<int> *>(d.data);
if (isSimpleType(d.innertype))
qDumpInnerValueHelper(d, d.innertype, ptr.data());
else
P(d, "value", "");
P(d, "valuedisabled", "true");
P(d, "numchild", 1);
if (d.dumpChildren) {
d << ",children=[";
d.beginHash();
P(d, "name", "data");
qDumpInnerValue(d, d.innertype, ptr.data());
d.endHash();
I(d, "strongref", 44);
I(d, "weakref", 45);
d << "]";
}
d.disarm();
}
static void qDumpQString(QDumper &d)
{
const QString &str = *reinterpret_cast<const QString *>(d.data);
......@@ -2480,6 +2507,8 @@ static void handleProtocolVersion2and3(QDumper & d)
case 'S':
if (isEqual(type, "QSet"))
qDumpQSet(d);
else if (isEqual(type, "QSharedPointer"))
qDumpQSharedPointer(d);
else if (isEqual(type, "QString"))
qDumpQString(d);
else if (isEqual(type, "QStringList"))
......@@ -2578,6 +2607,7 @@ void *qDumpObjectData440(
#endif // PRIVATE_OBJECT_ALLOWED
// << "\""NS"QRegion\","
"\""NS"QSet\","
"\""NS"QSharedPointer\","
"\""NS"QString\","
"\""NS"QStringList\","
"\""NS"QTextCodec\","
......
......@@ -538,8 +538,20 @@ public:
void testQSharedPointer()
{
Employee e1(1, "Herbert");
Employee e2 = e1;
//Employee e1(1, "Herbert");
//Employee e2 = e1;
QSharedPointer<int> iptr(new int(43));
QSharedPointer<int> iptr2 = iptr;
QSharedPointer<int> iptr3 = iptr;
QSharedPointer<QString> ptr(new QString("hallo"));
QSharedPointer<QString> ptr2 = ptr;
QSharedPointer<QString> ptr3 = ptr;
//QWeakPointer<QString> wptr(ptr);
//QWeakPointer<QString> wptr2 = wptr;
//QWeakPointer<QString> wptr3 = wptr;
}
void stringRefTest(const QString &refstring)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment