+2002-08-09 Andrew Cagney <cagney@redhat.com>
+
+ * regcache.c (regcache_dump): Compare the register offset
+ with REGISTER_BYTE.
+ * arch-utils.c (generic_register_byte): New function.
+ * arch-utils.h (generic_register_byte): Declare.
+ * gdbarch.sh (REGISTER_BYTE): Default to generic_register_byte.
+ * gdbarch.h, gdbarch.c: Regenerate.
+
2002-08-09 Andrew Cagney <cagney@redhat.com>
* regcache.c: Include "gdbcmd.h"
(name && STREQ ("_sigtramp", name))
#endif
#endif
+
+/* Assume all registers are adjacent. */
+
+int
+generic_register_byte (int regnum)
+{
+ int byte;
+ int i;
+ gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
+ byte = 0;
+ for (i = 0; i < regnum; i++)
+ {
+ byte += TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i));
+ }
+ return byte;
+}
+
\f
int
legacy_pc_in_sigtramp (CORE_ADDR pc, char *name)
extern int generic_register_size (int regnum);
+/* Assume that the world is sane, the registers are all adjacent. */
+extern int generic_register_byte (int regnum);
+
/* Prop up old targets that use various IN_SIGTRAMP() macros. */
extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name);
0,
0,
0,
- 0,
+ generic_register_byte,
generic_register_size,
0,
generic_register_size,
current_gdbarch->register_name = legacy_register_name;
current_gdbarch->register_size = -1;
current_gdbarch->register_bytes = -1;
+ current_gdbarch->register_byte = generic_register_byte;
current_gdbarch->register_raw_size = generic_register_size;
current_gdbarch->max_register_raw_size = -1;
current_gdbarch->register_virtual_size = generic_register_size;
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->register_bytes == -1))
fprintf_unfiltered (log, "\n\tregister_bytes");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->register_byte == 0))
- fprintf_unfiltered (log, "\n\tregister_byte");
+ /* Skip verify of register_byte, invalid_p == 0 */
/* Skip verify of register_raw_size, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->max_register_raw_size == -1))
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTE)
+#define REGISTER_BYTE(reg_nr) (generic_register_byte (reg_nr))
+#endif
+
typedef int (gdbarch_register_byte_ftype) (int reg_nr);
extern int gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr);
extern void set_gdbarch_register_byte (struct gdbarch *gdbarch, gdbarch_register_byte_ftype *register_byte);
f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0
v:2:REGISTER_SIZE:int:register_size::::0:-1
v:2:REGISTER_BYTES:int:register_bytes::::0:-1
-f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
+f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte::0
f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
{
fprintf_unfiltered (file, " %6ld",
regcache->descr->register_offset[regnum]);
- if (register_offset != regcache->descr->register_offset[regnum])
+ if (register_offset != regcache->descr->register_offset[regnum]
+ || register_offset != REGISTER_BYTE (regnum))
{
if (!footnote_register_offset)
footnote_register_offset = ++footnote_nr;