Is there a way to print the layout of a C++ object using the g++ compiler or any other means. A simplified example (assuming int takes 4 bytes)
class A{
int a;
};
class B:public A{
int b;
}
so the output would be
A-
0 4
+ a +
B-
0 4 8
+ A.a + b +
It would be useful to understand the layout of objects (in my case virtual machine code).
Thanks in advance.
Regards, Zaheer