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
Alan Hayward <Alan.Hayward@arm.com> writes:
> @@ -1135,8 +1135,8 @@ register_changed_p (int regnum, struct regcache *prev_regs,
> struct regcache *this_regs)
> {
> struct gdbarch *gdbarch = get_regcache_arch (this_regs);
> - gdb_byte prev_buffer[MAX_REGISTER_SIZE];
> - gdb_byte this_buffer[MAX_REGISTER_SIZE];
> + std::vector<gdb_byte> prev_buffer (register_size (gdbarch, regnum));
> + std::vector<gdb_byte> this_buffer (register_size (gdbarch, regnum));
> enum register_status prev_status;
> enum register_status this_status;
>
This function should be moved to regcache.c, because it is about
comparing bytes of a certain register in both regcaches. Then, wen can
compare raw registers from register_buffer, and pseudo registers from
the values.
> @@ -1146,13 +1146,13 @@ register_changed_p (int regnum, struct regcache *prev_regs,
> return 1;
>
> /* Get register contents and compare. */
> - prev_status = regcache_cooked_read (prev_regs, regnum, prev_buffer);
> - this_status = regcache_cooked_read (this_regs, regnum, this_buffer);
> + prev_status = regcache_cooked_read (prev_regs, regnum, prev_buffer.data ());
> + this_status = regcache_cooked_read (this_regs, regnum, this_buffer.data ());
>
> if (this_status != prev_status)
> return 1;
> else if (this_status == REG_VALID)
> - return memcmp (prev_buffer, this_buffer,
> + return memcmp (prev_buffer.data (), this_buffer.data (),
> register_size (gdbarch, regnum)) != 0;
> else
> return 0;
--
Yao (齐尧)