diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-08-13 23:06:40 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-08-13 23:06:40 +0000 |
commit | 53826de97c0834aee03c2e9dc91ea000e3faa1ac (patch) | |
tree | beee08fbf7ab30a3cb042c3e74a28c6feab96c5e | |
parent | cd2b29395d7881d7e8e8e8f07eeb52c380d1bb98 (diff) | |
download | gdb-53826de97c0834aee03c2e9dc91ea000e3faa1ac.zip gdb-53826de97c0834aee03c2e9dc91ea000e3faa1ac.tar.gz gdb-53826de97c0834aee03c2e9dc91ea000e3faa1ac.tar.bz2 |
2002-08-13 Andrew Cagney <cagney@redhat.com>
* regcache.c (init_regcache_descr): Overallocate the
raw_register_valid_p array including space for NUM_PSEUDO_REGS.
(registers_changed): Replace NUM_REGS+NUM_PSEUDO_REGS with
num_raw_registers.
(set_register_cached): Add range checking assertions. Use
current_regcache.
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/regcache.c | 13 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 71eae60..a34f45a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2002-08-13 Andrew Cagney <cagney@redhat.com> + + * regcache.c (init_regcache_descr): Overallocate the + raw_register_valid_p array including space for NUM_PSEUDO_REGS. + (registers_changed): Replace NUM_REGS+NUM_PSEUDO_REGS with + nr_raw_registers. + (set_register_cached): Add range checking assertions. Use + current_regcache. + 2002-08-13 Mark Kettenis <kettenis@elgar.kettenis.dyndns.org> * i386-tdep.c (i386_stab_reg_to_regnum): Return correct register diff --git a/gdb/regcache.c b/gdb/regcache.c index 85d96c9..e46f082 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -161,7 +161,12 @@ init_regcache_descr (struct gdbarch *gdbarch) /* Construct a strictly RAW register cache. Don't allow pseudo's into the register cache. */ descr->nr_raw_registers = NUM_REGS; - descr->sizeof_raw_register_valid_p = NUM_REGS; + + /* FIXME: cagney/2002-08-13: Overallocate the register_valid_p + array. This pretects GDB from erant code that accesses elements + of the global register_valid_p[] array in the range [NUM_REGS + .. NUM_REGS + NUM_PSEUDO_REGS). */ + descr->sizeof_raw_register_valid_p = NUM_REGS + NUM_PSEUDO_REGS; /* Lay out the register cache. The pseud-registers are included in the layout even though their value isn't stored in the register @@ -431,7 +436,9 @@ register_cached (int regnum) void set_register_cached (int regnum, int state) { - register_valid[regnum] = state; + gdb_assert (regnum >= 0); + gdb_assert (regnum < current_regcache->descr->nr_raw_registers); + current_regcache->raw_register_valid_p[regnum] = state; } /* REGISTER_CHANGED @@ -485,7 +492,7 @@ registers_changed (void) gdb gives control to the user (ie watchpoints). */ alloca (0); - for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) + for (i = 0; i < current_regcache->descr->nr_raw_registers; i++) set_register_cached (i, 0); if (registers_changed_hook) |