GCC 3.x 和 4.x 中 C++ 对象中的 VTable 布局和 VTable 指针位置是什么?
我正在寻找 VTable 结构、顺序和内容的详细信息,以及 vtable 指针在对象中的位置.
理想情况下,这将涵盖单继承、多继承和虚拟继承.
对外部文档的引用也将不胜感激
GCC 4.0x 类布局的文档在 这里 和 Itanium,以及更广泛的 GNU,ABI 布局文档是这里.
解决方案虽然编译器可以自由放置数据指针(在 MI 和 VI 场景中,或到 typeinfos),但虚拟表通常被视为函数指针数组,整数(用于修正)或标记元素(例如 NULL 指针)也可以放入其中.布局通常是特定于编译器的(或特定于 ABI 的,多个 C++ 编译器共享一个 ABI),但如果正在编译的类具有稳定的接口,则它是稳定的(否则您必须一直重新编译代码,这很麻烦).还需要额外的表来处理涉及虚拟和多重继承的极端情况,并确保派生类构造期间的虚拟调用按照标准所说的那样在这些情况下运行(这些是 VTT 和构造表中的以下输出用于).
至于 GCC 4.x 的具体情况:-fdump-class-hierarchy
开关确实像描述的那样起作用(然后是一些).我使用下面的示例代码在 Coliru 上对其进行了测试:
结构基{虚拟 ~Base() {}虚空 f() = 0;};结构OtherBase{虚拟?OtherBase(){}虚空 g() {}};结构派生:公共基础{虚拟 ~Derived() {}虚空 f() {}};struct MultiplyDerived:公共基础、公共 OtherBase{虚拟 ~MultiplyDerived() {}虚空 f() {}虚空 g() {}};struct OtherDerived:公共基础{虚拟 ~OtherDerived() {}虚空 f() {}};结构 DiamondDerived:公共派生,公共 OtherDerived{虚拟 ~DiamondDerived() {}虚空 f() {}};struct VirtuallyDerived:虚拟公共基础{虚拟 ~VirtuallyDerived() {}虚空 f() {}};struct OtherVirtuallyDerived:虚拟公共基础{虚拟~OtherVirtuallyDerived() {}虚空 f() {}};struct VirtuallyDiamondDerived: public VirtuallyDerived, public OtherVirtuallyDerived{虚拟 ~VirtuallyDiamondDerived() {}虚空 f() {}};struct DoublyVirtuallyDiamondDerived: 虚拟公共 VirtuallyDerived, 虚拟公共 OtherVirtuallyDerived{虚拟 ~DoublyVirtuallyDiamondDerived() {}虚空 f() {}};struct MixedVirtuallyDerived:虚拟公共Base,公共OtherBase{虚拟 ~MixedVirtuallyDerived() {}};struct MixedVirtuallyDiamondDerived: public VirtuallyDerived, public MixedVirtuallyDerived{虚拟 ~MixedVirtuallyDiamondDerived() {}虚空 f() {}虚空 g() {}};struct VirtuallyMultiplyDerived:虚拟公共Base,虚拟公共OtherBase{虚拟 ~VirtuallyMultiplyDerived() {}};struct OtherVirtuallyMultiplyDerived:虚拟公共Base,虚拟公共OtherBase{虚拟 ~OtherVirtuallyMultiplyDerived() {}};结构 MultiplyVirtuallyDiamondDerived:公共 VirtuallyMultiplyDerived,公共 OtherVirtuallyMultiplyDerived{虚拟 ~MultiplyVirtuallyDiamondDerived() {}虚空 f() {}虚空 g() {}};
并从 G++ 接收(损坏的名称指南:TI 是 typeinfos,TV 是 vtables,Th 和 Tv 是用于在存在多重和/或虚拟继承时进行正确虚拟调用的 thunk):
<上一页>用于基础的 VtableBase::_ZTV4Base: 5u 个条目0 (int (*)(...))08 (int (*)(...))(& _ZTI4Base)16 0u24 0u32 (int (*)(...))__cxa_pure_virtual类库大小=8 对齐=8基本尺寸=8 基本对齐=8Base (0x0x7fd42c0355a0) 0 几乎为空vptr=((& Base::_ZTV4Base) + 16u)OtherBase 的 VtableOtherBase::_ZTV9OtherBase: 5u 条目0 (int (*)(...))08 (int (*)(...))(& _ZTI9OtherBase)16 (int (*)(...))OtherBase::~OtherBase24 (int (*)(...))OtherBase::~OtherBase32 (int (*)(...))OtherBase::g类 OtherBase大小=8 对齐=8基本尺寸=8 基本对齐=8OtherBase (0x0x7fd42c035600) 0 几乎为空vptr=((& OtherBase::_ZTV9OtherBase) + 16u)导出的 VtableDerived::_ZTV7Derived: 5u 个条目0 (int (*)(...))08 (int (*)(...))(& _ZTI7Derived)16 (int (*)(...))Derived::~Derived24 (int (*)(...))Derived::~Derived32 (int (*)(...))Derived::f类派生大小=8 对齐=8基本尺寸=8 基本对齐=8派生 (0x0x7fd42c02d138) 0 几乎为空vptr=((& Derived::_ZTV7Derived) + 16u)Base (0x0x7fd42c035660) 0 几乎为空主要派生(0x0x7fd42c02d138)MultiplyDerived 的 VtableMultiplyDerived::_ZTV15MultiplyDerived: 11u 个条目0 (int (*)(...))08 (int (*)(...))(& _ZTI15MultiplyDerived)16 (int (*)(...))MultiplyDerived::~MultiplyDerived24 (int (*)(...))MultiplyDerived::~MultiplyDerived32 (int (*)(...))MultiplyDerived::f40 (int (*)(...))MultiplyDerived::g48 (int (*)(...))-856 (int (*)(...))(& _ZTI15MultiplyDerived)64 (int (*)(...))MultiplyDerived::_ZThn8_N15MultiplyDerivedD1Ev72 (int (*)(...))MultiplyDerived::_ZThn8_N15MultiplyDerivedD0Ev80 (int (*)(...))MultiplyDerived::_ZThn8_N15MultiplyDerived1gEv类 MultiplyDerived尺寸=16 对齐=8基本尺寸=16 基本对齐=8乘法衍生 (0x0x7fd42c04aaf0) 0vptr=((& MultiplyDerived::_ZTV15MultiplyDerived) + 16u)Base (0x0x7fd42c0356c0) 0 几乎为空主要用于 MultiplyDerived (0x0x7fd42c04aaf0)OtherBase (0x0x7fd42c035720) 8 几乎为空vptr=((& MultiplyDerived::_ZTV15MultiplyDerived) + 64u)OtherDerived 的 VtableOtherDerived::_ZTV12OtherDerived: 5u 条目0 (int (*)(...))08 (int (*)(...))(& _ZTI12OtherDerived)16 (int (*)(...))OtherDerived::~OtherDerived24 (int (*)(...))OtherDerived::~OtherDerived32 (int (*)(...))OtherDerived::f其他派生类大小=8 对齐=8基本尺寸=8 基本对齐=8OtherDerived (0x0x7fd42c02d1a0) 0 几乎为空vptr=((& OtherDerived::_ZTV12OtherDerived) + 16u)基数 (0x0x7fd42c035780) 0 几乎为空主要的其他派生(0x0x7fd42c02d1a0)DiamondDerived 的 VtableDiamondDerived::_ZTV14DiamondDerived: 10u 个条目0 (int (*)(...))08 (int (*)(...))(& _ZTI14DiamondDerived)16 (int (*)(...))DiamondDerived::~DiamondDerived24 (int (*)(...))DiamondDerived::~DiamondDerived32 (int (*)(...))DiamondDerived::f40 (int (*)(...))-848 (int (*)(...))(& _ZTI14DiamondDerived)56 (int (*)(...))DiamondDerived::_ZThn8_N14DiamondDerivedD1Ev64 (int (*)(...))DiamondDerived::_ZThn8_N14DiamondDerivedD0Ev72 (int (*)(...))DiamondDerived::_ZThn8_N14DiamondDerived1fEv类 DiamondDerived尺寸=16 对齐=8基本尺寸=16 基本对齐=8钻石派生(0x0x7fd42c0625b0)0vptr=((& DiamondDerived::_ZTV14DiamondDerived) + 16u)派生 (0x0x7fd42c02d208) 0 几乎为空主要用于 DiamondDerived (0x0x7fd42c0625b0)Base (0x0x7fd42c0357e0) 0 几乎为空主要派生(0x0x7fd42c02d208)OtherDerived (0x0x7fd42c02d270) 8 几乎为空vptr=((& DiamondDerived::_ZTV14DiamondDerived) + 56u)Base (0x0x7fd42c035840) 8 几乎为空主要的其他派生(0x0x7fd42c02d270)VirtuallyDerived 的 VtableVirtuallyDerived::_ZTV16VirtuallyDerived: 8u 条目0 0u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI16VirtuallyDerived)40 (int (*)(...))VirtuallyDerived::~VirtuallyDerived48 (int (*)(...))VirtuallyDerived::~VirtuallyDerived56 (int (*)(...))VirtuallyDerived::f虚拟衍生的 VTTVirtuallyDerived::_ZTT16VirtuallyDerived: 2u 个条目0 ((& VirtuallyDerived::_ZTV16VirtuallyDerived) + 40u)8 ((& VirtuallyDerived::_ZTV16VirtuallyDerived) + 40u)虚拟派生类大小=8 对齐=8基本尺寸=8 基本对齐=8VirtuallyDerived (0x0x7fd42c02d2d8) 0 几乎为空vptridx=0u vptr=((& VirtuallyDerived::_ZTV16VirtuallyDerived) + 40u)Base (0x0x7fd42c0358a0) 0 几乎为空的虚拟主要用于 VirtuallyDerived (0x0x7fd42c02d2d8)vptridx=8u vbaseoffset=-40OtherVirtuallyDerived 的 VtableOtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived: 8u 条目0 0u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI21OtherVirtuallyDerived)40 (int (*)(...))OtherVirtuallyDerived::~OtherVirtuallyDerived48 (int (*)(...))OtherVirtuallyDerived::~OtherVirtuallyDerived56 (int (*)(...))OtherVirtuallyDerived::f其他虚拟派生的 VTTOtherVirtuallyDerived::_ZTT21OtherVirtuallyDerived: 2u 个条目0 ((& OtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived) + 40u)8 ((& OtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived) + 40u)类 OtherVirtuallyDerived大小=8 对齐=8基本尺寸=8 基本对齐=8OtherVirtuallyDerived (0x0x7fd42c02d340) 0 几乎为空vptridx=0u vptr=((& OtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived) + 40u)Base (0x0x7fd42c035900) 0 几乎为空的虚拟主要用于 OtherVirtuallyDerived (0x0x7fd42c02d340)vptridx=8u vbaseoffset=-40VirtuallyDiamondDerived 的 VtableVirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived: 16u 个条目0 0u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI23VirtuallyDiamondDerived)40 (int (*)(...))VirtuallyDiamondDerived::~VirtuallyDiamondDerived48 (int (*)(...))VirtuallyDiamondDerived::~VirtuallyDiamondDerived56 (int (*)(...))VirtuallyDiamondDerived::f64 18446744073709551608u72 18446744073709551608u80 18446744073709551608u88 (int (*)(...))-896 (int (*)(...))(& _ZTI23VirtuallyDiamondDerived)104 (int (*)(...))VirtuallyDiamondDerived::_ZThn8_N23VirtuallyDiamondDerivedD1Ev112 (int (*)(...))VirtuallyDiamondDerived::_ZThn8_N23VirtuallyDiamondDerivedD0Ev120 (int (*)(...))VirtuallyDiamondDerived::_ZThn8_N23VirtuallyDiamondDerived1fEvVirtuallyDiamondDerived 中 VirtuallyDerived(0x0x7fd42c02d3a8 实例)的构造 vtableVirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived0_16VirtuallyDerived: 8u 条目0 0u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI16VirtuallyDerived)40 0u48 0u56 (int (*)(...))VirtuallyDerived::fVirtuallyDiamondDerived 中 OtherVirtuallyDerived (0x0x7fd42c02d410 实例) 的构造 vtableVirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived8_21OtherVirtuallyDerived: 15u 个条目0 18446744073709551608u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI21OtherVirtuallyDerived)40 0u48 0u56 (int (*)(...))OtherVirtuallyDerived::f64 8u72 8u80 (int (*)(...))888 (int (*)(...))(& _ZTI21OtherVirtuallyDerived)96 0u104 0u112 (int (*)(...))OtherVirtuallyDerived::_ZTv0_n32_N21OtherVirtuallyDerived1fEvVirtuallyDiamondDerived 的 VTTVirtuallyDiamondDerived::_ZTT23VirtuallyDiamondDerived: 7u 个条目0 ((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 40u)8 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived0_16VirtuallyDerived) + 40u)16 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived0_16VirtuallyDerived) + 40u)24 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 40u)32 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 96u)40 ((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 40u)48 ((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 104u)VirtuallyDiamondDerived 类尺寸=16 对齐=8基本尺寸=16 基本对齐=8VirtuallyDiamondDerived (0x0x7fd42c07e460) 0vptridx=0u vptr=((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 40u)VirtuallyDerived (0x0x7fd42c02d3a8) 0 几乎为空主要用于 VirtuallyDiamondDerived (0x0x7fd42c07e460)subvttidx=8uBase (0x0x7fd42c035960) 0 几乎为空的虚拟主要用于 VirtuallyDerived (0x0x7fd42c02d3a8)vptridx=40u vbaseoffset=-40OtherVirtuallyDerived (0x0x7fd42c02d410) 8 几乎为空失主subvttidx=24u vptridx=48u vptr=((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 104u)基本 (0x0x7fd42c035960) 替代路径DoublyVirtuallyDiamondDerived 的 VtableDoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived: 18u 个条目0 8u8 0u16 0u24 0u32 0u40 (int (*)(...))048 (int (*)(...))(& _ZTI29DoublyVirtuallyDiamondDerived)56 (int (*)(...))DoublyVirtuallyDiamondDerived::~DoublyVirtuallyDiamondDerived64 (int (*)(...))DoublyVirtuallyDiamondDerived::~DoublyVirtuallyDiamondDerived72 (int (*)(...))DoublyVirtuallyDiamondDerived::f80 18446744073709551608u88 18446744073709551608u96 18446744073709551608u104 (int (*)(...))-8112 (int (*)(...))(& _ZTI29DoublyVirtuallyDiamondDerived)120 (int (*)(...))DoublyVirtuallyDiamondDerived::_ZTv0_n24_N29DoublyVirtuallyDiamondDerivedD1Ev128 (int (*)(...))DoublyVirtuallyDiamondDerived::_ZTv0_n24_N29DoublyVirtuallyDiamondDerivedD0Ev136 (int (*)(...))DoublyVirtuallyDiamondDerived::_ZTv0_n32_N29DoublyVirtuallyDiamondDerived1fEvDoublyVirtuallyDiamondDerived 中 VirtuallyDerived 的构造 vtableDoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived0_16VirtuallyDerived: 8u 个条目0 0u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI16VirtuallyDerived)40 0u48 0u56 (int (*)(...))VirtuallyDerived::fDoublyVirtuallyDiamondDerived 中 OtherVirtuallyDerived 的构造 vtableDoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived8_21OtherVirtuallyDerived: 15u 个条目0 18446744073709551608u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI21OtherVirtuallyDerived)40 0u48 0u56 (int (*)(...))OtherVirtuallyDerived::f64 8u72 8u80 (int (*)(...))888 (int (*)(...))(& _ZTI21OtherVirtuallyDerived)96 0u104 0u112 (int (*)(...))OtherVirtuallyDerived::_ZTv0_n32_N21OtherVirtuallyDerived1fEvVTT for DoublyVirtuallyDiamondDerivedDoublyVirtuallyDiamondDerived::_ZTT29DoublyVirtuallyDiamondDerived: 8u 个条目0 ((&DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u)8 ((&DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u)16 ((&DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u)24 ((&DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 120u)32 ((&DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u)40 ((&DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u)48 ((&DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 40u)56 ((&DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 96u)类 DoubleVirtuallyDiamondDerived尺寸=16 对齐=8基本尺寸=8 基本对齐=8DoublyVirtuallyDiamondDerived (0x0x7fd42c07ea10) 0 几乎为空vptridx=0u vptr=((&DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u)VirtuallyDerived (0x0x7fd42c02d478) 0 几乎为空的虚拟主要用于 DoublyVirtuallyDiamondDerived (0x0x7fd42c07ea10)subvttidx=32u vptridx=8u vbaseoffset=-48Base (0x0x7fd42c035a80) 0 几乎为空的虚拟主要用于 VirtuallyDerived (0x0x7fd42c02d478)vptridx=16u vbaseoffset=-40OtherVirtuallyDerived (0x0x7fd42c02d4e0) 8 几乎为空的虚拟失主subvttidx=48u vptridx=24u vbaseoffset=-56 vptr=((&DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 120u)基本 (0x0x7fd42c035a80) 替代路径MixedVirtuallyDerived 的 VtableMixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived: 13u 个条目0 8u8 (int (*)(...))016 (int (*)(...))(& _ZTI21MixedVirtuallyDerived)24 0u32 0u40 (int (*)(...))OtherBase::g48 0u56 18446744073709551608u64 (int (*)(...))-872 (int (*)(...))(& _ZTI21MixedVirtuallyDerived)80 0u88 0u96 (int (*)(...))__cxa_pure_virtual混合虚拟衍生的 VTTMixedVirtuallyDerived::_ZTT21MixedVirtuallyDerived: 2u 个条目0 ((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 24u)8 ((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 80u)类 MixedVirtuallyDerived尺寸=16 对齐=8基本尺寸=8 基本对齐=8MixedVirtuallyDerived (0x0x7fd42c07eee0) 0 几乎为空vptridx=0u vptr=((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 24u)Base (0x0x7fd42c035c60) 8 个几乎为空的虚拟vptridx=8u vbaseoffset=-24 vptr=((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 80u)OtherBase (0x0x7fd42c035cc0) 0 几乎为空主要用于 MixedVirtuallyDerived (0x0x7fd42c07eee0)MixedVirtuallyDiamondDerived 的 VtableMixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived: 15u 个条目0 0u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI28MixedVirtuallyDiamondDerived)40 (int (*)(...))MixedVirtuallyDiamondDerived::~MixedVirtuallyDiamondDerived48 (int (*)(...))MixedVirtuallyDiamondDerived::~MixedVirtuallyDiamondDerived56 (int (*)(...))MixedVirtuallyDiamondDerived::f64 (int (*)(...))MixedVirtuallyDiamondDerived::g72 18446744073709551608u80 (int (*)(...))-888 (int (*)(...))(& _ZTI28MixedVirtuallyDiamondDerived)96 (int (*)(...))MixedVirtuallyDiamondDerived::_ZThn8_N28MixedVirtuallyDiamondDerivedD1Ev104 (int (*)(...))MixedVirtuallyDiamondDerived::_ZThn8_N28MixedVirtuallyDiamondDerivedD0Ev112 (int (*)(...))MixedVirtuallyDiamondDerived::_ZThn8_N28MixedVirtuallyDiamondDerived1gEvMixedVirtuallyDiamondDerived 中 VirtuallyDerived(0x0x7fd42c02d750 实例)的构造 vtableMixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived0_16VirtuallyDerived: 8u 个条目0 0u8 0u16 0u24 (int (*)(...))032 (int (*)(...))(& _ZTI16VirtuallyDerived)40 0u48 0u56 (int (*)(...))VirtuallyDerived::fMixedVirtuallyDiamondDerived 中 MixedVirtuallyDerived(0x0x7fd42c0b5380 实例)的构造 vtableMixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived8_21MixedVirtuallyDerived: 13u 个条目0 18446744073709551608u8 (int (*)(...))016 (int (*)(...))(& _ZTI21MixedVirtuallyDerived)24 0u32 0u40 (int (*)(...))OtherBase::g48 0u56 8u64 (int (*)(...))872 (int (*)(...))(& _ZTI21MixedVirtuallyDerived)80 0u88 0u96 (int (*)(...))__cxa_pure_virtualVTT for MixedVirtuallyDiamondDerivedMixedVirtuallyDiamondDerived::_ZTT28MixedVirtuallyDiamondDerived: 7u 个条目0 ((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 40u)8 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u)16 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u)24 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived8_21MixedVirtuallyDerived) + 24u)32 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived8_21MixedVirtuallyDerived) + 80u)40 ((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 40u)48 ((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 96u)类 MixedVirtuallyDiamondDerived尺寸=16 对齐=8基本尺寸=16 基本对齐=8MixedVirtuallyDiamondDerived (0x0x7fd42c0b5310) 0vptridx=0u vptr=((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 40u)VirtuallyDerived (0x0x7fd42c02d750) 0 几乎为空主要用于 MixedVirtuallyDiamondDerived (0x0x7fd42c0b5310)subvttidx=8uBase (0x0x7fd42c035d20) 0 几乎为空的虚拟主要用于 VirtuallyDerived (0x0x7fd42c02d750)vptridx=40u vbaseoffset=-40MixedVirtuallyDerived (0x0x7fd42c0b5380) 8 几乎为空subvttidx=24u vptridx=48u vptr=((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 96u)基本 (0x0x7fd42c035d20) 替代路径OtherBase (0x0x7fd42c035d80) 8 几乎为空主要用于 MixedVirtuallyDerived (0x0x7fd42c0b5380)VirtuallyMultiplyDerived 的 VtableVirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived:16u 个条目0 8u8 0u16 0u24 0u32 (int (*)(...))040 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived)48 0u56 0u64 (int (*)(...))__cxa_pure_virtual72 0u80 18446744073709551608u88 (int (*)(...))-896 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived)104 0u112 0u120 (int (*)(...))OtherBase::gVirtuallyMultiplyDerived 的 VTTVirtuallyMultiplyDerived::_ZTT24VirtuallyMultiplyDerived:3u 个条目0 ((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 48u)8 ((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 48u)16 ((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 104u)类 VirtuallyMultiplyDerived尺寸=16 对齐=8基本尺寸=8 基本对齐=8VirtuallyMultiplyDerived (0x0x7fd42c0b59a0) 0 几乎为空vptridx=0u vptr=((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 48u)Base (0x0x7fd42c035e40) 0 几乎为空的虚拟主要用于 VirtuallyMultiplyDerived (0x0x7fd42c0b59a0)vptridx=8u vbaseoffset=-40OtherBase (0x0x7fd42c035ea0) 8 几乎为空的虚拟vptridx=16u vbaseoffset=-48 vptr=((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 104u)OtherVirtuallyMultiplyDerived 的 VtableOtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived: 16u 个条目0 8u8 0u16 0u24 0u32 (int (*)(...))040 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived)48 0u56 0u64 (int (*)(...))__cxa_pure_virtual72 0u80 18446744073709551608u88 (int (*)(...))-896 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived)104 0u112 0u120 (int (*)(...))OtherBase::g其他虚拟乘法衍生的 VTTOtherVirtuallyMultiplyDerived::_ZTT29OtherVirtuallyMultiplyDerived: 3u 个条目0 ((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 48u)8 ((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 48u)16 ((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 104u)类 OtherVirtuallyMultiplyDerived尺寸=16 对齐=8基本尺寸=8 基本对齐=8OtherVirtuallyMultiplyDerived (0x0x7fd42c0b5d90) 0 几乎为空vptridx=0u vptr=((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 48u)Base (0x0x7fd42c035f00) 0 几乎为空的虚拟主要用于 OtherVirtuallyMultiplyDerived (0x0x7fd42c0b5d90)vptridx=8u vbaseoffset=-40OtherBase (0x0x7fd42c035f60) 8 几乎为空的虚拟vptridx=16u vbaseoffset=-48 vptr=((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 104u)MultiplyVirtuallyDiamondDerived 的 VtableMultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived: 26u 个条目0 16u8 0u16 0u24 0u32 (int (*)(...))040 (int (*)(...))(& _ZTI31MultiplyVirtuallyDiamondDerived)48 (int (*)(...))MultiplyVirtuallyDiamondDerived::~MultiplyVirtuallyDiamondDerived56 (int (*)(...))MultiplyVirtuallyDiamondDerived::~MultiplyVirtuallyDiamondDerived64 (int (*)(...))MultiplyVirtuallyDiamondDerived::f72 (int (*)(...))MultiplyVirtuallyDiamondDerived::g80 8u88 18446744073709551608u96 18446744073709551608u104 18446744073709551608u112 (int (*)(...))-8120 (int (*)(...))(& _ZTI31MultiplyVirtuallyDiamondDerived)128 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZThn8_N31MultiplyVirtuallyDiamondDerivedD1Ev136 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZThn8_N31MultiplyVirtuallyDiamondDerivedD0Ev144 0u152 18446744073709551600u160 18446744073709551600u168(整数(*)(...))-16176(int(*)(...))(&_ZTI31MultiplyVirtuallyDiamondDerived)184 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZTv0_n24_N31MultiplyVirtuallyDiamondDerivedD1Ev192 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZTv0_n24_N31MultiplyVirtuallyDiamondDerivedD0Ev200 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZTv0_n32_N31MultiplyVirtuallyDiamondDerived1gEvMultiplyVirtuallyDiamondDerived 中 VirtuallyMultiplyDerived(0x0x7fd42bcdf230 实例)的构造 vtableMultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived: 16u 个条目0 16u8 0u16 0u24 0u32 (int (*)(...))040 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived)48 0u56 0u64 (int (*)(...))__cxa_pure_virtual72 0u80 18446744073709551600u88 (int (*)(...))-1696 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived)104 0u112 0u120 (int (*)(...))OtherBase::gMultiplyVirtuallyDiamondDerived 中 OtherVirtuallyMultiplyDerived(0x0x7fd42bcdf2a0 实例)的构造 vtableMultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived: 23u 个条目0 8u8 18446744073709551608u16 18446744073709551608u24 0u32 (int (*)(...))040 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived)48 0u56 0u64 (int (*)(...))__cxa_pure_virtual72 0u80 8u88 (int (*)(...))896 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived)104 0u112 0u120 (int (*)(...))__cxa_pure_virtual128 0u136 18446744073709551608u144(整数(*)(...))-8152 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived)160 0u168 0u176 (int (*)(...))OtherBase::gMultiplyVirtuallyDiamondDerived 的 VTTMultiplyVirtuallyDiamondDerived::_ZTT31MultiplyVirtuallyDiamondDerived: 10u 个条目0 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 48u)8 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived) + 48u)16 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived) + 48u)24 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived) + 104u)32 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived) + 48u)40 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived) + 104u)48 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived) + 160u)56 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 48u)64 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 184u)72 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 128u)类 MultiplyVirtuallyDiamondDerived大小=24 对齐=8基本尺寸=16 基本对齐=8MultiplyVirtuallyDiamondDerived (0x0x7fd42bcdf1c0) 0vptridx=0u vptr=((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 48u)VirtuallyMultiplyDerived (0x0x7fd42bcdf230) 0 几乎为空主要用于 MultiplyVirtuallyDiamondDerived (0x0x7fd42bcdf1c0)subvttidx=8uBase (0x0x7fd42bce2000) 0 几乎为空的虚拟主要用于 VirtuallyMultiplyDerived (0x0x7fd42bcdf230)vptridx=56u vbaseoffset=-40OtherBase (0x0x7fd42bce2060) 16 几乎为空的虚拟vptridx=64u vbaseoffset=-48 vptr=((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 184u)OtherVirtuallyMultiplyDerived (0x0x7fd42bcdf2a0) 8 几乎为空失主subvttidx=32u vptridx=72u vptr=((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 128u)基本 (0x0x7fd42bce2000) 替代路径OtherBase (0x0x7fd42bce2060) 替代路径I am looking for details of the VTable structure, order and contents, and the location of the vtable pointers within objects.
Ideally, this will cover single inheritance, multiple inheritance, and virtual inheritance.
References to external documentation would also be appreciated
Documentation of GCC 4.0x class layout is here and the Itanium, and more broadly GNU, ABI layout documents are here.
解决方案A virtual table is generally treated as an array of function pointers, although compilers are free to put data pointers (in MI and VI scenarios, or to typeinfos), integers (for fixups), or sentinel elements (such as NULL pointers) into it as well. The layout is generally compiler-specific (or ABI-specific where multiple C++ compilers share an ABI), but stable provided the classes being compiled have stable interfaces (otherwise you'd have to recompile your code all the time, and that's a drag). There are also additional tables that are needed to handle corner cases involving virtual and multiple inheritance, and to make sure that virtual calls during derived class construction behave as the Standard says they should under those circumstances (those are what the VTTs and construction tables in the output below are for).
As to the specific case of GCC 4.x: the -fdump-class-hierarchy
switch indeed acts as described (and then some). I tested it on Coliru using the sample code below:
struct Base
{
virtual ~Base() {}
virtual void f() = 0;
};
struct OtherBase
{
virtual ~OtherBase() {}
virtual void g() {}
};
struct Derived: public Base
{
virtual ~Derived() {}
virtual void f() {}
};
struct MultiplyDerived: public Base, public OtherBase
{
virtual ~MultiplyDerived() {}
virtual void f() {}
virtual void g() {}
};
struct OtherDerived: public Base
{
virtual ~OtherDerived() {}
virtual void f() {}
};
struct DiamondDerived: public Derived, public OtherDerived
{
virtual ~DiamondDerived() {}
virtual void f() {}
};
struct VirtuallyDerived: virtual public Base
{
virtual ~VirtuallyDerived() {}
virtual void f() {}
};
struct OtherVirtuallyDerived: virtual public Base
{
virtual ~OtherVirtuallyDerived() {}
virtual void f() {}
};
struct VirtuallyDiamondDerived: public VirtuallyDerived, public OtherVirtuallyDerived
{
virtual ~VirtuallyDiamondDerived() {}
virtual void f() {}
};
struct DoublyVirtuallyDiamondDerived: virtual public VirtuallyDerived, virtual public OtherVirtuallyDerived
{
virtual ~DoublyVirtuallyDiamondDerived() {}
virtual void f() {}
};
struct MixedVirtuallyDerived: virtual public Base, public OtherBase
{
virtual ~MixedVirtuallyDerived() {}
};
struct MixedVirtuallyDiamondDerived: public VirtuallyDerived, public MixedVirtuallyDerived
{
virtual ~MixedVirtuallyDiamondDerived() {}
virtual void f() {}
virtual void g() {}
};
struct VirtuallyMultiplyDerived: virtual public Base, virtual public OtherBase
{
virtual ~VirtuallyMultiplyDerived() {}
};
struct OtherVirtuallyMultiplyDerived: virtual public Base, virtual public OtherBase
{
virtual ~OtherVirtuallyMultiplyDerived() {}
};
struct MultiplyVirtuallyDiamondDerived: public VirtuallyMultiplyDerived, public OtherVirtuallyMultiplyDerived
{
virtual ~MultiplyVirtuallyDiamondDerived() {}
virtual void f() {}
virtual void g() {}
};
and received from G++ (mangled name guide: TI's are typeinfos, TV's are vtables, and Th's and Tv's are thunks used to make correct virtual calls in the presence of multiple and/or virtual inheritance):
Vtable for Base Base::_ZTV4Base: 5u entries 0 (int (*)(...))0 8 (int (*)(...))(& _ZTI4Base) 16 0u 24 0u 32 (int (*)(...))__cxa_pure_virtual Class Base size=8 align=8 base size=8 base align=8 Base (0x0x7fd42c0355a0) 0 nearly-empty vptr=((& Base::_ZTV4Base) + 16u) Vtable for OtherBase OtherBase::_ZTV9OtherBase: 5u entries 0 (int (*)(...))0 8 (int (*)(...))(& _ZTI9OtherBase) 16 (int (*)(...))OtherBase::~OtherBase 24 (int (*)(...))OtherBase::~OtherBase 32 (int (*)(...))OtherBase::g Class OtherBase size=8 align=8 base size=8 base align=8 OtherBase (0x0x7fd42c035600) 0 nearly-empty vptr=((& OtherBase::_ZTV9OtherBase) + 16u) Vtable for Derived Derived::_ZTV7Derived: 5u entries 0 (int (*)(...))0 8 (int (*)(...))(& _ZTI7Derived) 16 (int (*)(...))Derived::~Derived 24 (int (*)(...))Derived::~Derived 32 (int (*)(...))Derived::f Class Derived size=8 align=8 base size=8 base align=8 Derived (0x0x7fd42c02d138) 0 nearly-empty vptr=((& Derived::_ZTV7Derived) + 16u) Base (0x0x7fd42c035660) 0 nearly-empty primary-for Derived (0x0x7fd42c02d138) Vtable for MultiplyDerived MultiplyDerived::_ZTV15MultiplyDerived: 11u entries 0 (int (*)(...))0 8 (int (*)(...))(& _ZTI15MultiplyDerived) 16 (int (*)(...))MultiplyDerived::~MultiplyDerived 24 (int (*)(...))MultiplyDerived::~MultiplyDerived 32 (int (*)(...))MultiplyDerived::f 40 (int (*)(...))MultiplyDerived::g 48 (int (*)(...))-8 56 (int (*)(...))(& _ZTI15MultiplyDerived) 64 (int (*)(...))MultiplyDerived::_ZThn8_N15MultiplyDerivedD1Ev 72 (int (*)(...))MultiplyDerived::_ZThn8_N15MultiplyDerivedD0Ev 80 (int (*)(...))MultiplyDerived::_ZThn8_N15MultiplyDerived1gEv Class MultiplyDerived size=16 align=8 base size=16 base align=8 MultiplyDerived (0x0x7fd42c04aaf0) 0 vptr=((& MultiplyDerived::_ZTV15MultiplyDerived) + 16u) Base (0x0x7fd42c0356c0) 0 nearly-empty primary-for MultiplyDerived (0x0x7fd42c04aaf0) OtherBase (0x0x7fd42c035720) 8 nearly-empty vptr=((& MultiplyDerived::_ZTV15MultiplyDerived) + 64u) Vtable for OtherDerived OtherDerived::_ZTV12OtherDerived: 5u entries 0 (int (*)(...))0 8 (int (*)(...))(& _ZTI12OtherDerived) 16 (int (*)(...))OtherDerived::~OtherDerived 24 (int (*)(...))OtherDerived::~OtherDerived 32 (int (*)(...))OtherDerived::f Class OtherDerived size=8 align=8 base size=8 base align=8 OtherDerived (0x0x7fd42c02d1a0) 0 nearly-empty vptr=((& OtherDerived::_ZTV12OtherDerived) + 16u) Base (0x0x7fd42c035780) 0 nearly-empty primary-for OtherDerived (0x0x7fd42c02d1a0) Vtable for DiamondDerived DiamondDerived::_ZTV14DiamondDerived: 10u entries 0 (int (*)(...))0 8 (int (*)(...))(& _ZTI14DiamondDerived) 16 (int (*)(...))DiamondDerived::~DiamondDerived 24 (int (*)(...))DiamondDerived::~DiamondDerived 32 (int (*)(...))DiamondDerived::f 40 (int (*)(...))-8 48 (int (*)(...))(& _ZTI14DiamondDerived) 56 (int (*)(...))DiamondDerived::_ZThn8_N14DiamondDerivedD1Ev 64 (int (*)(...))DiamondDerived::_ZThn8_N14DiamondDerivedD0Ev 72 (int (*)(...))DiamondDerived::_ZThn8_N14DiamondDerived1fEv Class DiamondDerived size=16 align=8 base size=16 base align=8 DiamondDerived (0x0x7fd42c0625b0) 0 vptr=((& DiamondDerived::_ZTV14DiamondDerived) + 16u) Derived (0x0x7fd42c02d208) 0 nearly-empty primary-for DiamondDerived (0x0x7fd42c0625b0) Base (0x0x7fd42c0357e0) 0 nearly-empty primary-for Derived (0x0x7fd42c02d208) OtherDerived (0x0x7fd42c02d270) 8 nearly-empty vptr=((& DiamondDerived::_ZTV14DiamondDerived) + 56u) Base (0x0x7fd42c035840) 8 nearly-empty primary-for OtherDerived (0x0x7fd42c02d270) Vtable for VirtuallyDerived VirtuallyDerived::_ZTV16VirtuallyDerived: 8u entries 0 0u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI16VirtuallyDerived) 40 (int (*)(...))VirtuallyDerived::~VirtuallyDerived 48 (int (*)(...))VirtuallyDerived::~VirtuallyDerived 56 (int (*)(...))VirtuallyDerived::f VTT for VirtuallyDerived VirtuallyDerived::_ZTT16VirtuallyDerived: 2u entries 0 ((& VirtuallyDerived::_ZTV16VirtuallyDerived) + 40u) 8 ((& VirtuallyDerived::_ZTV16VirtuallyDerived) + 40u) Class VirtuallyDerived size=8 align=8 base size=8 base align=8 VirtuallyDerived (0x0x7fd42c02d2d8) 0 nearly-empty vptridx=0u vptr=((& VirtuallyDerived::_ZTV16VirtuallyDerived) + 40u) Base (0x0x7fd42c0358a0) 0 nearly-empty virtual primary-for VirtuallyDerived (0x0x7fd42c02d2d8) vptridx=8u vbaseoffset=-40 Vtable for OtherVirtuallyDerived OtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived: 8u entries 0 0u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI21OtherVirtuallyDerived) 40 (int (*)(...))OtherVirtuallyDerived::~OtherVirtuallyDerived 48 (int (*)(...))OtherVirtuallyDerived::~OtherVirtuallyDerived 56 (int (*)(...))OtherVirtuallyDerived::f VTT for OtherVirtuallyDerived OtherVirtuallyDerived::_ZTT21OtherVirtuallyDerived: 2u entries 0 ((& OtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived) + 40u) 8 ((& OtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived) + 40u) Class OtherVirtuallyDerived size=8 align=8 base size=8 base align=8 OtherVirtuallyDerived (0x0x7fd42c02d340) 0 nearly-empty vptridx=0u vptr=((& OtherVirtuallyDerived::_ZTV21OtherVirtuallyDerived) + 40u) Base (0x0x7fd42c035900) 0 nearly-empty virtual primary-for OtherVirtuallyDerived (0x0x7fd42c02d340) vptridx=8u vbaseoffset=-40 Vtable for VirtuallyDiamondDerived VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived: 16u entries 0 0u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI23VirtuallyDiamondDerived) 40 (int (*)(...))VirtuallyDiamondDerived::~VirtuallyDiamondDerived 48 (int (*)(...))VirtuallyDiamondDerived::~VirtuallyDiamondDerived 56 (int (*)(...))VirtuallyDiamondDerived::f 64 18446744073709551608u 72 18446744073709551608u 80 18446744073709551608u 88 (int (*)(...))-8 96 (int (*)(...))(& _ZTI23VirtuallyDiamondDerived) 104 (int (*)(...))VirtuallyDiamondDerived::_ZThn8_N23VirtuallyDiamondDerivedD1Ev 112 (int (*)(...))VirtuallyDiamondDerived::_ZThn8_N23VirtuallyDiamondDerivedD0Ev 120 (int (*)(...))VirtuallyDiamondDerived::_ZThn8_N23VirtuallyDiamondDerived1fEv Construction vtable for VirtuallyDerived (0x0x7fd42c02d3a8 instance) in VirtuallyDiamondDerived VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived0_16VirtuallyDerived: 8u entries 0 0u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI16VirtuallyDerived) 40 0u 48 0u 56 (int (*)(...))VirtuallyDerived::f Construction vtable for OtherVirtuallyDerived (0x0x7fd42c02d410 instance) in VirtuallyDiamondDerived VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived8_21OtherVirtuallyDerived: 15u entries 0 18446744073709551608u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI21OtherVirtuallyDerived) 40 0u 48 0u 56 (int (*)(...))OtherVirtuallyDerived::f 64 8u 72 8u 80 (int (*)(...))8 88 (int (*)(...))(& _ZTI21OtherVirtuallyDerived) 96 0u 104 0u 112 (int (*)(...))OtherVirtuallyDerived::_ZTv0_n32_N21OtherVirtuallyDerived1fEv VTT for VirtuallyDiamondDerived VirtuallyDiamondDerived::_ZTT23VirtuallyDiamondDerived: 7u entries 0 ((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 40u) 8 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived0_16VirtuallyDerived) + 40u) 16 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived0_16VirtuallyDerived) + 40u) 24 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 40u) 32 ((& VirtuallyDiamondDerived::_ZTC23VirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 96u) 40 ((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 40u) 48 ((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 104u) Class VirtuallyDiamondDerived size=16 align=8 base size=16 base align=8 VirtuallyDiamondDerived (0x0x7fd42c07e460) 0 vptridx=0u vptr=((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 40u) VirtuallyDerived (0x0x7fd42c02d3a8) 0 nearly-empty primary-for VirtuallyDiamondDerived (0x0x7fd42c07e460) subvttidx=8u Base (0x0x7fd42c035960) 0 nearly-empty virtual primary-for VirtuallyDerived (0x0x7fd42c02d3a8) vptridx=40u vbaseoffset=-40 OtherVirtuallyDerived (0x0x7fd42c02d410) 8 nearly-empty lost-primary subvttidx=24u vptridx=48u vptr=((& VirtuallyDiamondDerived::_ZTV23VirtuallyDiamondDerived) + 104u) Base (0x0x7fd42c035960) alternative-path Vtable for DoublyVirtuallyDiamondDerived DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived: 18u entries 0 8u 8 0u 16 0u 24 0u 32 0u 40 (int (*)(...))0 48 (int (*)(...))(& _ZTI29DoublyVirtuallyDiamondDerived) 56 (int (*)(...))DoublyVirtuallyDiamondDerived::~DoublyVirtuallyDiamondDerived 64 (int (*)(...))DoublyVirtuallyDiamondDerived::~DoublyVirtuallyDiamondDerived 72 (int (*)(...))DoublyVirtuallyDiamondDerived::f 80 18446744073709551608u 88 18446744073709551608u 96 18446744073709551608u 104 (int (*)(...))-8 112 (int (*)(...))(& _ZTI29DoublyVirtuallyDiamondDerived) 120 (int (*)(...))DoublyVirtuallyDiamondDerived::_ZTv0_n24_N29DoublyVirtuallyDiamondDerivedD1Ev 128 (int (*)(...))DoublyVirtuallyDiamondDerived::_ZTv0_n24_N29DoublyVirtuallyDiamondDerivedD0Ev 136 (int (*)(...))DoublyVirtuallyDiamondDerived::_ZTv0_n32_N29DoublyVirtuallyDiamondDerived1fEv Construction vtable for VirtuallyDerived in DoublyVirtuallyDiamondDerived DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived0_16VirtuallyDerived: 8u entries 0 0u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI16VirtuallyDerived) 40 0u 48 0u 56 (int (*)(...))VirtuallyDerived::f Construction vtable for OtherVirtuallyDerived in DoublyVirtuallyDiamondDerived DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived8_21OtherVirtuallyDerived: 15u entries 0 18446744073709551608u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI21OtherVirtuallyDerived) 40 0u 48 0u 56 (int (*)(...))OtherVirtuallyDerived::f 64 8u 72 8u 80 (int (*)(...))8 88 (int (*)(...))(& _ZTI21OtherVirtuallyDerived) 96 0u 104 0u 112 (int (*)(...))OtherVirtuallyDerived::_ZTv0_n32_N21OtherVirtuallyDerived1fEv VTT for DoublyVirtuallyDiamondDerived DoublyVirtuallyDiamondDerived::_ZTT29DoublyVirtuallyDiamondDerived: 8u entries 0 ((& DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u) 8 ((& DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u) 16 ((& DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u) 24 ((& DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 120u) 32 ((& DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u) 40 ((& DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u) 48 ((& DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 40u) 56 ((& DoublyVirtuallyDiamondDerived::_ZTC29DoublyVirtuallyDiamondDerived8_21OtherVirtuallyDerived) + 96u) Class DoublyVirtuallyDiamondDerived size=16 align=8 base size=8 base align=8 DoublyVirtuallyDiamondDerived (0x0x7fd42c07ea10) 0 nearly-empty vptridx=0u vptr=((& DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 56u) VirtuallyDerived (0x0x7fd42c02d478) 0 nearly-empty virtual primary-for DoublyVirtuallyDiamondDerived (0x0x7fd42c07ea10) subvttidx=32u vptridx=8u vbaseoffset=-48 Base (0x0x7fd42c035a80) 0 nearly-empty virtual primary-for VirtuallyDerived (0x0x7fd42c02d478) vptridx=16u vbaseoffset=-40 OtherVirtuallyDerived (0x0x7fd42c02d4e0) 8 nearly-empty virtual lost-primary subvttidx=48u vptridx=24u vbaseoffset=-56 vptr=((& DoublyVirtuallyDiamondDerived::_ZTV29DoublyVirtuallyDiamondDerived) + 120u) Base (0x0x7fd42c035a80) alternative-path Vtable for MixedVirtuallyDerived MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived: 13u entries 0 8u 8 (int (*)(...))0 16 (int (*)(...))(& _ZTI21MixedVirtuallyDerived) 24 0u 32 0u 40 (int (*)(...))OtherBase::g 48 0u 56 18446744073709551608u 64 (int (*)(...))-8 72 (int (*)(...))(& _ZTI21MixedVirtuallyDerived) 80 0u 88 0u 96 (int (*)(...))__cxa_pure_virtual VTT for MixedVirtuallyDerived MixedVirtuallyDerived::_ZTT21MixedVirtuallyDerived: 2u entries 0 ((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 24u) 8 ((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 80u) Class MixedVirtuallyDerived size=16 align=8 base size=8 base align=8 MixedVirtuallyDerived (0x0x7fd42c07eee0) 0 nearly-empty vptridx=0u vptr=((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 24u) Base (0x0x7fd42c035c60) 8 nearly-empty virtual vptridx=8u vbaseoffset=-24 vptr=((& MixedVirtuallyDerived::_ZTV21MixedVirtuallyDerived) + 80u) OtherBase (0x0x7fd42c035cc0) 0 nearly-empty primary-for MixedVirtuallyDerived (0x0x7fd42c07eee0) Vtable for MixedVirtuallyDiamondDerived MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived: 15u entries 0 0u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI28MixedVirtuallyDiamondDerived) 40 (int (*)(...))MixedVirtuallyDiamondDerived::~MixedVirtuallyDiamondDerived 48 (int (*)(...))MixedVirtuallyDiamondDerived::~MixedVirtuallyDiamondDerived 56 (int (*)(...))MixedVirtuallyDiamondDerived::f 64 (int (*)(...))MixedVirtuallyDiamondDerived::g 72 18446744073709551608u 80 (int (*)(...))-8 88 (int (*)(...))(& _ZTI28MixedVirtuallyDiamondDerived) 96 (int (*)(...))MixedVirtuallyDiamondDerived::_ZThn8_N28MixedVirtuallyDiamondDerivedD1Ev 104 (int (*)(...))MixedVirtuallyDiamondDerived::_ZThn8_N28MixedVirtuallyDiamondDerivedD0Ev 112 (int (*)(...))MixedVirtuallyDiamondDerived::_ZThn8_N28MixedVirtuallyDiamondDerived1gEv Construction vtable for VirtuallyDerived (0x0x7fd42c02d750 instance) in MixedVirtuallyDiamondDerived MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived0_16VirtuallyDerived: 8u entries 0 0u 8 0u 16 0u 24 (int (*)(...))0 32 (int (*)(...))(& _ZTI16VirtuallyDerived) 40 0u 48 0u 56 (int (*)(...))VirtuallyDerived::f Construction vtable for MixedVirtuallyDerived (0x0x7fd42c0b5380 instance) in MixedVirtuallyDiamondDerived MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived8_21MixedVirtuallyDerived: 13u entries 0 18446744073709551608u 8 (int (*)(...))0 16 (int (*)(...))(& _ZTI21MixedVirtuallyDerived) 24 0u 32 0u 40 (int (*)(...))OtherBase::g 48 0u 56 8u 64 (int (*)(...))8 72 (int (*)(...))(& _ZTI21MixedVirtuallyDerived) 80 0u 88 0u 96 (int (*)(...))__cxa_pure_virtual VTT for MixedVirtuallyDiamondDerived MixedVirtuallyDiamondDerived::_ZTT28MixedVirtuallyDiamondDerived: 7u entries 0 ((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 40u) 8 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u) 16 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived0_16VirtuallyDerived) + 40u) 24 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived8_21MixedVirtuallyDerived) + 24u) 32 ((& MixedVirtuallyDiamondDerived::_ZTC28MixedVirtuallyDiamondDerived8_21MixedVirtuallyDerived) + 80u) 40 ((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 40u) 48 ((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 96u) Class MixedVirtuallyDiamondDerived size=16 align=8 base size=16 base align=8 MixedVirtuallyDiamondDerived (0x0x7fd42c0b5310) 0 vptridx=0u vptr=((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 40u) VirtuallyDerived (0x0x7fd42c02d750) 0 nearly-empty primary-for MixedVirtuallyDiamondDerived (0x0x7fd42c0b5310) subvttidx=8u Base (0x0x7fd42c035d20) 0 nearly-empty virtual primary-for VirtuallyDerived (0x0x7fd42c02d750) vptridx=40u vbaseoffset=-40 MixedVirtuallyDerived (0x0x7fd42c0b5380) 8 nearly-empty subvttidx=24u vptridx=48u vptr=((& MixedVirtuallyDiamondDerived::_ZTV28MixedVirtuallyDiamondDerived) + 96u) Base (0x0x7fd42c035d20) alternative-path OtherBase (0x0x7fd42c035d80) 8 nearly-empty primary-for MixedVirtuallyDerived (0x0x7fd42c0b5380) Vtable for VirtuallyMultiplyDerived VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived: 16u entries 0 8u 8 0u 16 0u 24 0u 32 (int (*)(...))0 40 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived) 48 0u 56 0u 64 (int (*)(...))__cxa_pure_virtual 72 0u 80 18446744073709551608u 88 (int (*)(...))-8 96 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived) 104 0u 112 0u 120 (int (*)(...))OtherBase::g VTT for VirtuallyMultiplyDerived VirtuallyMultiplyDerived::_ZTT24VirtuallyMultiplyDerived: 3u entries 0 ((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 48u) 8 ((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 48u) 16 ((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 104u) Class VirtuallyMultiplyDerived size=16 align=8 base size=8 base align=8 VirtuallyMultiplyDerived (0x0x7fd42c0b59a0) 0 nearly-empty vptridx=0u vptr=((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 48u) Base (0x0x7fd42c035e40) 0 nearly-empty virtual primary-for VirtuallyMultiplyDerived (0x0x7fd42c0b59a0) vptridx=8u vbaseoffset=-40 OtherBase (0x0x7fd42c035ea0) 8 nearly-empty virtual vptridx=16u vbaseoffset=-48 vptr=((& VirtuallyMultiplyDerived::_ZTV24VirtuallyMultiplyDerived) + 104u) Vtable for OtherVirtuallyMultiplyDerived OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived: 16u entries 0 8u 8 0u 16 0u 24 0u 32 (int (*)(...))0 40 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived) 48 0u 56 0u 64 (int (*)(...))__cxa_pure_virtual 72 0u 80 18446744073709551608u 88 (int (*)(...))-8 96 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived) 104 0u 112 0u 120 (int (*)(...))OtherBase::g VTT for OtherVirtuallyMultiplyDerived OtherVirtuallyMultiplyDerived::_ZTT29OtherVirtuallyMultiplyDerived: 3u entries 0 ((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 48u) 8 ((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 48u) 16 ((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 104u) Class OtherVirtuallyMultiplyDerived size=16 align=8 base size=8 base align=8 OtherVirtuallyMultiplyDerived (0x0x7fd42c0b5d90) 0 nearly-empty vptridx=0u vptr=((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 48u) Base (0x0x7fd42c035f00) 0 nearly-empty virtual primary-for OtherVirtuallyMultiplyDerived (0x0x7fd42c0b5d90) vptridx=8u vbaseoffset=-40 OtherBase (0x0x7fd42c035f60) 8 nearly-empty virtual vptridx=16u vbaseoffset=-48 vptr=((& OtherVirtuallyMultiplyDerived::_ZTV29OtherVirtuallyMultiplyDerived) + 104u) Vtable for MultiplyVirtuallyDiamondDerived MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived: 26u entries 0 16u 8 0u 16 0u 24 0u 32 (int (*)(...))0 40 (int (*)(...))(& _ZTI31MultiplyVirtuallyDiamondDerived) 48 (int (*)(...))MultiplyVirtuallyDiamondDerived::~MultiplyVirtuallyDiamondDerived 56 (int (*)(...))MultiplyVirtuallyDiamondDerived::~MultiplyVirtuallyDiamondDerived 64 (int (*)(...))MultiplyVirtuallyDiamondDerived::f 72 (int (*)(...))MultiplyVirtuallyDiamondDerived::g 80 8u 88 18446744073709551608u 96 18446744073709551608u 104 18446744073709551608u 112 (int (*)(...))-8 120 (int (*)(...))(& _ZTI31MultiplyVirtuallyDiamondDerived) 128 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZThn8_N31MultiplyVirtuallyDiamondDerivedD1Ev 136 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZThn8_N31MultiplyVirtuallyDiamondDerivedD0Ev 144 0u 152 18446744073709551600u 160 18446744073709551600u 168 (int (*)(...))-16 176 (int (*)(...))(& _ZTI31MultiplyVirtuallyDiamondDerived) 184 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZTv0_n24_N31MultiplyVirtuallyDiamondDerivedD1Ev 192 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZTv0_n24_N31MultiplyVirtuallyDiamondDerivedD0Ev 200 (int (*)(...))MultiplyVirtuallyDiamondDerived::_ZTv0_n32_N31MultiplyVirtuallyDiamondDerived1gEv Construction vtable for VirtuallyMultiplyDerived (0x0x7fd42bcdf230 instance) in MultiplyVirtuallyDiamondDerived MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived: 16u entries 0 16u 8 0u 16 0u 24 0u 32 (int (*)(...))0 40 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived) 48 0u 56 0u 64 (int (*)(...))__cxa_pure_virtual 72 0u 80 18446744073709551600u 88 (int (*)(...))-16 96 (int (*)(...))(& _ZTI24VirtuallyMultiplyDerived) 104 0u 112 0u 120 (int (*)(...))OtherBase::g Construction vtable for OtherVirtuallyMultiplyDerived (0x0x7fd42bcdf2a0 instance) in MultiplyVirtuallyDiamondDerived MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived: 23u entries 0 8u 8 18446744073709551608u 16 18446744073709551608u 24 0u 32 (int (*)(...))0 40 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived) 48 0u 56 0u 64 (int (*)(...))__cxa_pure_virtual 72 0u 80 8u 88 (int (*)(...))8 96 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived) 104 0u 112 0u 120 (int (*)(...))__cxa_pure_virtual 128 0u 136 18446744073709551608u 144 (int (*)(...))-8 152 (int (*)(...))(& _ZTI29OtherVirtuallyMultiplyDerived) 160 0u 168 0u 176 (int (*)(...))OtherBase::g VTT for MultiplyVirtuallyDiamondDerived MultiplyVirtuallyDiamondDerived::_ZTT31MultiplyVirtuallyDiamondDerived: 10u entries 0 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 48u) 8 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived) + 48u) 16 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived) + 48u) 24 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived0_24VirtuallyMultiplyDerived) + 104u) 32 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived) + 48u) 40 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived) + 104u) 48 ((& MultiplyVirtuallyDiamondDerived::_ZTC31MultiplyVirtuallyDiamondDerived8_29OtherVirtuallyMultiplyDerived) + 160u) 56 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 48u) 64 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 184u) 72 ((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 128u) Class MultiplyVirtuallyDiamondDerived size=24 align=8 base size=16 base align=8 MultiplyVirtuallyDiamondDerived (0x0x7fd42bcdf1c0) 0 vptridx=0u vptr=((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 48u) VirtuallyMultiplyDerived (0x0x7fd42bcdf230) 0 nearly-empty primary-for MultiplyVirtuallyDiamondDerived (0x0x7fd42bcdf1c0) subvttidx=8u Base (0x0x7fd42bce2000) 0 nearly-empty virtual primary-for VirtuallyMultiplyDerived (0x0x7fd42bcdf230) vptridx=56u vbaseoffset=-40 OtherBase (0x0x7fd42bce2060) 16 nearly-empty virtual vptridx=64u vbaseoffset=-48 vptr=((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 184u) OtherVirtuallyMultiplyDerived (0x0x7fd42bcdf2a0) 8 nearly-empty lost-primary subvttidx=32u vptridx=72u vptr=((& MultiplyVirtuallyDiamondDerived::_ZTV31MultiplyVirtuallyDiamondDerived) + 128u) Base (0x0x7fd42bce2000) alternative-path OtherBase (0x0x7fd42bce2060) alternative-path
相关文章