Link to home
Start Free TrialLog in
Avatar of ambuli
ambuliFlag for United States of America

asked on

How to intepret output from gcc fdump-class-hierarchy option

I have a simple class and wanted to study how it is organized into memory.
How can I interpret the following which was produced by using -fdump-class-hierarchy option in gcc.

Basically, I want to know where the vptr will be located in relation to the array for example.

Vtable for A
A::_ZTV1A: 3u entries
0     (int (*)(...))0
4     (int (*)(...))(& _ZTI1A)
8     A::SendCommand

Class A
   size=48 align=4
   base size=48 base align=4
A (0x223a600) 0
    vptr=((& A::_ZTV1A) + 8u)

Open in new window


class A
{
	public:
		A() { cout << "A's Constructor" << endl; };
		virtual void SendCommand(){};
		void setArray()
		{
			for(int i =0; i < 10; i++ )
			{
				m_array[i] = 'A';
			};
		};
	private:
		int m_a;
		int m_array[MAX_ARRAY];
};

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ambuli

ASKER

Great! Thank you.