Re: virtual method structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fabian Cenedese <Cenedese@xxxxxxxx> writes:

> This question may not be about gcc per se, but closely. I'm using gcc
> with stabs info and am trying to make heads about the information of
> (virtual) methods. There's a structure with the needed info but I couldn't
> find on the net a description. Everywhere it just says:
>
> << In boilerplate $vtbl_ptr_type, what are the fields delta, index,
> pfn and delta2 used for? >>
>  
> So is there somewhere a description of these fields? I would like to
> get the address of a virtual method of an object (so pObj->vptr->index
> ->method or something like that).

A virtual table is just a list of function pointers; you can think of
as a struct whose fields have the type of pointers to functions
implementing the methods.

Perhaps you are looking at a pointer-to-member?  Or a thunk, which is
a bit of code used for multiple inheritance?

In this context, "delta" is typically the offset from the start of the
object to the start of the object from which the method is inherited.
That is, normally delta == 0, but in cases of multiple inheritance it
may have a non-zero value.

The "index" field is presumably the index into the virtual table.

Sorry, I don't know what pfn or delta2 are without more context.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux