Debugger: Fix mapping std::set in Locals window via gdb

Currently QtCreator incorrectly shows content of a std::set.
For example set {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
is shown as {0, 1, 2, 1, 2, 1, 2, 1, 2}.

Change-Id: Idaff66451827657ef129aa3d27895c43938e6fdc
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Dmitry Nuzhdin
2019-08-24 10:48:17 +03:00
parent 8751d0c7d9
commit 309e345818
2 changed files with 7 additions and 6 deletions

View File

@@ -442,7 +442,7 @@ def qdump__std__set(d, value):
d.putSubItem(i, val)
if node["_M_right"].pointer() == 0:
parent = node["_M_parent"]
while node == parent["_M_right"]:
while node.pointer() == parent["_M_right"].pointer():
node = parent
parent = parent["_M_parent"]
if node["_M_right"] != parent:

View File

@@ -4692,10 +4692,7 @@ void tst_Dumpers::dumper_data()
"std::set<double> s0;\n"
"unused(&s0);\n\n"
"std::set<int> s1;\n"
"s1.insert(11);\n"
"s1.insert(22);\n"
"s1.insert(33);\n"
"std::set<int> s1{11, 22, 33, 44, 55, 66, 77, 88};\n"
"unused(&s1);\n\n"
"typedef std::set<int> Set;\n"
@@ -4716,9 +4713,13 @@ void tst_Dumpers::dumper_data()
"s3.insert(3);\n"
"s3.insert(3);\n")
+ Cxx11Profile()
+ Check("s0", "<0 items>", "std::set<double>")
+ Check("s1", "<3 items>", "std::set<int>")
+ Check("s1", "<8 items>", "std::set<int>")
+ Check("s1.0", "[0]", "11", "int")
+ Check("s1.1", "[1]", "22", "int")
+ Check("s1.5", "[5]", "66", "int")
+ Check("s2", "<3 items>", TypeDef("std::set<int>", "Set"))
+ Check("it1.value", "11", "int")