[v2,1/3] Use unsigned ints in regcache_map_entry
Commit Message
All current uses of regcache_map_entry use static hard coded values.
Update transfer_regset which uses those values.
2018-06-21 Alan Hayward <alan.hayward@arm.com>
* regcache.c (transfer_regset): Use unsigned ints.
* regcache.h (regcache_map_entry): Likewise.
---
gdb/regcache.c | 4 ++--
gdb/regcache.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
Comments
On 2018-06-21 05:38 AM, Alan Hayward wrote:
> All current uses of regcache_map_entry use static hard coded values.
> Update transfer_regset which uses those values.
Can you explain what we gain from this patch? In the previous discussion,
I mentioned that the parameters LEN and OFFSET in the regcache methods
(e.g. read_part) could be come unsigned, which would allow us to remove
the "offset >= 0 && len >= 0" assertions. In turn, they won't be
needed in your raw_collect_part/raw_supply_part. But I don't see
exactly what the current patch brings (though it's not incorrect).
Simon
@@ -988,14 +988,14 @@ regcache::transfer_regset (const struct regset *regset,
void *out_buf, size_t size) const
{
const struct regcache_map_entry *map;
- int offs = 0, count;
+ unsigned int offs = 0, count;
for (map = (const struct regcache_map_entry *) regset->regmap;
(count = map->count) != 0;
map++)
{
int regno = map->regno;
- int slot_size = map->size;
+ unsigned int slot_size = map->size;
if (slot_size == 0 && regno != REGCACHE_MAP_SKIP)
slot_size = m_descr->sizeof_register[regno];
@@ -83,9 +83,9 @@ extern void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc);
struct regcache_map_entry
{
- int count;
+ unsigned int count;
int regno;
- int size;
+ unsigned int size;
};
/* Special value for the 'regno' field in the struct above. */