Commit 776da7b5 authored by hjk's avatar hjk
Browse files

Debugger: Improve associative std container display



Handle multimap and multiset. Use the "[index] key" display that's
also used for Q{Multi,}Map both for consistency and because it's
needed to distiguish otherwise identical keys.

Change-Id: Ib9e369206bce89e5e27d1f6f60ead11ca88e2dcb
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 543958c3
......@@ -192,7 +192,7 @@ def qdump__std__map(d, value):
for i in d.childRange():
with SubItem(d, i):
pair = (node + 1).cast(pairPointer).dereference()
d.putPair(pair)
d.putPair(pair, i)
if d.isNull(node["_M_right"]):
parent = node["_M_parent"]
while node == parent["_M_right"]:
......@@ -267,9 +267,18 @@ def qdump__std____debug__map(d, value):
def qdump__std____debug__set(d, value):
qdump__std__set(d, value)
def qdump__std__multiset(d, value):
qdump__std__set(d, value)
def qdump__std____cxx1998__map(d, value):
qdump__std__map(d, value)
def qform__std__multimap():
return mapForms()
def qdump__std__multimap(d, value):
return qdump__std__map(d, value)
def stdTreeIteratorHelper(d, value):
node = value["_M_node"].dereference()
d.putNumChild(1)
......
......@@ -3728,22 +3728,33 @@ void tst_Dumpers::dumper_data()
"Map::iterator it4 = it3; ++it4;\n"
"Map::iterator it5 = it4; ++it5;\n"
"Map::iterator it6 = it5; ++it6;\n"
"unused(&it6);\n")
"unused(&it6);\n"
"std::multimap<unsigned int, float> map4;\n"
"map4.insert(std::pair<unsigned int, float>(11, 11.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 22.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 23.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 24.0));\n"
"map4.insert(std::pair<unsigned int, float>(22, 25.0));\n")
+ Check("map1", "<2 items>", "std::map<unsigned int, unsigned int>")
+ Check("map1.11", "[11]", "1", "unsigned int")
+ Check("map1.22", "[22]", "2", "unsigned int")
+ Check("map1.0", "[0] 11", "1", "unsigned int")
+ Check("map1.1", "[1] 22", "2", "unsigned int")
+ Check("map2", "<2 items>", "std::map<unsigned int, float>")
+ Check("map2.11", "[11]", "11", "float")
+ Check("map2.22", "[22]", "22", "float")
+ Check("map2.0", "[0] 11", "11", "float")
+ Check("map2.1", "[1] 22", "22", "float")
+ Check("map3", "<6 items>", "Map")
+ Check("map3.11", "[11]", "11", "float")
+ 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("it6.second", "66", "float")
+ Check("map4", "<5 items>", "std::multimap<unsigned int, float>")
+ Check("map4.0", "[0] 11", "11", "float")
+ Check("map4.4", "[4] 22", "25", "float");
QTest::newRow("StdMapQt")
......@@ -3911,7 +3922,15 @@ void tst_Dumpers::dumper_data()
"Set::iterator it1 = s2.begin();\n"
"Set::iterator it2 = it1; ++it2;\n"
"Set::iterator it3 = it2; ++it3;\n"
"unused(&it3);\n")
"unused(&it3);\n\n"
"std::multiset<int> s3;\n"
"s3.insert(1);\n"
"s3.insert(1);\n"
"s3.insert(2);\n"
"s3.insert(3);\n"
"s3.insert(3);\n"
"s3.insert(3);\n")
+ Check("s0", "<0 items>", "std::set<double>")
......@@ -3919,7 +3938,11 @@ void tst_Dumpers::dumper_data()
+ Check("s2", "<3 items>", "Set")
+ Check("it1.value", "11", "int")
+ Check("it3.value", "33", "int");
+ Check("it3.value", "33", "int")
+ Check("s3", "<6 items>", "std::multiset<int>")
+ Check("s3.0", "[0]", "1", "int")
+ Check("s3.5", "[5]", "3", "int");
QTest::newRow("StdSetQt")
......
......@@ -3262,6 +3262,32 @@ namespace stdmap {
dummyStatement(&map);
}
void testStdMultiMapUIntFloat()
{
typedef std::pair<uint, float> V;
std::multimap<uint, float> map;
map.insert(V(11, 11.0));
map.insert(V(22, 22.0));
map.insert(V(22, 33.0));
map.insert(V(22, 34.0));
map.insert(V(22, 35.0));
map.insert(V(22, 36.0));
BREAK_HERE;
// Expand map.
// Check map <6 items> std:multimap<unsigned int, float>.
// Check map.0 11 float.
// Check map.5 22 float.
// Continue.
dummyStatement(&map);
}
void testStdMultiSetInt()
{
std::multiset<int> set = {1, 1, 2, 3, 3, 3};
BREAK_HERE;
dummyStatement(&set);
}
void testStdMap()
{
testStdMapStringFoo();
......@@ -3274,6 +3300,8 @@ namespace stdmap {
testStdMapStringFloat();
testStdMapIntString();
testStdMapStringPointer();
testStdMultiMapUIntFloat();
testStdMultiSetInt();
}
} // namespace stdmap
......
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