2003-03-01 Andrew Cagney <cagney@redhat.com>

* gdbarch.sh (register_type): New function with predicate.
	(REGISTER_VIRTUAL_TYPE): Change to function with predicate.
	* gdbarch.h, gdbarch.c: Re-generate.
	* arch-utils.c (generic_register_byte): Use generic_register_size.
	(generic_register_size): When available, use
	gdbarch_register_type.
	* regcache.c (init_regcache_descr): When available, initialize the
	register type array using gdbarch_register_type.  If the
	architecture supplies gdbarch_register_type, do not use the legacy
	regcache layout.
	* d10v-tdep.c (d10v_register_type): Replace
	d10v_register_virtual_type.
	(d10v_gdbarch_init): Set register_type instead of
	register_virtual_type.
This commit is contained in:
Andrew Cagney
2003-03-01 17:59:12 +00:00
parent 7b83296f22
commit 35cac7cfea
7 changed files with 168 additions and 10 deletions

View File

@@ -440,7 +440,13 @@ int
generic_register_size (int regnum)
{
gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
if (gdbarch_register_type_p (current_gdbarch))
return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, regnum));
else
/* FIXME: cagney/2003-03-01: Once all architectures implement
gdbarch_register_type(), this entire function can go away. It
is made obsolete by register_size(). */
return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum)); /* OK */
}
/* Assume all registers are adjacent. */
@@ -454,7 +460,7 @@ generic_register_byte (int regnum)
byte = 0;
for (i = 0; i < regnum; i++)
{
byte += TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i));
byte += generic_register_size (regnum);
}
return byte;
}