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: gdb-patches@sourceware.org
Subject: Re: [RFA/RFC] Restore old handling of multi-register variables
Date: Tue, 25 Oct 2011 21:09:00 -0000	[thread overview]
Message-ID: <201110252149.34078.pedro@codesourcery.com> (raw)
In-Reply-To: <20111025203022.GQ19246@adacore.com>

On Tuesday 25 October 2011 21:30:22, Joel Brobecker wrote:
> Hi Pedro,
> 
> Thanks for the review. One question:
> 
> > > +/* VALUE must be an lval_register value.  If regnum is the value's
> > > +   associated register number, and len the length of the values type,
> > > +   read one or more registers in FRAME, starting with register REGNUM,
> > > +   until we've read LEN bytes.  */
> > > +
> > > +void
> > > +read_frame_register_value (struct value *value, struct frame_info *frame)
> > 
> > I think this should be in frame.c instead.  value.c is for core
> > struct value stuff.
> 
> That's what I thought originally too.  The reason why I didn't put
> that function there is because I thought that the only way to access
> some of the fields was by using the deprecated_[...]_hack functions.
> So I thought we weren't supposed to be able to access those components
> of a struct value.  But looking closer, I think I get the reason why
> it's called a hack and deprecated - it's to allow the previous usage
> of using the VALUE_something macros to change the value of the
> associated component. So I'm assuming that...
> 
>         regnum = VALUE_REGNUM (val)
> 
> ... is OK. While...
> 
>         VALUE_REGNUM (val) = regnum
> 
> ... is definitely frowned upon.

Correct.  Ideally we'd replace those hacks by separate 
setter and a getter, or better yet, see if we can get
rid of the need to have a setter.  VALUE_REGNUM as an
rval is definitely okay, as an lval, not so okay.

> I will make that change if you agree.
> 
> > > +  const int len = TYPE_LENGTH (value_type (value));
> > 
> > Do we need check_typedefs here?
> 
> I haven't faced a situation where this might make a difference,
> but I think you are right. When taking the length of a type,
> it should never be a typedef.  

I'd think we'd reach here with typedef'ed variables that lives in
a registers, but maybe we're stripping typedefs earlier per chance.

> One might even wonder if it would
> make sense to adjust TYPE_LENGTH to to a check_typedef systematically...

Maybe.  I guess that we'd need profiling to make sure that wouldn't
regress performance.  I don't know if we have paths were we'd
needlessly call check_typedef more times more.

-- 
Pedro Alves


  reply	other threads:[~2011-10-25 20:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 21:03 Joel Brobecker
2011-10-06 17:55 ` Pedro Alves
2011-10-06 20:11   ` Joel Brobecker
2011-10-06 21:00     ` Pedro Alves
2011-10-07 16:38       ` Joel Brobecker
2011-10-07 16:52         ` Pedro Alves
2011-10-22 14:48   ` Joel Brobecker
2011-10-25 19:34     ` Pedro Alves
2011-10-25 20:37       ` Joel Brobecker
2011-10-25 21:09         ` Pedro Alves [this message]
2011-10-26 21:44           ` Joel Brobecker
2011-10-26 22:11             ` Joel Brobecker
2011-10-27 15:57               ` Tom Tromey
2011-10-27 17:51                 ` Joel Brobecker
2011-10-27  2:56             ` Joel Brobecker
2011-10-27 11:10             ` Pedro Alves
2011-10-27 17:56               ` Joel Brobecker
2011-10-31  3:17             ` [RFA] read_frame_register_value and big endian arches Joel Brobecker
2011-11-07 19:42               ` Pedro Alves
2011-11-07 21:24                 ` Joel Brobecker
2011-11-10 17:15                 ` Checked in: " Joel Brobecker
2011-11-16 18:23                   ` Ulrich Weigand
2011-11-18  2:01                     ` Joel Brobecker
2011-11-18 17:40                       ` Ulrich Weigand
2011-11-18 19:41                         ` Joel Brobecker
2011-11-18 20:06                           ` [commit] " Ulrich Weigand

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=201110252149.34078.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@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