This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove an instance of MAX_REGISTER_SIZE from record-full.c
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Alan Hayward <Alan dot Hayward at arm dot com>
- Cc: "gdb-patches\@sourceware.org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Mon, 12 Jun 2017 12:05:42 +0100
- Subject: Re: [PATCH] Remove an instance of MAX_REGISTER_SIZE from record-full.c
- Authentication-results: sourceware.org; auth=none
- References: <69EEE46A-D88C-4B4F-86A2-E35F6DAFD90A@arm.com>
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 (齐尧)