From: Alan Hayward Date: Thu, 8 Jun 2017 13:02:59 +0000 (+0100) Subject: Remove MAX_REGISTER_SIZE from mi/mi-main.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff4ca5ac6a2e85177dc7efe5cbda7b956bb71fd5;p=binutils-gdb.git Remove MAX_REGISTER_SIZE from mi/mi-main.c gdb/ * mi/mi-main.c (register_changed_p): Use cooked_read_value. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 673210a179c..70736f5cc3e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-06-08 Alan Hayward + + * mi/mi-main.c (register_changed_p): Use cooked_read_value. + 2017-06-07 Sergio Durigan Junior * NEWS (Changes since GDB 8.0): Announce that GDBserver is now diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index bdc5dda3053..38d737f49f3 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1111,10 +1111,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]; - enum register_status prev_status; - enum register_status this_status; + struct value *prev_value, *this_value; + int ret; /* First time through or after gdbarch change consider all registers as changed. */ @@ -1122,16 +1120,28 @@ 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); - - if (this_status != prev_status) - return 1; - else if (this_status == REG_VALID) - return memcmp (prev_buffer, this_buffer, - register_size (gdbarch, regnum)) != 0; + prev_value = prev_regs->cooked_read_value (regnum); + this_value = this_regs->cooked_read_value (regnum); + gdb_assert (prev_value != NULL); + gdb_assert (this_value != NULL); + + if (value_optimized_out (prev_value) != value_optimized_out (this_value) + || value_entirely_available (prev_value) + != value_entirely_available (this_value)) + ret = 1; + if (value_optimized_out (prev_value) + || !value_entirely_available (prev_value)) + ret = 0; else - return 0; + ret = memcmp (value_contents_all (prev_value), + value_contents_all (this_value), + register_size (gdbarch, regnum)) != 0; + + release_value (prev_value); + release_value (this_value); + value_free (prev_value); + value_free (this_value); + return ret; } /* Return a list of register number and value pairs. The valid