Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: brobecker@adacore.com (Joel Brobecker)
Cc: gdb-patches@sourceware.org, tromey@redhat.com
Subject: Re: Checked in: [RFA] read_frame_register_value and big endian arches
Date: Wed, 16 Nov 2011 18:23:00 -0000	[thread overview]
Message-ID: <201111161822.pAGIMpx5015021@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <20111110171526.GC5390@adacore.com> from "Joel Brobecker" at Nov 10, 2011 09:15:26 AM

Joel Brobecker wrote:
> > > gdb/ChangeLog:
> > > 
> > >         * findvar.c (read_frame_register_value): Read the correct bytes
> > >         from registers on big-endian architectures.
> > 
> > Looks good to me.
> 
> Now checked in. Thanks again for the review...

It seems this completely broke reading of register variables on SPU.  These
are in the high-order element of the (always vector) registers, even though
we have a big-endian architecture.

It seems the underlying problem is that your new read_frame_register_value
routine completely ignores the value_offset of the lval_register value.
This is the place where this information is encoded: note that for
big-endian architectures, value_offset is already correct, so if you'd
respect it, you wouldn't need any special-purpose big-endian code.

Also, if you'd respect value_offset, the SPU special cases would work.

In general, if V is a value with value_lval (V) == lval_register, its
contents must be retrieved by reading the register(s) starting with
number VALUE_REGNUM (V) in their "natural" sizes, skipping the first
value_offset (V) bytes of the concatenated result, and using the
next TYPE_LENGTH (value_type (V)) bytes as the value contents.


If you look at the original code your patch:
http://www.sourceware.org/ml/gdb-patches/2011-10/msg00713.html
replaced, it does take value_offset into account:

      /* Get the data.  */
      v2 = get_frame_register_value (frame, regnum);

      value_contents_copy (v, 0, v2, value_offset (v), len);

While get_frame_register_value always reads the full register,
the value_contents_copy call then extracts only the part
starting at value_offset.

Note that to handle multi-register values, you may actually
need to skip full registers if value_offset starts out bigger
than the size of a register.  See the get_frame_register_bytes
routine how this should be handled.

Note that before Tom's patch here:
http://sourceware.org/ml/gdb-patches/2011-07/msg00351.html
the value_from_register routine actually called
get_frame_register_bytes to handle all those situations ...

The only problematic thing with get_frame_register_bytes is that
it doesn't create a value as output, and therefore does not
propagate precise availability information.  The new
read_frame_register_value should probably implement this
(or maybe even replace get_frame_register_bytes).

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2011-11-16 18:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 21:03 [RFA/RFC] Restore old handling of multi-register variables 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
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 [this message]
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=201111161822.pAGIMpx5015021@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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