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: Fri, 18 Nov 2011 17:40:00 -0000 [thread overview]
Message-ID: <201111181740.pAIHe4Vc023523@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <20111118020121.GA2703@adacore.com> from "Joel Brobecker" at Nov 17, 2011 09:01:21 PM
Joel Brobecker wrote:
> > 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.
>
> I will try to fix ASAP. I am sorry if that caused some fustration
> when trying to do your testing. I didn't want to do the work in
> the first place but I, too, got my testing broken by someone else's
> change!
No problem :-)
I've now implemented a fix for read_frame_register_value by simply
following the same logic as get_frame_register_bytes does.
This fixes the regressions on SPU for me. Does this work for the
platforms where you were seeing issues as well?
Bye,
Ulrich
ChangeLog:
* findvar.c (read_frame_register_value): Respect value_offset
of the register value. Remove big-endian special case.
Index: gdb/findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.139
diff -u -p -r1.139 findvar.c
--- gdb/findvar.c 10 Nov 2011 17:14:40 -0000 1.139
+++ gdb/findvar.c 18 Nov 2011 16:49:05 -0000
@@ -631,31 +631,37 @@ default_value_from_register (struct type
void
read_frame_register_value (struct value *value, struct frame_info *frame)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
int offset = 0;
+ int reg_offset = value_offset (value);
int regnum = VALUE_REGNUM (value);
const int len = TYPE_LENGTH (check_typedef (value_type (value)));
gdb_assert (VALUE_LVAL (value) == lval_register);
- while (offset < len)
+ /* Skip registers wholly inside of REG_OFFSET. */
+ while (reg_offset >= register_size (gdbarch, regnum))
+ {
+ reg_offset -= register_size (gdbarch, regnum);
+ regnum++;
+ }
+
+ /* Copy the data. */
+ while (len > 0)
{
struct value *regval = get_frame_register_value (frame, regnum);
- int reg_len = TYPE_LENGTH (value_type (regval));
- int reg_offset = 0;
+ int reg_len = TYPE_LENGTH (value_type (regval)) - reg_offset;
/* If the register length is larger than the number of bytes
remaining to copy, then only copy the appropriate bytes. */
- if (offset + reg_len > len)
- {
- reg_len = len - offset;
- if (gdbarch_byte_order (get_frame_arch (frame)) == BFD_ENDIAN_BIG)
- reg_offset = TYPE_LENGTH (value_type (regval)) - reg_len;
- }
+ if (reg_len > len)
+ reg_len = len;
- value_contents_copy (value, offset, regval,
- value_offset (regval) + reg_offset, reg_len);
+ value_contents_copy (value, offset, regval, reg_offset, reg_len);
offset += reg_len;
+ len -= reg_len;
+ reg_offset = 0;
regnum++;
}
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2011-11-18 17:40 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
2011-11-18 2:01 ` Joel Brobecker
2011-11-18 17:40 ` Ulrich Weigand [this message]
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=201111181740.pAIHe4Vc023523@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