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



> On 22 Jun 2018, at 15:25, Simon Marchi <simon.marchi@ericsson.com> wrote:
> 
> 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!

No probs!

> 
> 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.

Yes. I had removed the same check from raw_collect_part, but didn’t
spot this.

> 
>> 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?

Done.

> 
>> +  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.
> 

Done.


Pushed with changes as suggested.


Thanks,
Alan.


      reply	other threads:[~2018-06-22 15:29 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
2018-06-22 15:29   ` Alan Hayward [this message]

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=D655F5B2-C08D-444F-91E5-F7CB2E9B6EB8@arm.com \
    --to=alan.hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    --cc=simon.marchi@ericsson.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).