Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Thiago Jung Bauermann <bauerman@br.ibm.com>,
	gdb-patches@sourceware.org,
	Jan Kratochvil <jan.kratochvil@redhat.com>,
	Eli Zaretskii <eliz@gnu.org>
Subject: Re: [patch 2/3] Implement support for PowerPC BookE ranged watchpoints
Date: Tue, 28 Dec 2010 16:42:00 -0000	[thread overview]
Message-ID: <201012281609.49044.pedro@codesourcery.com> (raw)
In-Reply-To: <20101228050042.GB2596@adacore.com>

On Tuesday 28 December 2010 05:00:42, Joel Brobecker wrote:
> > +/* Return true if TYPE is scalar.  */
> > +
> > +int
> > +is_scalar_type (struct type *type)
> > +{
> > +  CHECK_TYPEDEF (type);
> > +
> > +  while (TYPE_CODE (type) == TYPE_CODE_REF)
> > +    {
> > +      type = TYPE_TARGET_TYPE (type);
> > +      CHECK_TYPEDEF (type);
> > +    }
> 
> I suggest you make it explicit how TYPE_CODE_REF types are handled.
> In certain cases, I think it might be making a difference (a REF
> to a struct might have a different classification than the struct
> in terms of argument passing, for instance).

Yeah.  For watching purposes, you want to consider the
reference, or really, its underlying pointer representation
as a scalar, nomatter what the reference is bound to.  Let me
try to clarify:

 int i;
 int &ref = i;

Currently, a watchpoint on "ref" only monitors changes
for the address stored in the reference-as-pointer.
So, for exact-watchpoint's purposes, when considering
individual pieces/locations of an expression to watch, the
TYPE_CODE_REF alone is a scalar, even if its target type
is a structure.
I've just tried "watch ref" per above, and I'm surprised, since
I thought a watchpoint on "ref" actually monitored two locations:
the underlying address stored in "ref"; and its target
value, similarly to watching '*ptr' in "int i; int *ptr= &i;".
I think we can actually call this a bug...

Contrast with valprint's purposes, where what matters
is the reference's target type, what the user sees.

-- 
Pedro Alves


  reply	other threads:[~2010-12-28 16:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 21:52 Thiago Jung Bauermann
2010-11-23 23:17 ` Pedro Alves
2010-11-24 21:06   ` Thiago Jung Bauermann
2010-11-25 17:32     ` Pedro Alves
2010-11-26 11:09       ` Eli Zaretskii
2010-11-27 13:25         ` Thiago Jung Bauermann
2010-11-27 15:28           ` Eli Zaretskii
2010-11-26 21:15       ` Thiago Jung Bauermann
2010-11-27 17:47         ` Pedro Alves
2010-11-27 18:01           ` Pedro Alves
2010-12-09  1:44           ` Thiago Jung Bauermann
2010-12-23 19:07           ` Thiago Jung Bauermann
2010-12-23 19:13             ` Eli Zaretskii
2010-12-23 20:17               ` Thiago Jung Bauermann
2010-12-23 22:18             ` Pedro Alves
2010-12-24  5:10               ` Joel Brobecker
2010-12-25 14:13               ` Eli Zaretskii
2010-12-27 20:18                 ` Thiago Jung Bauermann
2010-12-28  2:30               ` Thiago Jung Bauermann
2010-12-28  5:47                 ` Joel Brobecker
2010-12-28 16:42                   ` Pedro Alves [this message]
2010-12-28 16:10                 ` Pedro Alves
2010-12-29  1:00                   ` Thiago Jung Bauermann
2010-11-26 10:59 ` Eli Zaretskii

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=201012281609.49044.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=bauerman@br.ibm.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /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