This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Removal of uses of MAX_REGISTER_SIZE


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]