Re: Getting to the source for a given C++ object

Jason Molenda
2005-08-10T20:35:39Z

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 = { = {_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