Getting to the source for a given C++ object

Jason Molenda jmolenda@apple.com
Wed Aug 10 20:35:00 GMT 2005


On Aug 10, 2005, at 10:17 AM, Alex Bennee wrote:

> I'm currently trying to debug a C++ program that makes heavy use of
> templates and derived classes. Is there an easy way to get to the  
> actual
> code for a given class pointer?


I'm not sure  exactly what you're looking for.  ptype can tell you  
the class - is that what you want?  e.g.

(gdb) p beta
$1 = {<A> = {_vptr$A = 0x30b0, a1 = 200}, b1 = 201, b2 = 202}
(gdb) ptype beta
type = class B : public A {
   public:
     int b1;
     int b2;

     B(B const&);
     B(B const&);
     B();
     B();
     ~B();
     virtual ~B();
     virtual ~B();
}
(gdb)


J



More information about the Gdb mailing list