c++/2152: set print object on does not work

christophe barbe cbarbe@obj-sys.com
Fri Aug 4 15:08:00 GMT 2006

The following reply was made to PR c++/2152; it has been noted by GNATS.

From: christophe barbe <cbarbe@obj-sys.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-gnats@sources.redhat.com
Subject: Re: c++/2152: set print object on does not work
Date: Fri, 04 Aug 2006 11:00:46 -0400

 Thanks Daniel,
 I was trying to produce a test case for eclipse/CDT which use gdb and
 thought I had figured the root of the problem. But it looks like it's
 not the case. I guess they don't simply parse the output of gdb's print
 as the "set print object" has no effect on CDT.
 Can you close my bug report? It does not look like I can do it.
 Thanks again and sorry for the bogus bug report,
 On Fri, 2006-08-04 at 10:41 -0400, Daniel Jacobowitz wrote:
 > On Fri, Aug 04, 2006 at 02:22:34PM -0000, cbarbe@obj-sys.com wrote:
 > > "set print object on" does not work. See below gdb session running the attached test case. 
 > This is, actually, not a bug.  However, the documentation could be
 > clearer.  GDB can only use RTTI type information when it is available;
 > in this example, it is not.
 > Not every type has RTTI.  It's only emitted for types which need it,
 > for instance types with virtual functions.  In general, if there's no
 > way to get different behavior from an A* because it's really a B*, then
 > there's no way to determine the runtime type.
 > Take a look at this:
 > (gdb) ptype A
 > type = class A {
 >   public:
 >     int a1;
 >   protected:
 >     int a2;
 >   public:
 >     A(void);
 > }
 > (gdb) p sizeof(A)
 > $3 = 8
 > No extra data in the object, so there's nowhere to stash an RTTI
 > pointer.
 Christophe Barbe - Software Engineer
 Objective Systems, Inc.
 Tel: +1 (484) 875-9841
 Fax: +1 (484) 875-9830
 Toll-free: (877) 307-6855 (USA only)

More information about the Gdb-prs mailing list