This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]