[cxx-abi-dev] Finding the type of a virtual table
Jason Merrill
jason at redhat.com
Fri May 17 20:54:58 UTC 2002
>>>>> <Kevin.Backhouse at arm.com> writes:
> For the purposes of performing a static analysis, I am interested to know
> whether it is possible to determine the type of an object by looking at its
> vtable. VTables contain RTTI information so it ought to be possible, but I
> am unsure about secondary vtables and I wonder if anyone can help.
> To illustrate, here is an example of a class hierarchy:
> class A
> class B
> class C : A, B
> class D : B, C
> If I understand the C++ ABI for Itanium correctly, class D will have the
> following vtables:
> D's primary vtable (which extends B's vtable)
> Secondary vtable for C in D (which extends A's vtable)
> Secondary vtable for B in C in D
> Given (say) the secondary vtable for B in C in D and nothing else, is it
> possible to determine that objects with this vtable have type B?
Why would you want to? The only way to get at that vtable would be through
a pointer of type B*. If you're using a B*, then you know that the
(sub)object referred to has type B.
Can you be more specific about the analysis you're trying to perform?
Jason
More information about the cxx-abi-dev
mailing list