From 716efc964df2029861b237da3119fdc44c914ee3 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Tue, 7 Sep 2021 18:50:32 +0300 Subject: [PATCH] Debugger: Add support boost::container vector/static_vector Also fix boost::container::list. Change-Id: Iaa2ff09defc6f90c3f6eb1f7b333f9e5ccc16b65 Reviewed-by: hjk --- share/qtcreator/debugger/boosttypes.py | 33 +++++++++++++++++++++- tests/auto/debugger/tst_dumpers.cpp | 38 ++++++++++++++++++++++---- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/share/qtcreator/debugger/boosttypes.py b/share/qtcreator/debugger/boosttypes.py index ff2ab1a977c..fa4d2eeb39d 100644 --- a/share/qtcreator/debugger/boosttypes.py +++ b/share/qtcreator/debugger/boosttypes.py @@ -23,6 +23,7 @@ # ############################################################################ +from utils import DisplayFormat from dumper import Children @@ -68,7 +69,11 @@ def qdump__boost__shared_ptr(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() d.putItemCount(n) if d.isExpanded(): @@ -85,6 +90,32 @@ def qdump__boost__container__list(d, value): 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): d.putValue(value.integer(), "juliandate") diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 2481f048b2a..e9fde225371 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -6690,9 +6690,6 @@ void tst_Dumpers::dumper_data() + Check("p3", "Thu Jan 1 00:00:00 1970", "boost::posix_time::ptime"); -/* - FIXME - QTest::newRow("BoostList") << Data("#include \n", "typedef std::pair p;\n" @@ -6700,11 +6697,42 @@ void tst_Dumpers::dumper_data() "l.push_back(p(13, 61));\n" "l.push_back(p(14, 64));\n" "l.push_back(p(15, 65));\n" - "l.push_back(p(16, 66));\n") + "l.push_back(p(16, 66));\n", + "&l") + BoostProfile() + Check("l", "<4 items>", TypePattern("boost::container::list.*>")) + + Check("l.1.first", "14", "int") + Check("l.2.second", FloatValue("65"), "double"); -*/ + + + QTest::newRow("BoostVector") + << Data("#include \n", + "typedef std::pair p;\n" + "boost::container::vector

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.*>")) + + Check("v.1.first", "14", "int") + + Check("v.2.second", FloatValue("65"), "double"); + + + QTest::newRow("BoostStaticVector") + << Data("#include \n", + "typedef std::pair p;\n" + "boost::container::static_vector 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.*>")) + + Check("v.1.first", "14", "int") + + Check("v.2.second", FloatValue("65"), "double"); QTest::newRow("BoostUnorderedSet")