Commit 31eb7c20 authored by hjk's avatar hjk Committed by hjk

Debugger: Add dumpers for some of libc++'s std::{set,map,multimap}

At least for simple key/values (int etc)

Change-Id: Ib60017347a9f28f1994f7db78c0607f3fdbfac2e
Reviewed-by: default avatarAlexandru Croitor <alexandru.croitor@theqtcompany.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent a2de97b1
......@@ -391,12 +391,90 @@ def qdump__std__set__QNX(d, value):
if node['_Right'] != parent:
node = parent
def std1TreeMin(d, node):
#_NodePtr __tree_min(_NodePtr __x):
# while (__x->__left_ != nullptr)
# __x = __x->__left_;
# return __x;
#
left = node['__left_']
if not d.isNull(left):
node = left
return node
def std1TreeIsLeftChild(d, node):
# bool __tree_is_left_child(_NodePtr __x):
# return __x == __x->__parent_->__left_;
#
other = node['__parent_']['__left_']
return toInteger(node) == toInteger(other)
def std1TreeNext(d, node):
#_NodePtr __tree_next(_NodePtr __x):
# if (__x->__right_ != nullptr)
# return __tree_min(__x->__right_);
# while (!__tree_is_left_child(__x))
# __x = __x->__parent_;
# return __x->__parent_;
#
right = node['__right_']
if not d.isNull(right):
return std1TreeMin(d, right)
while not std1TreeIsLeftChild(d, node):
node = node['__parent_']
return node['__parent_']
def qdump__std____1__set(d, value):
base3 = d.addressOf(value["__tree_"]["__pair3_"])
tree = value["__tree_"]
base3 = d.addressOf(tree["__pair3_"])
size = d.extractUInt(base3)
d.check(size <= 100*1000*1000)
d.putItemCount(size)
d.putNumChild(0)
if d.isExpanded():
# type of node is std::__1::__tree_node<Foo, void *>::value_type
valueType = d.templateArgument(value.type, 0)
d.putFields(tree)
node = tree["__begin_node_"]
nodeType = node.type
with Children(d, size):
for i in d.childRange():
with SubItem(d, i):
d.putItem(node['__value_'])
d.putBetterType(valueType)
node = std1TreeNext(d, node).cast(nodeType)
def qform__std____1__map():
return mapForms()
def qdump__std____1__map(d, value):
tree = value["__tree_"]
base3 = d.addressOf(tree["__pair3_"])
size = d.extractUInt(base3)
d.check(size <= 100*1000*1000)
d.putItemCount(size)
if d.isExpanded():
# type of node is std::__1::__tree_node<Foo, Bar>::value_type
valueType = d.templateArgument(value.type, 0)
node = tree["__begin_node_"]
nodeType = node.type
pairType = d.templateArgument(d.templateArgument(value.type, 3), 0)
with PairedChildren(d, size, pairType=pairType, maxNumChild=1000):
node = tree["__begin_node_"]
nodeType = node.type
for i in d.childRange():
with SubItem(d, i):
# There's possibly also:
#pair = node['__value_']['__nc']
pair = node['__value_']['__cc']
d.putPair(pair, i)
node = std1TreeNext(d, node).cast(nodeType)
def qform__std____1__multimap():
return mapForms()
def qdump__std____1__multimap(d, value):
qdump__std____1__map(d, value)
def qdump__std__stack(d, value):
d.putItem(value["c"])
......
......@@ -3979,10 +3979,10 @@ void tst_Dumpers::dumper_data()
+ Check("map3", "<6 items>", "Map")
+ Check("map3.0", "[0] 11", "11", "float")
+ Check("it1.first", "11", "int")
+ Check("it1.second", "11", "float")
+ Check("it6.first", "66", "int")
+ Check("it6.second", "66", "float")
+ Check("it1.first", "11", "int") % GdbEngine
+ Check("it1.second", "11", "float") % GdbEngine
+ Check("it6.first", "66", "int") % GdbEngine
+ Check("it6.second", "66", "float") % GdbEngine
+ Check("map4", "<5 items>", "std::multimap<unsigned int, float>")
+ Check("map4.0", "[0] 11", "11", "float")
......
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