From: "Douglas Evans" <dje@google.com>
To: "Paul Hilfinger" <Hilfinger@adacore.com>, gdb@sourceware.org
Subject: Re: print/x on references
Date: Thu, 18 Oct 2007 16:05:00 -0000 [thread overview]
Message-ID: <e394668d0710180904v178974d6vaa178a7aff7ddbcf@mail.gmail.com> (raw)
In-Reply-To: <20071018111644.GA32574@caradoc.them.org>
On 10/18/07, Daniel Jacobowitz <drow@false.org> wrote:
> 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.
(gdb) p/x x -> prints same as $4 but in hex
(gdb) p &x -> prints pointer (e.g. "$5 = (Glorp *) 0x8049850")
$0.02
next prev parent reply other threads:[~2007-10-18 16:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-18 9:37 Paul Hilfinger
2007-10-18 11:16 ` Daniel Jacobowitz
2007-10-18 16:05 ` Douglas Evans [this message]
2007-10-18 16:30 ` Daniel Jacobowitz
2007-10-18 17:03 ` Douglas Evans
2007-10-18 17:10 ` Douglas Evans
2007-10-18 17:11 ` Daniel Jacobowitz
2007-10-18 17:45 ` Douglas Evans
2007-10-18 19:10 ` Paul Hilfinger
2007-10-18 19:21 ` Daniel Jacobowitz
2007-10-18 19:30 ` Paul Hilfinger
2007-10-18 19:39 ` Daniel Jacobowitz
2007-10-19 21:40 ` Jim Blandy
2007-10-19 22:00 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e394668d0710180904v178974d6vaa178a7aff7ddbcf@mail.gmail.com \
--to=dje@google.com \
--cc=Hilfinger@adacore.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).