Vaclav Haisman
12/16/2008 11:04:00 AM
Ripunjay Tripathi wrote, On 16.12.2008 8:11:
> In a g++ compiler "fdump-class-hierarchy" can be used to analyze the
> dump of inheritance hierarchy.
>
> My real aim is to study virtual table implementation, and memory
> organization of virtual inheritance thing. However, I am NOT able to
> read and understand the offsets and codes. Can anyone here please give
> me a pointer where can I get material to study all this.
>
> I also sincerely apologize if this is a wrong place for this query -
>
>
> example dump is -
>
> Class D
> size=4 align=4
> base size=4 base align=4
> D (0xb6b8fe00) 0
>
> Class A
> size=4 align=4
> base size=4 base align=4
> A (0xb6b8fec0) 0
>
> Class B
> size=4 align=4
> base size=4 base align=4
> B (0xb6b8ff00) 0
>
> Vtable for C
> C::_ZTV1C: 3u entries
> 0 16u
> 4 (int (*)(...))0
> 8 (int (*)(...))(& _ZTI1C)
>
> VTT for C
> C::_ZTT1C: 1u entries
> 0 ((& C::_ZTV1C) + 12u)
>
> Class C
> size=20 align=4
> base size=16 base align=4
> C (0xb6b8ff40) 0
> vptridx=0u vptr=((& C::_ZTV1C) + 12u)
> B (0xb6b8ff80) 16 virtual
> vbaseoffset=-0x00000000c
> A (0xb6b8ffc0) 4
>
> 1) Whats 3u, 1u, 12u here ?
Unsigned integer values. 3, 1 and 12.
> 2) What is _ZTT1C ?
shell::wilx:~> c++filt _ZTT1C
VTT for C
For more details you will have to read either the GCC internals documentation
or directly its code.
> 3) What is vptridx ? (v pointer index I guess)
I guess it has something to do with possible multiple virtual methods tables.
>
>
> Regards,
> Ripunjay Tripathi
>
--
VH