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 v2 3/3] Use partial register read/writes in transfer_regset
Date: Thu, 21 Jun 2018 19:56:00 -0000 [thread overview]
Message-ID: <F70A26DA-B3F9-4CCB-BFB8-5A26B45529BA@arm.com> (raw)
In-Reply-To: <85583a14-9c9f-605c-8216-57b6cda22d41@ericsson.com>
> On 21 Jun 2018, at 15:14, Simon Marchi <simon.marchi@ericsson.com> wrote:
>
> Hi Alan,
>
> On 2018-06-21 05:38 AM, Alan Hayward wrote:
>> @@ -1013,12 +1077,18 @@ regcache::transfer_regset (const struct regset *regset,
>> if (offs + slot_size > size)
>> break;
>>
>> + /* Use part versions to prevent possible overflow. */
>> if (out_buf)
>
> Can you update the pointer comparisons in the code you touch to use != NULL or != nullptr?
>
Will do.
>> diff --git a/gdb/regcache.h b/gdb/regcache.h
>> index c17ce09dee..a69b67d513 100644
>> --- a/gdb/regcache.h
>> +++ b/gdb/regcache.h
>> @@ -162,6 +162,11 @@ 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. If this runs off the end of the register, then fill the
>> + additional space with zeros. */
>
> To have a consistent interface, I would be tempted to use the same behavior as
> read_part and write_part for reads and writes that run off the end of the register
> (not allow it). It would be the responsibility of the caller to ensure that they
> don't overflow. I think it would just be a matter of
>
> std::min (reg_size, slot_size)
>
> ?
I went back and too between doing it this way and the way I posted.
I settled on this way because it made transfer_regset neater. I agree it makes
sense to keep the interface the same. In addition I’d then have to pull the
memset of 0s into transfer_regset. I think it’ll look better if I pull the two
almost identical blobs of code into a helper function.
I’ll switch it around and repost as single V3 tomorrow, with all the unsigned stuff
dropped.
Alan.
next prev parent reply other threads:[~2018-06-21 19:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-21 9:39 [PATCH v2 0/3] Support large registers in regcache transfer_regset Alan Hayward
2018-06-21 9:38 ` [PATCH v2 1/3] Use unsigned ints in regcache_map_entry Alan Hayward
2018-06-21 13:27 ` Simon Marchi
2018-06-21 13:52 ` Simon Marchi
2018-06-21 15:19 ` Alan Hayward
2018-06-21 15:34 ` Simon Marchi
2018-06-21 17:32 ` Simon Marchi
2018-06-21 19:52 ` Alan Hayward
2018-06-21 9:39 ` [PATCH v2 2/3] Avoid memcpys in regcache read_part/write_part for full registers Alan Hayward
2018-06-21 14:00 ` Simon Marchi
2018-06-21 9:39 ` [PATCH v2 3/3] Use partial register read/writes in transfer_regset Alan Hayward
2018-06-21 14:16 ` Simon Marchi
2018-06-21 19:56 ` Alan Hayward [this message]
2018-06-21 15:02 ` Simon Marchi
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=F70A26DA-B3F9-4CCB-BFB8-5A26B45529BA@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).