Commit 82818cb9 authored by hjk's avatar hjk

Debugger: Improve QAtomicPointer dumper

More compact display and arbitrary inner types.

Change-Id: I68bc1f5cc88f51e993e6e8a91556d9d745a2574a
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent ab165490
......@@ -38,13 +38,9 @@ def qdump__QBasicAtomicInt(d, value):
def qdump__QAtomicPointer(d, value):
d.putType(value.type)
p = value.extractPointer()
d.putValue('@0x%x' % p)
d.putNumChild(1 if p else 0)
if d.isExpanded():
with Children(d):
d.putSubItem('[pointee]', value.dereference())
d.putItem(value.cast(value.type[0].pointer()))
d.putBetterType(value.type)
def qform__QByteArray():
return [Latin1StringFormat, SeparateLatin1StringFormat,
......
......@@ -2935,6 +2935,31 @@ void tst_Dumpers::dumper_data()
" QSharedDataPointer<EmployeeData> d;\n"
" };\n";
QTest::newRow("QAtomicPointer")
<< Data("#include <QAtomicPointer>\n"
"#include <QStringList>\n\n"
"template <class T> struct Pointer : QAtomicPointer<T> {\n"
" Pointer(T *value = 0) : QAtomicPointer<T>(value) {}\n"
"};\n\n"
"struct SomeStruct {\n"
" int a = 1;\n"
" long b = 2;\n"
" double c = 3.0;\n"
" QString d = \"4\";\n"
" QList<QString> e = {\"5\", \"6\" };\n"
"};\n\n"
"typedef Pointer<SomeStruct> SomeStructPointer;\n\n",
"SomeStruct *s = new SomeStruct; unused(s);\n"
"SomeStructPointer p(s); unused(p);\n"
"Pointer<SomeStruct> pp(s); unused(pp);\n"
"QAtomicPointer<SomeStruct> ppp(s); unused(ppp);\n")
+ Cxx11Profile()
+ Check("p.@1.a", "1", "int")
+ Check("p.@1.e", "<2 items>", "@QList<@QString>")
+ Check("pp.@1.a", "1", "int")
+ Check("ppp.a", "1", "int");
QTest::newRow("QScopedPointer")
<< Data("#include <QScopedPointer>\n"
......
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