+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
/* 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
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
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)