Commit 16ed4c01 authored by hjk's avatar hjk
Browse files

Debugger: Fix QSet dumper



Change-Id: I62f5eb1e9b9047b86aeeb79bfd104079897a021c
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 8a6dc823
......@@ -1598,41 +1598,37 @@ def qdump__QScopedPointer(d, value):
def qdump__QSet(d, value):
def hashDataFirstNode(value):
val = value.cast(hashDataType)
bucket = val["buckets"]
e = value.cast(nodeTypePtr)
for n in xrange(val["numBuckets"] - 1, -1, -1):
def hashDataFirstNode(dPtr, numBuckets):
ePtr = dPtr.cast(nodeTypePtr)
bucket = dPtr["buckets"]
for n in xrange(numBuckets - 1, -1, -1):
n = n - 1
if n < 0:
break
if bucket.dereference() != e:
if pointerValue(bucket.dereference()) != pointerValue(ePtr):
return bucket.dereference()
bucket = bucket + 1
return e
def hashDataNextNode(node):
next = node["next"]
if next["next"]:
return next
d = node.cast(hashDataType.pointer()).dereference()
numBuckets = d["numBuckets"]
start = (node["h"] % numBuckets) + 1
bucket = d["buckets"] + start
return ePtr
def hashDataNextNode(nodePtr, numBuckets):
nextPtr = nodePtr.dereference()["next"]
if pointerValue(nextPtr.dereference()["next"]):
return nextPtr
dPtr = nodePtr.cast(hashDataType.pointer()).dereference()
start = (int(nodePtr.dereference()["h"]) % numBuckets) + 1
bucket = dPtr.dereference()["buckets"] + start
for n in xrange(numBuckets - start):
if bucket.dereference() != next:
if pointerValue(bucket.dereference()) != pointerValue(nextPtr):
return bucket.dereference()
bucket += 1
return node
keyType = d.templateArgument(value.type, 0)
return nodePtr
d_ptr = value["q_hash"]["d"]
e_ptr = value["q_hash"]["e"]
size = int(d_ptr["size"])
hashDataType = d_ptr.type
nodeTypePtr = e_ptr.type
anon = childAt(value, 0)
if lldbLoaded: # Skip the inheritance level.
anon = childAt(anon, 0)
d_ptr = anon["d"]
e_ptr = anon["e"]
size = int(d_ptr.dereference()["size"])
check(0 <= size and size <= 100 * 1000 * 1000)
checkRef(d_ptr["ref"])
......@@ -1640,21 +1636,17 @@ def qdump__QSet(d, value):
d.putItemCount(size)
d.putNumChild(size)
if d.isExpanded():
isSimpleKey = isSimpleType(keyType)
node = hashDataFirstNode(value)
hashDataType = d_ptr.type
nodeTypePtr = d_ptr.dereference()["fakeNext"].type
numBuckets = int(d_ptr.dereference()["numBuckets"])
node = hashDataFirstNode(d_ptr, numBuckets)
innerType = e_ptr.dereference().type
with Children(d, size, maxNumChild=1000, childType=innerType):
for i in xrange(size):
for i in d.childRange():
it = node.dereference().cast(innerType)
with SubItem(d, i):
key = it["key"]
if isSimpleKey:
d.putType(keyType)
d.putItem(key)
d.putName(key)
else:
d.putItem(key)
node = hashDataNextNode(node)
d.putItem(it["key"])
node = hashDataNextNode(node, numBuckets)
def qdump__QSharedData(d, value):
......
......@@ -2144,8 +2144,8 @@ void tst_Dumpers::dumper_data()
"s.insert(22);\n")
% CoreProfile()
% Check("s", "<2 items>", "@QSet<int>")
% Check("s.22", "[22]", "22", "int")
% Check("s.11", "[11]", "11", "int");
% Check("s.0", "[0]", "22", "int")
% Check("s.1", "[1]", "11", "int");
QTest::newRow("QSet2")
<< Data("#include <QSet>\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