[llvm-dev] Determine the offset of a vtable ptr

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Fri May 3 01:46:48 PDT 2019


On Fri, 3 May 2019 at 09:32, Gaier, Bjoern <Bjoern.Gaier at horiba.com> wrote:
> > There's nothing in Module to help you determine the offsets
> Isn't it possible to access structures and there members via llvm::Module? So wouldn't I be able to find the vtables there?

If you've got a pointer to a class then you can use IRBuilder to
access its vtable (assuming you know the offset in the object) and
functions within that vtable. At the Module level if you know the
specific class you want a vtable for you can get it by name (e.g.
@_ZTV3Foo for "struct Foo").

Cheers.

Tim.


More information about the llvm-dev mailing list