This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: print/x on references
- From: Daniel Jacobowitz <drow at false dot org>
- To: Paul Hilfinger <Hilfinger at adacore dot com>
- Cc: gdb at sourceware dot org
- Date: Thu, 18 Oct 2007 07:16:44 -0400
- Subject: Re: print/x on references
- References: <20071018093736.8076A48CB9C@nile.gnat.com>
On Thu, Oct 18, 2007 at 05:37:36AM -0400, Paul Hilfinger wrote:
>
> Currently, there is a slight discrepancy in the behavior of formatted print
> commands. Stop the program below in f. At that point, we see the
> following behavior:
>
> (gdb) p x
> $4 = (Glorp &) @0x8049850: {x = 1, y = 2}
> (gdb) p/x x
> $5 = 0x8049850
>
> Is there any particular reason these two cases shouldn't have the same
> behavior? It seems that printcmd.c:print_formatted is conflating the
> cases of C++ pointers and C++ references, and I don't see the justification
> for doing so.
Well, what's the right behavior? I'm not thrilled with the current
behavior either, but I don't want to make it too hard to get at the
reference's "value" i.e. pointer. In C++ you never (are supposed to)
need that, but while debugging is in my opinion a different story.
--
Daniel Jacobowitz
CodeSourcery