public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@codesourcery.com>
To: Douglas Evans <dje@google.com>
Cc: Paul Hilfinger <Hilfinger@adacore.com>,  gdb@sourceware.org
Subject: Re: print/x on references
Date: Fri, 19 Oct 2007 21:40:00 -0000	[thread overview]
Message-ID: <m3r6jq941b.fsf@codesourcery.com> (raw)
In-Reply-To: <20071018192103.GA31401@caradoc.them.org> (Daniel Jacobowitz's message of "Thu, 18 Oct 2007 15:21:03 -0400")


Daniel Jacobowitz <drow at false.org> writes:
> On Thu, Oct 18, 2007 at 10:45:14AM -0700, Douglas Evans wrote:
>> fwiw,
>> I think the expression evaluator should work as the language does (as
>> much as possible).  And once it does that then thought is given to
>> whatever extensions are needed to accomplish things not possible with
>> the language syntax.
>> e.g. "p cut-n-pasted-expression-from-source" should "just work" (to
>> some reasonable extent).
>> 
>> Given that, to me "p &cref" -> (c*) and not (c**) follows naturally
>> out of c++ syntax.  Whatever goop we want to add to get at the address
>> of the object containing the reference is separate.  "p &(&cref)" is
>> the first thing that came to mind and wonderfully it "just worked".
>> One may want a different (or additional) way to achieve this of
>> course, but it should not break "p &cref" -> (c*).
>
> That is an excellent explanation.  You've convinced me.

It turns out this is actually documented in the manual:

File: gdb.info,  Node: C Operators

...

`&'
     Address operator.  Defined on variables.  Same precedence as `++'.

     For debugging C++, GDB implements a use of `&' beyond what is
     allowed in the C++ language itself: you can use `&(&REF)' (or, if
     you prefer, simply `&&REF') to examine the address where a C++
     reference variable (declared with `&REF') is stored.

  parent reply	other threads:[~2007-10-19 21:40 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
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 [this message]
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=m3r6jq941b.fsf@codesourcery.com \
    --to=jimb@codesourcery.com \
    --cc=Hilfinger@adacore.com \
    --cc=dje@google.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).