Commit d6bb579a authored by hjk's avatar hjk

Debugger: Fix QAtomic* and QShared* dumpers with Qt 5.6/C++11

With C++11 we use std::atomic in the ref counter, giving yet
another possibility of structure member names. Instead of
trying to keep up with that, access the binary data directly.

Change-Id: I572f727eb9dab37ac1ca07594d55bea723050817
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent b6f56812
......@@ -33,24 +33,24 @@ from dumper import *
def qdump__QAtomicInt(d, value):
d.putValue(int(value["_q_value"]))
d.putValue(d.extractInt(value.address))
d.putNumChild(0)
def qdump__QBasicAtomicInt(d, value):
d.putValue(int(value["_q_value"]))
d.putValue(d.extractInt(value.address))
d.putNumChild(0)
def qdump__QAtomicPointer(d, value):
d.putType(value.type)
q = value["_q_value"]
q = d.extractPointer(value.address)
p = toInteger(q)
d.putValue("@0x%x" % p)
d.putNumChild(1 if p else 0)
if d.isExpanded():
with Children(d):
d.putSubItem("_q_value", q.dereference())
d.putSubItem("[pointee]", q.dereference())
def qform__QByteArray():
return [Latin1StringFormat, SeparateLatin1StringFormat,
......@@ -1656,7 +1656,7 @@ def qdump__QSet(d, value):
def qdump__QSharedData(d, value):
d.putValue("ref: %s" % value["ref"]["_q_value"])
d.putValue("ref: %s" % d.extractInt(value["ref"].address))
d.putNumChild(0)
......@@ -2213,8 +2213,8 @@ def qdump__QWeakPointer(d, value):
d.putValue("<invalid>")
d.putNumChild(0)
return
weakref = int(d_ptr["weakref"]["_q_value"])
strongref = int(d_ptr["strongref"]["_q_value"])
weakref = d.extractInt(d_ptr["weakref"].address)
strongref = d.extractInt(d_ptr["strongref"].address)
d.check(strongref >= -1)
d.check(strongref <= weakref)
d.check(weakref <= 10*1000*1000)
......
......@@ -2792,7 +2792,7 @@ void tst_Dumpers::dumper_data()
"QSharedPointer<QString> ptr20(new QString(\"hallo\"));\n"
"QSharedPointer<QString> ptr21 = ptr20;\n"
"QSharedPointer<QString> ptr22 = ptr20;\n"
"unused(&ptr20, &ptr21, &ptr21);\n\n"
"unused(&ptr20, &ptr21, &ptr22);\n\n"
"QSharedPointer<int> ptr30(new int(43));\n"
"QWeakPointer<int> ptr31(ptr30);\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