aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@theqtcompany.com>2015-11-11 15:50:32 +0100
committerhjk <hjk@theqtcompany.com>2015-12-07 12:38:50 +0000
commit7c08f5a9b0777e606b09bf548a973f2c0818b9ba (patch)
tree4b695f50e66ec0e7bdb90717f3f9dc9d59178abd
parent19d9dc0ce37bdc52f7c5c7e382480052ed463851 (diff)
Debugger: Further improve base class dumping with LLDB
... in the presence of empty base classes. This now actually makes the Inheritance dumper test pass. Change-Id: I92ada5da46accb6e7eaff58ce5dc329484ef0909 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
-rw-r--r--share/qtcreator/debugger/lldbbridge.py7
-rw-r--r--tests/auto/debugger/tst_dumpers.cpp38
2 files changed, 21 insertions, 24 deletions
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py
index e49d71730f..b453b5a870 100644
--- a/share/qtcreator/debugger/lldbbridge.py
+++ b/share/qtcreator/debugger/lldbbridge.py
@@ -1123,14 +1123,15 @@ class Dumper(DumperBase):
self.value = value
baseObjects = []
+ # GetNumberOfDirectBaseClasses() includes(!) GetNumberOfVirtualBaseClasses()
+ # so iterating over .GetNumberOfDirectBaseClasses() is correct.
for i in xrange(value.GetType().GetNumberOfDirectBaseClasses()):
baseClass = value.GetType().GetDirectBaseClassAtIndex(i).GetType()
baseChildCount = baseClass.GetNumberOfFields() \
- + baseClass.GetNumberOfDirectBaseClasses() \
- + baseClass.GetNumberOfVirtualBaseClasses()
+ + baseClass.GetNumberOfDirectBaseClasses()
if baseChildCount:
+ baseObjects.append(ChildItem(baseClass.GetName(), value.GetChildAtIndex(memberBase)))
memberBase += 1
- baseObjects.append(ChildItem(baseClass.GetName(), value.GetChildAtIndex(i)))
else:
# This base object is empty, but exists and will *not* be reported
# by value.GetChildCount(). So manually report the empty base class.
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp
index f55827bfcc..3c44b319c3 100644
--- a/tests/auto/debugger/tst_dumpers.cpp
+++ b/tests/auto/debugger/tst_dumpers.cpp
@@ -5670,11 +5670,18 @@ void tst_Dumpers::dumper_data()
"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";
+ "struct Combined : S1, S2 { Combined() : c(1) {} int c; };\n"
+
+ "struct T1 : virtual VEmpty, virtual VData\n"
+ " { T1() : i1(1) {} int i1; };\n"
+ "struct T2 : virtual VEmpty, virtual VData\n"
+ " { T2() : i2(1) {} int i2; };\n"
+ "struct TT : T1, T2 { TT() : c(1) {} int c; };\n";
QTest::newRow("Inheritance")
<< Data(inheritanceData,
@@ -5683,30 +5690,19 @@ void tst_Dumpers::dumper_data()
"c.S2::a = 43;\n"
"c.S1::v = 44;\n"
"c.S2::v = 45;\n"
- "unused(&c.S2::v);\n")
- + NoLldbEngine
+ "unused(&c.S2::v);\n"
+ "TT tt;\n"
+ "tt.T1::v = 44;\n"
+ "tt.T2::v = 45;\n"
+ "unused(&tt.T2::v);\n")
+ Check("c.c", "1", "int")
+ Check("c.@1.@1.a", "42", "int")
+ Check("c.@1.@3.v", "45", "int")
+ Check("c.@2.@1.a", "43", "int")
- + Check("c.@2.@3.v", "45", "int");
-
- // FIXME: Virtual inheritance doesn't work with LLDB 300
- QTest::newRow("InheritanceLldb")
- << 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"
- "unused(&c.S2::v);\n")
- + LldbEngine
- + Check("c.c", "1", "int")
- + Check("c.@1.@1.a", "42", "int")
- //+ Check("c.@1.@4.v", "45", "int")
- + Check("c.@2.@1.a", "43", "int");
- //+ Check("c.@2.@4.v", "45", "int");
-
+ + Check("c.@2.@3.v", "45", "int")
+ + Check("tt.c", "1", "int")
+ + Check("tt.@1.@1.v", "45", "int")
+ + Check("tt.@2.@1.v", "45", "int");
QTest::newRow("Gdb13393")
<< Data(