From: Simon Marchi <simon.marchi@ericsson.com>
To: Alan Hayward <Alan.Hayward@arm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
nd <nd@arm.com>
Subject: Re: [PATCH v2 1/3] Use unsigned ints in regcache_map_entry
Date: Thu, 21 Jun 2018 15:34:00 -0000 [thread overview]
Message-ID: <3e13b55d-5283-eb61-c018-880ff0e92ab1@ericsson.com> (raw)
In-Reply-To: <C88DB226-B5CE-4D67-8D1D-B55F3C77CEAE@arm.com>
On 2018-06-21 11:19 AM, Alan Hayward wrote:
> I originally wrote this for just the _part functions and then I rejected
> it. The problem as I see it with this is that, mostly all the code calling
> these functions today are using ints.
>
> So, to keep it safe we should really update all the callers too. For example,
> one picked at random:
>
> --- a/gdb/m32c-tdep.c
> +++ b/gdb/m32c-tdep.c
> @@ -443,9 +443,9 @@ m32c_find_part (struct m32c_reg *reg, int *offset_p, int *len_p)
> bits, read the value of the REG->n'th element. */
> static enum register_status
> m32c_part_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
> {
> - int offset, len;
> + unsigned int offset, len;
>
> memset (buf, 0, TYPE_LENGTH (reg->type));
> m32c_find_part (reg, &offset, &len);
> return cache->cooked_read_part (reg->rx->num, offset, len, buf);
>
> And without checking, Iâm not sure m32c_find_part can guarantee unsigned.
>
> Without those changes all we are doing is losing some assert protection.
Fair enough, I'm fine with keeping the ints and the >= 0 asserts. It was just
a tiny itch :).
Simon
next prev parent reply other threads:[~2018-06-21 15:34 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 [this message]
2018-06-21 17:32 ` Simon Marchi
2018-06-21 19:52 ` Alan Hayward
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
2018-06-21 15:02 ` Simon Marchi
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
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=3e13b55d-5283-eb61-c018-880ff0e92ab1@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).