Debugger: Add support boost::container vector/static_vector

Also fix boost::container::list.

Change-Id: Iaa2ff09defc6f90c3f6eb1f7b333f9e5ccc16b65
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ihor Dutchak
2021-09-07 18:50:32 +03:00
parent 1aa92b5dab
commit 716efc964d
2 changed files with 65 additions and 6 deletions

View File

@@ -23,6 +23,7 @@
# #
############################################################################ ############################################################################
from utils import DisplayFormat
from dumper import Children from dumper import Children
@@ -68,7 +69,11 @@ def qdump__boost__shared_ptr(d, value):
def qdump__boost__container__list(d, value): def qdump__boost__container__list(d, value):
r = value["members_"]["m_icont"]["data_"]["root_plus_size_"] try:
m_icont = value["m_icont"]
except:
m_icont = value["members_"]["m_icont"]
r = m_icont["data_"]["root_plus_size_"]
n = r["size_"].integer() n = r["size_"].integer()
d.putItemCount(n) d.putItemCount(n)
if d.isExpanded(): if d.isExpanded():
@@ -85,6 +90,32 @@ def qdump__boost__container__list(d, value):
p = d.extractPointer(p) p = d.extractPointer(p)
def qform__boost__container__vector():
return [DisplayFormat.ArrayPlot]
def qdump__boost__container__vector(d, value):
holder = value["m_holder"]
size = holder["m_size"].integer()
d.putItemCount(size)
if d.isExpanded():
T = value.type[0]
try:
start = holder["m_start"].pointer()
except:
start = holder["storage"].address()
d.putPlotData(start, size, T)
def qform__boost__container__static_vector():
return [DisplayFormat.ArrayPlot]
def qdump__boost__container__static_vector(d, value):
qdump__boost__container__vector(d, value)
def qdump__boost__gregorian__date(d, value): def qdump__boost__gregorian__date(d, value):
d.putValue(value.integer(), "juliandate") d.putValue(value.integer(), "juliandate")

View File

@@ -6690,9 +6690,6 @@ void tst_Dumpers::dumper_data()
+ Check("p3", "Thu Jan 1 00:00:00 1970", "boost::posix_time::ptime"); + Check("p3", "Thu Jan 1 00:00:00 1970", "boost::posix_time::ptime");
/*
FIXME
QTest::newRow("BoostList") QTest::newRow("BoostList")
<< Data("#include <boost/container/list.hpp>\n", << Data("#include <boost/container/list.hpp>\n",
"typedef std::pair<int, double> p;\n" "typedef std::pair<int, double> p;\n"
@@ -6700,11 +6697,42 @@ void tst_Dumpers::dumper_data()
"l.push_back(p(13, 61));\n" "l.push_back(p(13, 61));\n"
"l.push_back(p(14, 64));\n" "l.push_back(p(14, 64));\n"
"l.push_back(p(15, 65));\n" "l.push_back(p(15, 65));\n"
"l.push_back(p(16, 66));\n") "l.push_back(p(16, 66));\n",
"&l")
+ BoostProfile() + BoostProfile()
+ Check("l", "<4 items>", TypePattern("boost::container::list<std::pair<int,double>.*>")) + Check("l", "<4 items>", TypePattern("boost::container::list<std::pair<int,double>.*>"))
+ Check("l.1.first", "14", "int")
+ Check("l.2.second", FloatValue("65"), "double"); + Check("l.2.second", FloatValue("65"), "double");
*/
QTest::newRow("BoostVector")
<< Data("#include <boost/container/vector.hpp>\n",
"typedef std::pair<int, double> p;\n"
"boost::container::vector<p> v;\n"
"v.push_back(p(13, 61));\n"
"v.push_back(p(14, 64));\n"
"v.push_back(p(15, 65));\n"
"v.push_back(p(16, 66));\n",
"&v")
+ BoostProfile()
+ Check("v", "<4 items>", TypePattern("boost::container::vector<std::pair<int,double>.*>"))
+ Check("v.1.first", "14", "int")
+ Check("v.2.second", FloatValue("65"), "double");
QTest::newRow("BoostStaticVector")
<< Data("#include <boost/container/static_vector.hpp>\n",
"typedef std::pair<int, double> p;\n"
"boost::container::static_vector<p, 10> v;\n"
"v.push_back(p(13, 61));\n"
"v.push_back(p(14, 64));\n"
"v.push_back(p(15, 65));\n"
"v.push_back(p(16, 66));\n",
"&v")
+ BoostProfile()
+ Check("v", "<4 items>", TypePattern("boost::container::static_vector<std::pair<int,double>.*>"))
+ Check("v.1.first", "14", "int")
+ Check("v.2.second", FloatValue("65"), "double");
QTest::newRow("BoostUnorderedSet") QTest::newRow("BoostUnorderedSet")