Debugger: Add a dumper test for shared_ptr<ThingWithVTable>

... and fix lldbbridge to pass it.

Change-Id: I2c20cfafe5d7695d4359521cbfcbdc235dacbc82
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2016-11-25 11:35:31 +01:00
parent 840e787175
commit eefe4fb7f7
2 changed files with 33 additions and 14 deletions
+13 -14
View File
@@ -264,28 +264,27 @@ class Dumper(DumperBase):
field.lbitsize = nativeFieldType.GetByteSize() * 8
isBitfield = False
if isBitfield:
if isBitfield: # Bit fields
field.ltype = self.createBitfieldType(self.typeName(nativeFieldType), field.lbitsize)
else:
yield field
elif field.name is None: # Anon members
fakeMember = fakeValue.GetChildAtIndex(i)
#try:
fakeMemberAddress = fakeMember.GetLoadAddress()
#except:
# # Happens in the BoostList dumper for a 'const bool'
# # item named 'constant_time_size'. There isn't anything we can do
# # in this case.
# continue
offset = fakeMemberAddress - fakeAddress
field.lbitpos = 8 * offset
field.ltype = self.fromNativeType(nativeFieldType)
yield field
if field.name in baseNames:
field.isBaseClass = True
field.baseIndex = baseNames[field.name]
elif field.name in baseNames: # Simple bases
member = self.fromNativeValue(fakeValue.GetChildAtIndex(i))
member.isBaseClass = True
yield member
yield field
else: # Normal named members
member = self.fromNativeValue(fakeValue.GetChildAtIndex(i))
member.name = nativeField.GetName()
yield member
# Empty bases are not covered above.
for i in range(nativeType.GetNumberOfDirectBaseClasses()):
+20
View File
@@ -4403,6 +4403,26 @@ void tst_Dumpers::dumper_data()
+ Check("ps", "\"ABC\"", "std::shared_ptr<std::string>")
+ Check("ps.data", "\"ABC\"", "std::string");
QTest::newRow("StdSharedPtr2")
<< Data("#include <memory>\n"
"struct A {\n"
" virtual ~A() {}\n"
" int *m_0 = (int *)0;\n"
" int *m_1 = (int *)1;\n"
" int *m_2 = (int *)2;\n"
" int x = 3;\n"
"};\n",
"std::shared_ptr<A> a(new A);\n"
"A *inner = a.get(); unused(inner);\n")
+ Cxx11Profile()
+ Check("inner.m_0", "0x0", "int *")
+ Check("inner.m_1", "0x1", "int *")
+ Check("inner.m_2", "0x2", "int *")
+ Check("inner.x", "3", "int")
+ Check("a.data.m_0", "0x0", "int *")
+ Check("a.data.m_1", "0x1", "int *")
+ Check("a.data.m_2", "0x2", "int *")
+ Check("a.data.x", "3", "int");
QTest::newRow("StdSet")
<< Data("#include <set>\n",