Is there a flag in g++
or tools to dump the member variables of a struct/class? To illustrate, consider source code like this
struct A { virtual void m() {}; };
struct B : public A { int b; virtual void n() = 0; };
struct C : public B { int c1, c2; void o(); };
struct D : public C { virtual void n() {}; A d; };
I want to get something similar to
A: 0 = (vptr)
B: 0 = (vptr)
4 = b
C: 0 = (vptr)
4 = b
8 = c1
12 = c2
D: 0 = (vptr)
4 = b
8 = c1
12 = c2
16 = d
(-fdump-class-hierarchy
does not work. It only prints the member functions.)
(Assume I don't know the classes A
to D
, or there are so many classes that I don't want to list them out myself.)
(Specifically, I want to dump the member variables of http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/iokit/IOKit/IOUserClient.h).