{
CORE_ADDR return_pc
= read_memory_unsigned_integer (info->saved_regs[LR_REGNUM],
- REGISTER_RAW_SIZE (LR_REGNUM));
+ register_size (current_gdbarch, LR_REGNUM));
info->return_pc = d10v_make_iaddr (return_pc);
}
else
int i;
fprintf_filtered (file, " ");
frame_register_read (frame, a, num);
- for (i = 0; i < MAX_REGISTER_RAW_SIZE; i++)
+ for (i = 0; i < max_register_size (current_gdbarch); i++)
{
fprintf_filtered (file, "%02x", (num[i] & 0xff));
}
printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type),
TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM,
(int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM),
- REGISTER_RAW_SIZE (RET1_REGNUM)));
+ register_size (current_gdbarch, RET1_REGNUM)));
#endif
if (TYPE_LENGTH (type) == 1)
{
}
addr = read_memory_unsigned_integer (info->saved_regs[FP_REGNUM],
- REGISTER_RAW_SIZE (FP_REGNUM));
+ register_size (current_gdbarch, FP_REGNUM));
if (addr == 0)
return;
*addrp = 0;
*realnump = -1;
if (bufferp != NULL)
- store_address (bufferp, REGISTER_RAW_SIZE (regnum),
+ store_address (bufferp, register_size (current_gdbarch, regnum),
saved_regs[regnum]);
}
else
{
/* Read the value in from memory. */
read_memory (saved_regs[regnum], bufferp,
- REGISTER_RAW_SIZE (regnum));
+ register_size (current_gdbarch, regnum));
}
}
return;
frame_unwind_register (fi, LR_REGNUM, raw_buffer);
regcache_cooked_write (regcache, PC_REGNUM, raw_buffer);
- store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (SP_REGNUM),
+ store_unsigned_integer (raw_buffer,
+ register_size (current_gdbarch, SP_REGNUM),
fp + info->size);
regcache_cooked_write (regcache, SP_REGNUM, raw_buffer);
return descr->max_register_size;
}
+int
+register_size (struct gdbarch *gdbarch, int regnum)
+{
+ struct regcache_descr *descr = regcache_descr (gdbarch);
+ int size;
+ gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
+ size = descr->sizeof_register[regnum];
+ gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
+ gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
+ return size;
+}
+
/* The register cache for storing raw register values. */
struct regcache
extern int max_register_size (struct gdbarch *gdbarch);
+/* Return the size of register REGNUM. All registers should have only
+ one size.
+
+ FIXME: cagney/2003-02-28:
+
+ Unfortunatly, thanks to some legacy architectures, this doesn't
+ hold. A register's cooked (nee virtual) and raw size can differ
+ (see MIPS). Such architectures should be using different register
+ numbers for the different sized views of identical registers.
+
+ Anyway, the up-shot is that, until that mess is fixed, core code
+ can end up being very confused - should the RAW or VIRTUAL size be
+ used? As a rule of thumb, use REGISTER_VIRTUAL_SIZE in cooked
+ code, but with the comment:
+
+ OK: REGISTER_VIRTUAL_SIZE
+
+ or just
+
+ OK
+
+ appended to the end of the line. */
+
+extern int register_size (struct gdbarch *gdbarch, int regnum);
+
+
/* Save/restore a register cache. The registers saved/restored is
determined by the save_reggroup and restore_reggroup (although you
can't restore a register that wasn't saved as well :-). You can