Commit 8a554029 authored by hjk's avatar hjk

debugger: work on autotests

parent afa9da2a
......@@ -25,14 +25,6 @@ bool checkUninitialized = false;
#include "gdb/gdbmi.h"
#include <sys/types.h>
#ifdef Q_OS_WIN
# include <windows.h>
#else
# include <unistd.h>
#endif
#undef NS
#ifdef QT_NAMESPACE
......@@ -102,38 +94,14 @@ private:
};
/////////////////////////////////////////////////////////////////////////
//
//
// Helper stuff
//
/////////////////////////////////////////////////////////////////////////
typedef QList<QByteArray> QByteArrayList;
#if 0
static QByteArray operator<<(QByteArray ba, const QByteArray &replacement)
{
int pos = ba.indexOf('%');
Q_ASSERT(pos != -1);
return ba.replace(pos, 1, replacement);
}
static QByteArray &operator<<=(QByteArray &ba, const QByteArray &replacement)
{
int pos = ba.indexOf('%');
Q_ASSERT(pos != -1);
return ba.replace(pos, 1, replacement);
}
template <typename T>
inline QByteArray N(T t) { return QByteArray::number(t); }
#endif
struct Int3 {
Int3() { i1 = 42; i2 = 43; i3 = 44; }
int i1, i2, i3;
......@@ -200,6 +168,8 @@ private slots:
void initTestCase();
void dump_array();
void dump_misc();
void dump_std_list();
void dump_std_vector();
void dump_Foo();
void dump_QByteArray();
void dump_QChar();
......@@ -214,6 +184,7 @@ private slots:
void dump_QList_Int3();
void dump_QPoint();
void dump_QRect();
void dump_QSharedPointer();
void dump_QSize();
void dump_QStack();
void dump_QString();
......@@ -250,9 +221,7 @@ public slots:
void dump_QObjectSlot();
void dump_QObjectSlotList();
void dump_QPixmap();
void dump_QSharedPointer();
void dump_QTextCodec();
void dumpStdVector();
#endif
private:
......@@ -690,6 +659,8 @@ void tst_Gdb::run(const QByteArray &label, const QByteArray &expected0,
int pos = actual.indexOf("^done");
if (pos != -1)
actual = actual.left(pos);
if (actual.endsWith("\n"))
actual.chop(1);
if (actual.endsWith("\\n"))
actual.chop(2);
QByteArray expected = "locals={iname='local',name='Locals',value=' ',type=' ',"
......@@ -2254,114 +2225,90 @@ void tst_Gdb::dump_QPixmap()
&p, NS"QPixmap", true);
}
#if QT_VERSION >= 0x040500
template<typename T>
void tst_Gdb::dump_QSharedPointerHelper(QSharedPointer<T> &ptr)
{
struct Cheater : public QSharedPointer<T>
{
static const typename QSharedPointer<T>::Data *getData(const QSharedPointer<T> &p)
{
return static_cast<const Cheater &>(p).d;
}
};
#endif // #if 0
QByteArray expected("value='");
QString val1 = ptr.isNull() ? "<null>" : valToString(*ptr.data());
QString val2 = isSimpleType<T>() ? val1 : "";
/*
const int *weakAddr;
const int *strongAddr;
int weakValue;
int strongValue;
if (!ptr.isNull()) {
weakAddr = reinterpret_cast<const int *>(&Cheater::getData(ptr)->weakref);
strongAddr = reinterpret_cast<const int *>(&Cheater::getData(ptr)->strongref);
weakValue = *weakAddr;
strongValue = *strongAddr;
} else {
weakAddr = strongAddr = 0;
weakValue = strongValue = 0;
}
expected.append(val2).append("',valuedisabled='true',numchild='1',children=[").
append("{name='data',addr='").append(ptrToBa(ptr.data())).
append("',type='").append(typeToString<T>()).append("',value='").append(val1).
append("'},{name='weakref',value='").append(N(weakValue)).
append("',type='int',addr='").append(ptrToBa(weakAddr)).append("',numchild='0'},").
append("{name='strongref',value='").append(N(strongValue)).
append("',type='int',addr='").append(ptrToBa(strongAddr)).append("',numchild='0'}]");
testDumper(expected, &ptr, NS"QSharedPointer", true, typeToString<T>());
*/
}
#endif
///////////////////////////// std::list<int> //////////////////////////////
void tst_Gdb::dump_QSharedPointer()
void dump_std_list()
{
#if QT_VERSION >= 0x040500
// Case 1: Simple type.
// Case 1.1: Null pointer.
QSharedPointer<int> simplePtr;
dump_QSharedPointerHelper(simplePtr);
// Case 1.2: Non-null pointer,
QSharedPointer<int> simplePtr2(new int(99));
dump_QSharedPointerHelper(simplePtr2);
// Case 1.3: Shared pointer.
QSharedPointer<int> simplePtr3 = simplePtr2;
dump_QSharedPointerHelper(simplePtr2);
// Case 1.4: Weak pointer.
QWeakPointer<int> simplePtr4(simplePtr2);
dump_QSharedPointerHelper(simplePtr2);
/* A */ std::list<int> list;
/* B */ list.push_back(45);
/* C */ list.push_back(46);
/* D */ list.push_back(47);
/* E */ (void) 0;
}
// Case 2: Composite type.
// Case 1.1: Null pointer.
QSharedPointer<QString> compositePtr;
// TODO: This case is not handled in gdbmacros.cpp (segfault!)
//dump_QSharedPointerHelper(compoistePtr);
void tst_Gdb::dump_std_list()
{
prepare("dump_std_list");
if (checkUninitialized)
run("A","{iname='local.list',addr='-',name='list',"
"numchild='0'}");
next();
run("B", "{iname='local.list',addr='-',name='list',"
"type='std::list<int, std::allocator<int> >',"
"value='<0 items>',numchild='0',children=[]}",
"local.list");
next();
run("C", "{iname='local.list',addr='-',name='list',"
"type='std::list<int, std::allocator<int> >',"
"value='<1 items>',numchild='1',"
"childtype='int',childnumchild='0',children=[{value='45'}]}",
"local.list");
next();
run("D", "{iname='local.list',addr='-',name='list',"
"type='std::list<int, std::allocator<int> >',"
"value='<2 items>',numchild='2',"
"childtype='int',childnumchild='0',children=["
"{value='45'},{value='46'}]}",
"local.list");
next();
run("E", "{iname='local.list',addr='-',name='list',"
"type='std::list<int, std::allocator<int> >',"
"value='<3 items>',numchild='3',"
"childtype='int',childnumchild='0',children=["
"{value='45'},{value='46'},{value='47'}]}",
"local.list");
}
// Case 1.2: Non-null pointer,
QSharedPointer<QString> compositePtr2(new QString("Test"));
dump_QSharedPointerHelper(compositePtr2);
// Case 1.3: Shared pointer.
QSharedPointer<QString> compositePtr3 = compositePtr2;
dump_QSharedPointerHelper(compositePtr2);
///////////////////////////// std::vector<int> //////////////////////////////
// Case 1.4: Weak pointer.
QWeakPointer<QString> compositePtr4(compositePtr2);
dump_QSharedPointerHelper(compositePtr2);
#endif
void dump_std_vector()
{
/* A */ std::vector<std::list<int> *> vector;
std::list<int> list;
/* B */ list.push_back(45);
/* C */ vector.push_back(new std::list<int>(list));
/* D */ vector.push_back(0);
/* E */ (void) 0;
}
void tst_Gdb::dump_StdVector()
{
std::vector<std::list<int> *> vector;
QByteArray inner = "std::list<int> *";
QByteArray innerp = "std::list<int>";
testDumper("value='<0 items>',valuedisabled='true',numchild='0'",
&vector, "std::vector", false, inner, "", sizeof(std::list<int> *));
std::list<int> list;
vector.push_back(new std::list<int>(list));
testDumper("value='<1 items>',valuedisabled='true',numchild='1',"
"childtype='" + inner + "',childnumchild='1',"
"children=[{addr='" + str(deref(&vector[0])) + "',"
"saddr='" + str(deref(&vector[0])) + "',type='" + innerp + "'}]",
&vector, "std::vector", true, inner, "", sizeof(std::list<int> *));
vector.push_back(0);
list.push_back(45);
testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
"childtype='" + inner + "',childnumchild='1',"
"children=[{addr='" + str(deref(&vector[0])) + "',"
"saddr='" + str(deref(&vector[0])) + "',type='" + innerp + "'},"
"{addr='" + str(&vector[1]) + "',"
"type='" + innerp + "',value='<null>',numchild='0'}]",
&vector, "std::vector", true, inner, "", sizeof(std::list<int> *));
vector.push_back(new std::list<int>(list));
vector.push_back(0);
void tst_Gdb::dump_std_vector()
{
#define LIST "std::list<int, std::allocator<int> >"
#define VECTOR "std::vector<"LIST"*, std::allocator<"LIST"*> >"
prepare("dump_std_vector");
if (checkUninitialized)
run("A","{iname='local.vector',addr='-',name='vector',"
"numchild='0'}");
next(2);
run("B","{iname='local.vector',addr='-',name='vector',type='"VECTOR"',"
"value='<0 items>',numchild='0'},"
"{iname='local.list',addr='-',name='list',type='"LIST"',"
"value='<0 items>',numchild='0'}");
next(3);
run("E","{iname='local.vector',addr='-',name='vector',type='"VECTOR"',"
"value='<2 items>',numchild='2',childtype='"LIST" *',"
"childnumchild='1',children=[{type='"LIST"',value='<2 items>',"
"numchild='2'},{value='<null>',numchild='0'}]},"
"{iname='local.list',addr='-',name='list',type='"LIST"',"
"value='<0 items>',numchild='0'}",
"local.vector,local.vector.0");
}
#if 0
void tst_Gdb::dump_QTextCodecHelper(QTextCodec *codec)
{
const QByteArray name = codec->name().toBase64();
......@@ -2381,392 +2328,17 @@ void tst_Gdb::dump_QTextCodec()
#endif // #if 0
///////////////////////////// QVariant /////////////////////////////////
///////////////////////////// QHash<int, int> //////////////////////////////
void dump_QVariant()
void dump_QHash_int_int()
{
/*<not in scope>*/ QVariant v;
/* <invalid> */ v = QBitArray();
/* QBitArray */ v = 0; // QBitmap();
/* QBitMap */ v = bool(true);
/* bool */ v = 0; // QBrush();
/* QBrush */ v = QByteArray("abc");
/* QByteArray */ v = QChar(QLatin1Char('x'));
/* QChar */ v = 0; // QColor();
/* QColor */ v = 0; // QCursor();
/* QCursor */ v = QDate();
/* QDate */ v = QDateTime();
/* QDateTime */ v = double(46);
/* double */ v = 0; // QFont();
/* QFont */ v = QVariantHash();
/* QVariantHash */ v = 0; // QIcon();
/* QIcon */ v = 0; // QImage();
/* QImage */ v = int(42);
/* int */ v = 0; // QKeySequence();
/* QKeySequence */ v = QLine();
/* QLine */ v = QLineF();
/* QLineF */ v = QVariantList();
/* QVariantList */ v = QLocale();
/* QLocale */ v = qlonglong(44);
/* qlonglong */ v = QVariantMap();
/* QVariantMap */ v = 0; // QTransform();
/* QTransform */ v = 0; // QMatrix4x4();
/* QMatrix4x4 */ v = 0; // QPalette();
/* QPalette */ v = 0; // QPen();
/* QPen */ v = 0; // QPixmap();
/* QPixmap */ v = QPoint(45, 46);
/* QPoint */ v = 0; // QPointArray();
/* QPointArray */ v = QPointF(41, 42);
/* QPointF */ v = 0; // QPolygon();
/* QPolygon */ v = 0; // QQuaternion();
/* QQuaternion */ v = QRect();
/* QRect */ v = QRectF();
/* QRectF */ v = QRegExp("abc");
/* QRegExp */ v = 0; // QRegion();
/* QRegion */ v = QSize(0, 0);
/* QSize */ v = QSizeF(0, 0);
/* QSizeF */ v = 0; // QSizePolicy();
/* QSizePolicy */ v = QString("abc");
/* QString */ v = QStringList() << "abc";
/* QStringList */ v = 0; // QTextFormat();
/* QTextFormat */ v = 0; // QTextLength();
/* QTextLength */ v = QTime();
/* QTime */ v = uint(43);
/* uint */ v = qulonglong(45);
/* qulonglong */ v = QUrl("http://foo");
/* QUrl */ v = 0; // QVector2D();
/* QVector2D */ v = 0; // QVector3D();
/* QVector3D */ v = 0; // QVector4D();
/* QVector4D */ (void) 0;
/* A */ QHash<int, int> h;
/* B */ h[43] = 44;
/* C */ h[45] = 46;
/* D */ (void) 0;
}
void tst_Gdb::dump_QVariant()
{
#define PRE "iname='local.v',addr='-',name='v',type='"NS"QVariant',"
prepare("dump_QVariant");
if (checkUninitialized) /*<not in scope>*/
run("A","{"PRE"'value=<not in scope>',numchild='0'}");
next();
run("<invalid>", "{"PRE"value='<invalid>',numchild='0'}");
next();
run("QBitArray", "{"PRE"value='("NS"QBitArray)',numchild='1',children=["
"{name='data',type='"NS"QBitArray',value='{...}',numchild='1'}]}",
"local.v");
next();
//run("QBitMap", "{"PRE"value="NS"QBitMap'',numchild='1',children=["
// "]}", "local.v");
next();
run("bool", "{"PRE"value='true',numchild='0'}", "local.v");
next();
//run("QBrush", "{"PRE"value='"NS"QBrush',numchild='1',children=["
// "]}", "local.v");
next();
run("QByteArray", "{"PRE"value='("NS"QByteArray)',numchild='1',"
"children=[{name='data',type='"NS"QByteArray',valueencoded='6',"
"value='616263',numchild='3'}]}", "local.v");
next();
run("QChar", "{"PRE"value='("NS"QChar)',numchild='1',"
"children=[{name='data',type='"NS"QChar',value=''x', ucs=120',numchild='0'}]}", "local.v");
next();
//run("QColor", "{"PRE"value='("NS"QColor)',numchild='1',children=["
// "]}", "local.v");
next();
//run("QCursor", "{"PRE"value='',numchild='1',children=["
// "]}", "local.v");
next();
run("QDate", "{"PRE"value='("NS"QDate)',numchild='1',children=["
"{name='data',type='"NS"QDate',value='{...}',numchild='1'}]}", "local.v");
next();
run("QDateTime", "{"PRE"value='("NS"QDateTime)',numchild='1',children=["
"{name='data',type='"NS"QDateTime',value='{...}',numchild='1'}]}", "local.v");
next();
run("double", "{"PRE"value='46',numchild='0'}", "local.v");
next();
//run("QFont", "{"PRE"value='(NS"QFont")',numchild='1',children=["
// "{name='data',type='"NS"QFont',value='{...}',numchild='1'}]}", "local.v");
next();
run("QVariantHash", "{"PRE"value='("NS"QVariantHash)',numchild='1',children=["
"{name='data',type='"NS"QHash<"NS"QString, "NS"QVariant>',"
"value='<0 items>',numchild='0'}]}", "local.v");
next();
//run("QIcon", "{"PRE"value='("NS"QIcon)',numchild='1',children=["
// "{name='data',type='"NS"QIcon',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QImage", "{"PRE"value='("NS"QImage)',numchild='1',children=["
// "{name='data',type='"NS"QImage',value='{...}',numchild='1'}]}", "local.v");
next();
run("int", "{"PRE"value='42',numchild='0'}", "local.v");
next();
//run("QKeySequence", "{"PRE"value='("NS"QKeySequence)',numchild='1'",
// "local.v");
next();
run("QLine", "{"PRE"value='("NS"QLine)',numchild='1',children=["
"{name='data',type='"NS"QLine',value='{...}',numchild='2'}]}", "local.v");
next();
run("QLineF", "{"PRE"value='("NS"QLineF)',numchild='1',children=["
"{name='data',type='"NS"QLineF',value='{...}',numchild='2'}]}", "local.v");
next();
run("QVariantList", "{"PRE"value='("NS"QVariantList)',numchild='1',children=["
"{name='data',type='"NS"QList<"NS"QVariant>',"
"value='<0 items>',numchild='0'}]}", "local.v");
next();
run("QLocale", "{"PRE"value='("NS"QLocale)',numchild='1',children=["
"{name='data',type='"NS"QLocale',value='{...}',numchild='2'}]}", "local.v");
next();
run("qlonglong", "{"PRE"value='44',numchild='0'}", "local.v");
next();
run("QVariantMap", "{"PRE"value='("NS"QVariantMap)',numchild='1',children=["
"{name='data',type='"NS"QMap<"NS"QString, "NS"QVariant>',"
"value='{...}',numchild='1'}]}", "local.v");
next();
//run("QTransform", "{"PRE"value='("NS"QTransform)',numchild='1',children=["
// "{name='data',type='"NS"QTransform',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QMatrix4x4", "{"PRE"value='("NS"QMatrix4x4)',numchild='1',children=["
// "{name='data',type='"NS"QMatrix4x4',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QPalette", "{"PRE"value='("NS"QPalette)',numchild='1',children=["
// "{name='data',type='"NS"QPalette',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QPen", "{"PRE"value='("NS"QPen)',numchild='1',children=["
// "{name='data',type='"NS"QPen',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QPixmap", "{"PRE"value='("NS"QPixmap)',numchild='1',children=["
// "{name='data',type='"NS"QPixmap',value='{...}',numchild='1'}]}", "local.v");
next();
run("QPoint", "{"PRE"value='("NS"QPoint)',numchild='1',children=["
"{name='data',type='"NS"QPoint',value='(45, 46)',numchild='2'}]}",
"local.v");
next();
//run("QPointArray", "{"PRE"value='("NS"QPointArray)',numchild='1',children=["
// "{name='data',type='"NS"QPointArray',value='{...}',numchild='1'}]}", "local.v");
next();
// FIXME
// run("QPointF", "{"PRE"value='("NS"QPointF)',numchild='1',children=["
// "{name='data',type='"NS"QPointF',value='(41, 42)',numchild='2'}]}",
// "local.v");
next();
//run("QPolygon", "{"PRE"value='("NS"QPolygon)',numchild='1',children=["
// "{name='data',type='"NS"QPolygon',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QQuaternion", "{"PRE"value='("NS"QQuaternion)',numchild='1',children=["
// "{name='data',type='"NS"QQuaternion',value='{...}',numchild='1'}]}", "local.v");
next();
run("QRect", "{"PRE"value='("NS"QRect)',numchild='1',children=["
"{name='data',type='"NS"QRect',value='{...}',numchild='4'}]}", "local.v");
next();
// FIXME:
// run("QRectF", "{"PRE"value='("NS"QRectF)',numchild='1',children=["
// "{name='data',type='"NS"QRectF',value='{...}',numchild='4'}]}", "local.v");
next();
run("QRegExp", "{"PRE"value='("NS"QRegExp)',numchild='1',children=["
"{name='data',type='"NS"QRegExp',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QRegion", "{"PRE"value='("NS"QRegion)',numchild='1',children=["
// "{name='data',type='"NS"QRegion',value='{...}',numchild='1'}]}", "local.v");
next();
run("QSize", "{"PRE"value='("NS"QSize)',numchild='1',children=["
"{name='data',type='"NS"QSize',value='(0, 0)',numchild='2'}]}", "local.v");
next();
// FIXME:
// run("QSizeF", "{"PRE"value='("NS"QSizeF)',numchild='1',children=["
// "{name='data',type='"NS"QSizeF',value='(0, 0)',numchild='2'}]}", "local.v");
next();
//run("QSizePolicy", "{"PRE"value='("NS"QSizePolicy)',numchild='1',children=["
// "{name='data',type='"NS"QSizePolicy',value='{...}',numchild='1'}]}", "local.v");
next();
run("QString", "{"PRE"value='("NS"QString)',numchild='1',children=["
"{name='data',type='"NS"QString',valueencoded='7',value='610062006300',numchild='0'}]}",
"local.v");
next();
run("QStringList", "{"PRE"value='("NS"QStringList)',numchild='1',children=["
"{name='data',type='"NS"QStringList',value='<1 items>',numchild='1'}]}", "local.v");
next();
//run("QTextFormat", "{"PRE"value='("NS"QTextFormat)',numchild='1',children=["
// "{name='data',type='"NS"QTextFormat',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QTextLength", "{"PRE"value='("NS"QTextLength)',numchild='1',children=["
// "{name='data',type='"NS"QTextLength',value='{...}',numchild='1'}]}", "local.v");
next();
run("QTime", "{"PRE"value='("NS"QTime)',numchild='1',children=["
"{name='data',type='"NS"QTime',value='{...}',numchild='1'}]}", "local.v");
next();
run("uint", "{"PRE"value='43',numchild='0'}", "local.v");
next();
run("qulonglong", "{"PRE"value='45',numchild='0'}", "local.v");
next();
run("QUrl", "{"PRE"value='("NS"QUrl)',numchild='1',children=["
"{name='data',type='"NS"QUrl',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QVector2D", "{"PRE"value='("NS"QVector2D)',numchild='1',children=["
// "{name='data',type='"NS"QVector2D',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QVector3D", "{"PRE"value='("NS"QVector3D)',numchild='1',children=["
// "{name='data',type='"NS"QVector3D',value='{...}',numchild='1'}]}", "local.v");
next();
//run("QVector4D", "{"PRE"value='("NS"QVector4D)',numchild='1',children=["
// "{name='data',type='"NS"QVector4D',value='{...}',numchild='1'}]}", "local.v");
}
///////////////////////////// QWeakPointer /////////////////////////////////
#if QT_VERSION >= 0x040500
void dump_QWeakPointer_11()
{
// Case 1: Simple type.
// Case 1.1: Null pointer.
/* A */ QSharedPointer<int> sp;
/* */ QWeakPointer<int> wp = sp.toWeakRef();
/* B */ (void) 0;
}
void tst_Gdb::dump_QWeakPointer_11()
{
// Case 1.1: Null pointer.
prepare("dump_QWeakPointer_11");
if (checkUninitialized)
run("A","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='<not in scope>',numchild='0'}");
next();
next();
run("B","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='<null>',numchild='0'},"
"{iname='local.wp',addr='-',name='wp',"
"type='"NS"QWeakPointer<int>',value='<null>',numchild='0'}");
}
void dump_QWeakPointer_12()
{
// Case 1.2: Weak pointer is unique.
/* A */ QSharedPointer<int> sp(new int(99));
/* */ QWeakPointer<int> wp = sp.toWeakRef();
/* B */ (void) 0;
}
void tst_Gdb::dump_QWeakPointer_12()
{
// Case 1.2: Weak pointer is unique.
prepare("dump_QWeakPointer_12");
if (checkUninitialized)
run("A","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='<not in scope>',numchild='0'}");
next();
next();
run("B","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='',numchild='3'},"
"{iname='local.wp',addr='-',name='wp',"
"type='"NS"QWeakPointer<int>',value='',numchild='3'}");
run("B","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='',numchild='3',children=["
"{name='data',type='int',value='99',numchild='0'},"
"{name='weakref',value='2',type='int',numchild='0'},"
"{name='strongref',value='2',type='int',numchild='0'}]},"
"{iname='local.wp',addr='-',name='wp',"
"type='"NS"QWeakPointer<int>',value='',numchild='3',children=["
"{name='data',type='int',value='99',numchild='0'},"
"{name='weakref',value='2',type='int',numchild='0'},"
"{name='strongref',value='2',type='int',numchild='0'}]}",
"local.sp,local.wp");
}
void dump_QWeakPointer_13()
{
// Case 1.3: There are other weak pointers.
/* A */ QSharedPointer<int> sp(new int(99));
/* */ QWeakPointer<int> wp = sp.toWeakRef();
/* */ QWeakPointer<int> wp2 = sp.toWeakRef();
/* B */ (void) 0;
}
void tst_Gdb::dump_QWeakPointer_13()
{
// Case 1.3: There are other weak pointers.
prepare("dump_QWeakPointer_13");
if (checkUninitialized)
run("A","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='<not in scope>',numchild='0'}");
next();
next();
next();
run("B","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='',numchild='3'},"
"{iname='local.wp',addr='-',name='wp',"
"type='"NS"QWeakPointer<int>',value='',numchild='3'},"
"{iname='local.wp2',addr='-',name='wp2',"
"type='"NS"QWeakPointer<int>',value='',numchild='3'}");
run("B","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<int>',value='',numchild='3',children=["
"{name='data',type='int',value='99',numchild='0'},"
"{name='weakref',value='3',type='int',numchild='0'},"
"{name='strongref',value='3',type='int',numchild='0'}]},"
"{iname='local.wp',addr='-',name='wp',"
"type='"NS"QWeakPointer<int>',value='',numchild='3',children=["
"{name='data',type='int',value='99',numchild='0'},"
"{name='weakref',value='3',type='int',numchild='0'},"
"{name='strongref',value='3',type='int',numchild='0'}]},"
"{iname='local.wp2',addr='-',name='wp2',"
"type='"NS"QWeakPointer<int>',value='',numchild='3'}",
"local.sp,local.wp");
}
void dump_QWeakPointer_2()
{
// Case 2: Composite type.
/* A */ QSharedPointer<QString> sp(new QString("Test"));
/* */ QWeakPointer<QString> wp = sp.toWeakRef();
/* B */ (void) 0;
}
void tst_Gdb::dump_QWeakPointer_2()
{
// Case 2: Composite type.
prepare("dump_QWeakPointer_2");
if (checkUninitialized)
run("A","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<"NS"QString>',value='<not in scope>',numchild='0'}");
next();
next();
run("B","{iname='local.sp',addr='-',name='sp',"
"type='"NS"QSharedPointer<"NS"QString>',value='',numchild='3',children=["
"{n