getting subclass type from base class pointer

Paul Marquess Paul.Marquess@owmobility.com
Fri Oct 30 11:26:00 GMT 2015


From: André Pönitz [mailto:apoenitz@t-online.de] 
 
> On Thu, Oct 29, 2015 at 11:38:27PM +0000, Paul Marquess wrote:
> > > gdb) python x = gdb.parse_and_eval("pTest")
> > > (gdb) python print x.type
> > > SuperClass *
> 
> (gdb) python print(x.type)
> SuperClass *
> (gdb) python print(x.dynamic_type)
> SubClass *

Bingo! That did it.

Hmm, could have sworn that I tried that myself (but obviously I'm deluding myself).

Thanks for the help
Paul



More information about the Gdb mailing list