forked from qt-creator/qt-creator
Debugger: Add dumper test for inheritance edge cases
Change-Id: Ia4db7dfc0a0182126255393730d15d12abaf369b Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -4281,6 +4281,31 @@ void tst_Dumpers::dumper_data()
|
|||||||
% Check("f", "2", "double");
|
% 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")
|
QTest::newRow("gdb13393")
|
||||||
<< Data(
|
<< Data(
|
||||||
"struct Base {\n"
|
"struct Base {\n"
|
||||||
|
@@ -4600,6 +4600,44 @@ QString fooxx()
|
|||||||
|
|
||||||
namespace basic {
|
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.
|
// This tests display of basic types.
|
||||||
|
|
||||||
void testInt()
|
void testInt()
|
||||||
@@ -5393,6 +5431,7 @@ namespace basic {
|
|||||||
|
|
||||||
void testBasic()
|
void testBasic()
|
||||||
{
|
{
|
||||||
|
testInheritance();
|
||||||
testInt();
|
testInt();
|
||||||
testReference1();
|
testReference1();
|
||||||
testReference2();
|
testReference2();
|
||||||
|
Reference in New Issue
Block a user