Commit 21da8c64 authored by hjk's avatar hjk
Browse files

Debugger: Add dumper test for inheritance edge cases



Change-Id: Ia4db7dfc0a0182126255393730d15d12abaf369b
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 4ff8440f
......@@ -4281,6 +4281,31 @@ void tst_Dumpers::dumper_data()
% Check("f", "2", "double");
QByteArray inheritanceData =
"struct Empty {};\n"
"struct Data { Data() : a(42) {} int a; };\n"
"struct VEmpty {};\n"
"struct VData { VData() : v(42) {} int v; };\n"
"struct S1 : Empty, Data, virtual VEmpty, virtual VData\n"
" { S1() : i1(1) {} int i1; };\n"
"struct S2 : Empty, Data, virtual VEmpty, virtual VData\n"
" { S2() : i2(1) {} int i2; };\n"
"struct Combined : S1, S2 { Combined() : c(1) {} int c; };\n";
QTest::newRow("inheritance")
<< Data(inheritanceData,
"Combined c;\n"
"c.S1::a = 42;\n"
"c.S2::a = 43;\n"
"c.S1::v = 44;\n"
"c.S2::v = 45;\n")
% Check("c.c", "1", "int")
% Check("c.@1.@2.a", "42", "int")
% Check("c.@1.@4.v", "45", "int")
% Check("c.@2.@2.a", "43", "int")
% Check("c.@2.@4.v", "45", "int");
QTest::newRow("gdb13393")
<< Data(
"struct Base {\n"
......
......@@ -4600,6 +4600,44 @@ QString fooxx()
namespace basic {
struct Empty {};
struct Data { Data() : a(42) {} int a; };
struct VEmpty {};
struct VData { VData() : v(42) {} int v; };
struct S1 : Empty, Data, virtual VEmpty, virtual VData
{
S1() : i1(1) {}
int i1;
};
struct S2 : Empty, Data, virtual VEmpty, virtual VData
{
S2() : i2(1) {}
int i2;
};
struct Combined : S1, S2
{
Combined() : c(1) {} int c;
};
void testInheritance()
{
Combined combined;
combined.S1::a = 42;
combined.S2::a = 43;
combined.S1::v = 44;
combined.S2::v = 45;
BREAK_HERE;
// Continue.
dummyStatement(&combined);
}
// This tests display of basic types.
void testInt()
......@@ -5393,6 +5431,7 @@ namespace basic {
void testBasic()
{
testInheritance();
testInt();
testReference1();
testReference2();
......
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