[llvm-dev] Dumping the Vtable
Hans Wennborg via llvm-dev
llvm-dev at lists.llvm.org
Tue May 30 09:56:03 PDT 2017
Hi Damilola,
On Mon, May 29, 2017 at 5:20 AM, Damilola Orikogbo via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Can someone help me with how to dump the vtable and the vptr addresses
> within it?
I'm not sure if this answers your question exactly, but you can pass
"-Xclang -fdump-vtable-layouts" to ask Clang to dump the layout of
generated vtables. For example:
$ cat /tmp/a.cc
struct S {
virtual void f() {};
};
void f(S * s) {
s->f();
}
$ bin/clang++ -c /tmp/a.cc -Xclang -fdump-vtable-layouts
Vtable for 'S' (3 entries).
0 | offset_to_top (0)
1 | S RTTI
-- (S, 0) vtable address --
2 | void S::f()
VTable indices for 'S' (1 entries).
0 | void S::f()
- Hans
More information about the llvm-dev
mailing list