Re: [PATCH] Remove an instance of MAX_REGISTER_SIZE from record-full.c

Yao Qi
2017-06-12T11:05:46Z

Alan Hayward <Alan.Hayward@arm.com> writes:

> - regcache_cooked_read (regcache, entry->u.reg.num, reg);
> - regcache_cooked_write (regcache, entry->u.reg.num,
> - record_full_get_loc (entry));
> - memcpy (record_full_get_loc (entry), reg, entry->u.reg.len);

The original code is about swapping contents of register REG in regcache
and record_full_get_loc (entry), and the length is known entry->u.reg.len.

> + value = regcache->cooked_read_value (entry->u.reg.num);
> + gdb_assert (value != NULL);
> + regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry));
> + memcpy (record_full_get_loc (entry), value_contents_all (value),
> + entry->u.reg.len);
> + release_value (value);
> + value_free (value);

It is a overkill to use value to swap these two buffers, IMO. How about
xmalloc "reg" instead?

--
Yao (齐尧)