RE: getting subclass type from base class pointer

Paul Marquess <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CY1PR0501MB1178E91C5866A870CEC3854F952F0@CY1PR0501MB1178.namprd05.prod.outlook.com>
From: André Pönitz [mailto:[email protected]] 
 
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.