Debugger: More fixes to the dumper test

With any luck at least the Win11 test plan should not fail anymore.

Change-Id: I9df98cef912ae4f5ab6ed07e62dfac0fe0a48190
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Andrii Semkiv
2024-11-28 13:44:46 +01:00
parent fb6be52b7c
commit b9c75a5e87
2 changed files with 52 additions and 33 deletions

View File

@@ -5,6 +5,7 @@ import platform
import struct import struct
import re import re
from dumper import Children, SubItem, UnnamedSubItem, toInteger, DumperBase from dumper import Children, SubItem, UnnamedSubItem, toInteger, DumperBase
from stdtypes import qdump__std__pair
from utils import DisplayFormat, TypeCode from utils import DisplayFormat, TypeCode
@@ -1492,9 +1493,11 @@ if False:
d.putSpecialValue('minimumitemcount', 0) d.putSpecialValue('minimumitemcount', 0)
# FIXME: Qt 5 def qdump__QPair(d, value):
# remvign the _xxxx makes GDB work with Qt 5 but breaks LLDB if d.qtVersionAtLeast(0x060000):
def qdump__QPair_xxxx(d, value): qdump__std__pair(d, value) # `QPair` is just an alias for `std::pair` in Qt6
return
typeCode = '{%s}@{%s}' % (value.type[0].name, value.type[1].name) typeCode = '{%s}@{%s}' % (value.type[0].name, value.type[1].name)
first, pad, second = value.split(typeCode) first, pad, second = value.split(typeCode)
with Children(d): with Children(d):

View File

