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 19:34:00 -0000 [thread overview]
Message-ID: <201110252002.38708.pedro@codesourcery.com> (raw)
In-Reply-To: <20111021233802.GJ19246@adacore.com>
On Saturday 22 October 2011 00:38:02, Joel Brobecker wrote:
> Purely in terms of solving the AVR problem, what do you think
> of the attached patch? Does it look correct to you?
>
> I tested it on AVR as well as x86_64-linux, and it seems to work.
>
> Going beyond that, the new function doesn't provide the extended
> interface that you suggest. Doing so seems to be complicating
> the implementation more than it's worth. I think that what we
> should do, we want to eliminate get_frame_register_value, is look
> at the current uses and try to eliminate them.
Yeah.
> The biggest culprit is the register_to_value gdbarch method (11
> hits). But there is only one location where it's actually called,
> and it is.... value_from_register! (just above the section of code
> that we're improving). I think it would be easy to change the
> profile of that method to return a value.
> Then the register_to_value implementations could use get_frame_register_value instead.
Yeah, though I suspect that your new read_frame_register_value
method may evolve into looking what I suggested anyway. :-)
> Other two uses that are different:
> - dwarf2loc.c: For DW_OP_piece (read/write) support;
Looks fixable. Hmm, I like this.
> - spu-tdep.c: We just read the contents of a single register
> (get_frame_register_value + extract_unsigned_integer,
> so it should be easy to replace them with something else.
> diff --git a/gdb/value.c b/gdb/value.c
> index 087cdfd..8dc9258 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -3140,6 +3140,35 @@ using_struct_return (struct gdbarch *gdbarch,
> != RETURN_VALUE_REGISTER_CONVENTION);
> }
>
> +/* 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.
> + int offset = 0;
> + int regnum = value->regnum;
> + const int len = TYPE_LENGTH (value_type (value));
Do we need check_typedefs here?
> + gdb_assert (value->lval == lval_register);
> +
> + while (offset < len)
> + {
> + struct value *regval = get_frame_register_value (frame, regnum);
> + int reg_len = TYPE_LENGTH (value_type (regval));
> +
> + if (offset + reg_len > len)
> + reg_len = len - offset;
> + value_contents_copy (value, offset, regval, value_offset (regval),
> + reg_len);
> +
> + offset += reg_len;
> + regnum++;
> + }
> +}
Otherwise looks good to me. Thanks!
--
Pedro Alves
next prev parent reply other threads:[~2011-10-25 19:03 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 [this message]
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
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=201110252002.38708.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