This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Removal of uses of MAX_REGISTER_SIZE
- From: Pedro Alves <palves at redhat dot com>
- To: Alan Hayward <Alan dot Hayward at arm dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Fri, 27 Jan 2017 12:11:09 +0000
- Subject: Re: [PATCH] Removal of uses of MAX_REGISTER_SIZE
- Authentication-results: sourceware.org; auth=none
- References: <7CF07197-4FED-4970-BB4B-2FE828E29A63@arm.com>
On 01/24/2017 10:31 AM, Alan Hayward wrote:
> aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
> int regnum, const gdb_byte *buf)
> {
> - gdb_byte reg_buf[MAX_REGISTER_SIZE];
> + gdb_byte *reg_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
>
> /* Ensure the register buffer is zero, we want gdb writes of the
> various 'scalar' pseudo registers to behavior like architectural
> writes, register width bytes are written the remainder are set to
> zero. */
> - memset (reg_buf, 0, sizeof (reg_buf));
> + memset (reg_buf, 0, sizeof (register_size (gdbarch, regnum)));
OK, I scrolled a bit further down to the third hunk. This sizeof is
clearly broken. There may be more instances of this.
Makes me wonder whether this is the right approach. :-/
(No, I don't have a formed opinion for what that would be.)
Thanks,
Pedro Alves