19

I want to see how g++ lays out memory for classes and virtual tables.

Is there a way to dump this information, using g++'s options?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Aman Jain
  • 10,927
  • 15
  • 50
  • 63

1 Answers1

27

g++ -fdump-class-hierarchy -c source_file.cpp

ecatmur
  • 152,476
  • 27
  • 293
  • 366
Artem Sokolov
  • 13,196
  • 4
  • 43
  • 74
  • 4
    Note that in g++ 8 this flag was switched to _-fdump-lang-class_. This also works for g++ 9. See https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Developer-Options.html – daniglezad Apr 25 '21 at 10:05