@@ -182,6 +182,10 @@ struct GccVersion : VersionBase
explicit GccVersion(int minimum = 0, int maximum = INT_MAX) explicit GccVersion(int minimum = 0, int maximum = INT_MAX)
: VersionBase(minimum, maximum) : VersionBase(minimum, maximum)
{} {}
GccVersion(int majorMin, int minorMin, int patchMin)
: GccVersion{10000 * majorMin + 100 * minorMin + patchMin}
{}
}; };
struct ClangVersion : VersionBase struct ClangVersion : VersionBase
@@ -1421,7 +1425,7 @@ void tst_Dumpers::dumper()
+ QByteArray::number(data.neededQtVersion.max, 16))); + QByteArray::number(data.neededQtVersion.max, 16)));
} }
if (data.neededGccVersion.isRestricted) { if (data.neededGccVersion.isRestricted && m_debuggerEngine == GdbEngine) {
QProcess gcc; QProcess gcc;
gcc.setWorkingDirectory(t->buildPath); gcc.setWorkingDirectory(t->buildPath);
gcc.start("gcc", {"--version"}); gcc.start("gcc", {"--version"});
@@ -4827,35 +4831,42 @@ void tst_Dumpers::dumper_data()
+ Check("deque2.1", "[1]", "", "Foo") + Check("deque2.1", "[1]", "", "Foo")
+ Check("deque2.1.a", "2", "int"); + Check("deque2.1.a", "2", "int");
// clang-format off
QTest::newRow("StdDequeConst") << Data{
R"(
#include <deque>
QTest::newRow("StdDequeConst") struct MyItem {
<< Data("#include <deque>\n" + fooData, MyItem(uint64_t a, uint16_t b) : a{a}, b{b} {}
const uint64_t a;
"struct MyItem {\n" const uint16_t b;
" MyItem(uint64_t a, uint16_t b) : a{a}, b{b} {}\n" };
" const uint64_t a;\n" )",
" const uint16_t b;\n" R"(
"};\n\n" std::deque<MyItem> deq;
for (uint16_t i = 0; i < 100; ++i) {
"std::deque<MyItem> deq;\n" deq.push_back({i, i});
"for (uint16_t i = 0; i < 100; ++i)\n" }
" deq.push_back({i, i});\n", )",
"&deq"
"&deq") }
+ CoreProfile{}
+ CoreProfile() + Check{"deq.0", "[0]", "", "MyItem"}
+ Check("deq.0", "[0]", "", "MyItem") + Check{"deq.0.a", "0", "uint64_t"} % NoCdbEngine
+ Check("deq.0.a", "0", "uint64_t") + Check{"deq.0.a", "0", "unsigned int64"} % CdbEngine
+ Check("deq.0.b", "0", "uint16_t") + Check{"deq.0.b", "0", "uint16_t"} % NoCdbEngine
+ Check{"deq.0.b", "0", "unsigned short"} % CdbEngine
+ Check("deq.50", "[50]", "", "MyItem") + Check{"deq.50", "[50]", "", "MyItem"}
+ Check("deq.50.a", "50", "uint64_t") + Check{"deq.50.a", "50", "uint64_t"} % NoCdbEngine
+ Check("deq.50.b", "50", "uint16_t") + Check{"deq.50.a", "50", "unsigned int64"} % CdbEngine
+ Check{"deq.50.b", "50", "uint16_t"} % NoCdbEngine
+ Check("deq.99", "[99]", "", "MyItem") + Check{"deq.50.b", "50", "unsigned short"} % CdbEngine
+ Check("deq.99.a", "99", "uint64_t") + Check{"deq.99", "[99]", "", "MyItem"}
+ Check("deq.99.b", "99", "uint16_t"); + Check{"deq.99.a", "99", "uint64_t"} % NoCdbEngine
+ Check{"deq.99.a", "99", "unsigned int64"} % CdbEngine
+ Check{"deq.99.b", "99", "uint16_t"} % NoCdbEngine
+ Check{"deq.99.b", "99", "unsigned short"} % CdbEngine;
// clang-format on
QTest::newRow("StdHashSet") QTest::newRow("StdHashSet")
<< Data("#include <hash_set>\n" << Data("#include <hash_set>\n"
@@ -5444,6 +5455,7 @@ void tst_Dumpers::dumper_data()
"&view, &u16view, basicview, u16basicview") "&view, &u16view, basicview, u16basicview")
+ Cxx17Profile{}
+ Check("view", "\"test\"", TypeDef("std::basic_string_view<char, std::char_traits<char> >", "std::string_view")) + Check("view", "\"test\"", TypeDef("std::basic_string_view<char, std::char_traits<char> >", "std::string_view"))
+ Check("u16view", "\"test\"", TypeDef("std::basic_string_view<char16_t, std::char_traits<char16_t> >", "std::u16string_view")) + Check("u16view", "\"test\"", TypeDef("std::basic_string_view<char16_t, std::char_traits<char16_t> >", "std::u16string_view"))
+ Check("basicview", "\"test\"", "std::basic_string_view<char, std::char_traits<char> >") + Check("basicview", "\"test\"", "std::basic_string_view<char, std::char_traits<char> >")
@@ -8619,7 +8631,7 @@ void tst_Dumpers::dumper_data()
+ Check("dir.entryList.1", "[1]", "\"..\"", "@QString") % NoCdbEngine; + Check("dir.entryList.1", "[1]", "\"..\"", "@QString") % NoCdbEngine;
// clang-format off // clang-format off
QTest::newRow("tl__expected") << Data{ QTest::newRow("TlExpected") << Data{
R"( R"(
#include <tl_expected/include/tl/expected.hpp> #include <tl_expected/include/tl/expected.hpp>
@@ -8743,6 +8755,10 @@ void tst_Dumpers::dumper_data()
"&d, &fl, &l, &s, &ms, &us, &ums, &m, &mm, &um, &umm, &v" "&d, &fl, &l, &s, &ms, &us, &ums, &m, &mm, &um, &umm, &v"
} }
+ Cxx17Profile{} + Cxx17Profile{}
// `memory_resource` header is only available since GCC 9.1
// (see https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017)
// and the test are run with GCC (MinGW) as old as 8.1
+ GccVersion{9, 1, 0}
+ Check{"d", "<10 items>", "std::pmr::deque<int>"} % NoGdbEngine + Check{"d", "<10 items>", "std::pmr::deque<int>"} % NoGdbEngine
+ Check{"d", "<10 items>", "std::pmr::deque"} % GdbEngine + Check{"d", "<10 items>", "std::pmr::deque"} % GdbEngine
+ Check{"d.1", "[1]", "8", "int"} + Check{"d.1", "[1]", "8", "int"}