This is the mail archive of the
mailing list for the GDB project.
C++ Q on types
- To: GDB Discussion <gdb at sourceware dot cygnus dot com>
- Subject: C++ Q on types
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 15 Jan 2001 23:11:53 +1100
- Cc: haberg at matematik dot su dot se
> A user (firstname.lastname@example.org) sent me this explanation of a feature
> in some other debuggers:
> C++ has makes available various runtime information (RTTI). C++ has a
> single one form of a polymorphic variable, or an object which can change
> its type at runtime, namely the polymorphic pointer: If one has a class A
> and derives from it a class B, then one can write
> A* ap = new B();
> The static type pointer to an A named ap now points to a dynamically
> allocated B pointer. It means that in the C++ static typing, this is just
> an ap pointer, but C++ has mechanism for keeping track of the dynamic
> type B, for example, via "virtual functions", or by using C++ RTTI...
> Now to the debugging: If the debugger only handles C++ static typing, it
> will show that ap is an A, and will only display that structure of it
> (the names in that class and their values).
> But if the debugger handles C++ dynamic data, it will show that the ap is
> actually a B, and will show that (the names in that class B and their
> Does GDB have the ability to determine the actual type
> of *ap, and display it accordingly?
Something for TODO?