aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-03-18 18:40:08 +0000
committerPedro Alves <palves@redhat.com>2011-03-18 18:40:08 +0000
commite69aa73e27e67368cf501cc154db03809eb5445a (patch)
tree801e12c24c1b3e00635d8cbdff135b9ee40d5ad2
parent05d1431c1e0a4ecf30462109f5fb9876d78b7b4a (diff)
downloadgdb-e69aa73e27e67368cf501cc154db03809eb5445a.zip
gdb-e69aa73e27e67368cf501cc154db03809eb5445a.tar.gz
gdb-e69aa73e27e67368cf501cc154db03809eb5445a.tar.bz2
gdb/
* mi/mi-main.c (register_changed_p): Handle REG_UNAVAILABLE, and simplify, using regcache_cooked_read.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/mi/mi-main.c26
2 files changed, 19 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c9469da..3fab4bc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2011-03-18 Pedro Alves <pedro@codesourcery.com>
+ * mi/mi-main.c (register_changed_p): Handle REG_UNAVAILABLE, and
+ simplify, using regcache_cooked_read.
+
+2011-03-18 Pedro Alves <pedro@codesourcery.com>
+
* regcache.h (regcache_raw_read, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_part)
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 412aa4a..ef6bfc3 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1016,23 +1016,25 @@ register_changed_p (int regnum, struct regcache *prev_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;
- /* Registers not valid in this frame return count as unchanged. */
- if (regcache_register_status (this_regs, regnum) == REG_UNKNOWN)
- return 0;
-
- /* First time through or after gdbarch change consider all registers as
- changed. Same for registers not valid in the previous frame. */
- if (!prev_regs || get_regcache_arch (prev_regs) != gdbarch
- || regcache_register_status (prev_regs, regnum) == REG_UNKNOWN)
+ /* First time through or after gdbarch change consider all registers
+ as changed. */
+ if (!prev_regs || get_regcache_arch (prev_regs) != gdbarch)
return 1;
/* Get register contents and compare. */
- regcache_cooked_read (prev_regs, regnum, prev_buffer);
- regcache_cooked_read (this_regs, regnum, this_buffer);
+ prev_status = regcache_cooked_read (prev_regs, regnum, prev_buffer);
+ this_status = regcache_cooked_read (this_regs, regnum, this_buffer);
- return memcmp (prev_buffer, this_buffer,
- register_size (gdbarch, regnum)) != 0;
+ if (this_status != prev_status)
+ return 1;
+ else if (this_status == REG_VALID)
+ return memcmp (prev_buffer, this_buffer,
+ register_size (gdbarch, regnum)) != 0;
+ else
+ return 0;
}
/* Return a list of register number and value pairs. The valid