Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the VTABLE of a C++ class through GCC?

I understand that a class will have a VTABLE, if it contains at-least one virtual function. I would like to see the contents of the VTABLE. Is there a way to display it ?

Specifically, is there an option in gcc to display the VTABLE of a class?

like image 235
nitin_cherian Avatar asked Jan 22 '12 07:01

nitin_cherian


1 Answers

If the input file is say layout.cpp, the command gcc -fdump-class-hierarchy layout.cpp will produce a file layout.cpp.class. This file will display the VTABLE along with some other useful information.

like image 164
nitin_cherian Avatar answered Sep 17 '22 02:09

nitin_cherian