public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Alan Hayward <alan.hayward@arm.com>, <gdb-patches@sourceware.org>
Cc: <nd@arm.com>
Subject: Re: [PATCH v3] Support large registers in regcache transfer_regset
Date: Fri, 22 Jun 2018 14:25:00 -0000	[thread overview]
Message-ID: <5034396d-84f5-c6d0-ea7e-488073ba7215@ericsson.com> (raw)
In-Reply-To: <20180622130819.1940-1-alan.hayward@arm.com>

Hi Alan,

The patch LGTM.  I noted two small comments you might want to address before
pushing.  Sorry again for the extra work I made you do!

On 2018-06-22 09:08 AM, Alan Hayward wrote:
> @@ -868,6 +900,39 @@ regcache::write_part (int regnum, int offset, int len,
>  
>  /* See regcache.h.  */
>  
> +void
> +reg_buffer::raw_supply_part (int regnum, int offset, int len,
> +			     const gdb_byte *in)
> +{
> +  int reg_size = register_size (arch (), regnum);
> +
> +  gdb_assert (in != nullptr);
> +  gdb_assert (offset >= 0 && offset <= reg_size);
> +  gdb_assert (len >= 0 && offset + len <= reg_size);
> +
> +  if (offset == 0 && len == 0)
> +    {
> +      /* Nothing to do.  */
> +      return;
> +    }
> +
> +  if (offset == 0 && len == reg_size)
> +    {
> +      /* Supply the full register.  */
> +      return raw_supply (regnum, in);
> +    }
> +
> +  gdb_byte *reg = (gdb_byte *) alloca (reg_size);
> +
> +  /* Read when needed.  */
> +  if (offset > 0 || offset + len < reg_size)

I think this if is unneeded now, with the earlier check?  If we reach
this point, it will always be for a partial register.

> diff --git a/gdb/regcache.h b/gdb/regcache.h
> index 983137f6ad..e706d87b54 100644
> --- a/gdb/regcache.h
> +++ b/gdb/regcache.h
> @@ -166,6 +166,10 @@ public:
>    void raw_collect_integer (int regnum, gdb_byte *addr, int addr_len,
>  			    bool is_signed) const;
>  
> +  /* Collect register REGNUM from REGCACHE, starting at offset in REGCACHE,
> +     reading only LEN.  */

I think "starting at offset in REGCACHE" is wrong, you probably meant
"starting at offset in the register" or something like that?

> +  void raw_collect_part (int regnum, int offset, int len, gdb_byte *out) const;
> +
>    /* See common/common-regcache.h.  */
>    void raw_supply (int regnum, const void *buf) override;
>  
> @@ -187,6 +191,10 @@ public:
>       unavailable).  */
>    void raw_supply_zeroed (int regnum);
>  
> +  /* Supply register REGNUM to REGCACHE, starting at offset in REGCACHE, writing
> +     only LEN, without editing the rest of the register.  */

Here too.

Thanks,

Simon

  reply	other threads:[~2018-06-22 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22 13:08 Alan Hayward
2018-06-22 14:25 ` Simon Marchi [this message]
2018-06-22 15:29   ` Alan Hayward

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=5034396d-84f5-c6d0-ea7e-488073ba7215@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=alan.hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).