* regcache.h (max_register_size): Delete declaration.
* regcache.c (max_register_size): Delete function.
(struct regcache_descr): Delete field "max_register_size".
(init_regcache_descr, init_legacy_regcache_descr): Assert that all
registers fit in MAX_REGISTER_SIZE.
(regcache_save): Replace max_register_size with MAX_REGISTER_SIZE.
(regcache_restore, regcache_xfer_part, regcache_dump): Ditto.
* thread-db.c: Replace max_register_size with MAX_REGISTER_SIZE.
* sh-tdep.c, rom68k-rom.c, remote-sim.c, remote-mips.c: Ditto.
* remote-e7000.c, monitor.c, mipsv4-nat.c, mips-nat.c: Ditto.
* m68klinux-nat.c, lynx-nat.c, irix4-nat.c: Ditto.
* hpux-thread.c, hppah-nat.c, hppab-nat.c, hppa-tdep.c: Ditto.
* dve3900-rom.c, hppa-tdep.c: Ditto.
+2003-05-08 Andrew Cagney <cagney@redhat.com>
+
+ * regcache.h (max_register_size): Delete declaration.
+ * regcache.c (max_register_size): Delete function.
+ (struct regcache_descr): Delete field "max_register_size".
+ (init_regcache_descr, init_legacy_regcache_descr): Assert that all
+ registers fit in MAX_REGISTER_SIZE.
+ (regcache_save): Replace max_register_size with MAX_REGISTER_SIZE.
+ (regcache_restore, regcache_xfer_part, regcache_dump): Ditto.
+ * thread-db.c: Replace max_register_size with MAX_REGISTER_SIZE.
+ * sh-tdep.c, rom68k-rom.c, remote-sim.c, remote-mips.c: Ditto.
+ * remote-e7000.c, monitor.c, mipsv4-nat.c, mips-nat.c: Ditto.
+ * m68klinux-nat.c, lynx-nat.c, irix4-nat.c: Ditto.
+ * hpux-thread.c, hppah-nat.c, hppab-nat.c, hppa-tdep.c: Ditto.
+ * dve3900-rom.c, hppa-tdep.c: Ditto.
+
2003-05-08 David Carlton <carlton@math.stanford.edu>
* valops.c (push_word): Fix typo.
fetch_bitmapped_register (int regno, struct bit_field *bf)
{
unsigned long val;
- unsigned char *regbuf = alloca (max_register_size (current_gdbarch));
+ unsigned char regbuf[MAX_REGISTER_SIZE];
char *regname = NULL;
if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
int start;
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
long long reg_val;
if (!know_which)
static void
pa_print_fp_reg (int i)
{
- char *raw_buffer = alloca (max_register_size (current_gdbarch));
- char *virtual_buffer = alloca (max_register_size (current_gdbarch));
+ char raw_buffer[MAX_REGISTER_SIZE];
+ char virtual_buffer[MAX_REGISTER_SIZE];
/* Get 32bits of data. */
frame_register_read (deprecated_selected_frame, i, raw_buffer);
static void
pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision)
{
- char *raw_buffer = alloca (max_register_size (current_gdbarch));
- char *virtual_buffer = alloca (max_register_size (current_gdbarch));
+ char raw_buffer[MAX_REGISTER_SIZE];
+ char virtual_buffer[MAX_REGISTER_SIZE];
fputs_filtered (REGISTER_NAME (i), stream);
print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), stream);
if (precision == double_precision && (i % 2) == 0)
{
- char *raw_buf = alloca (max_register_size (current_gdbarch));
+ char raw_buf[MAX_REGISTER_SIZE];
/* Get the data in raw format for the 2nd half. */
frame_register_read (deprecated_selected_frame, i + 1, raw_buf);
fetch_register (int regno)
{
register unsigned int regaddr;
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
register int i;
/* Offset of registers within the u area. */
static void
fetch_register (int regno)
{
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
unsigned int addr, len, offset;
int i;
child_ops.to_fetch_registers (regno);
else
{
- unsigned char *buf = alloca (max_register_size (current_gdbarch));
+ unsigned char buf[MAX_REGISTER_SIZE];
CORE_ADDR sp;
sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;
child_ops.to_store_registers (regno);
else
{
- unsigned char *buf = alloca (max_register_size (current_gdbarch));
+ unsigned char buf[MAX_REGISTER_SIZE];
CORE_ADDR sp;
sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;
{
register int regi;
register greg_t *regp = (greg_t *) (gregsetp->gp_regs);
- char *zerobuf = alloca (max_register_size (current_gdbarch));
- memset (zerobuf, 0, max_register_size (current_gdbarch));
+ char zerobuf[MAX_REGISTER_SIZE];
+ memset (zerobuf, 0, MAX_REGISTER_SIZE);
/* FIXME: somewhere, there should be a #define for the meaning
of this magic number 32; we should use that. */
supply_fpregset (fpregset_t *fpregsetp)
{
register int regi;
- char *zerobuf = alloca (max_register_size (current_gdbarch));
- memset (zerobuf, 0, max_register_size (current_gdbarch));
+ char zerobuf[MAX_REGISTER_SIZE];
+ memset (zerobuf, 0, MAX_REGISTER_SIZE);
for (regi = 0; regi < 32; regi++)
supply_register (FP0_REGNUM + regi,
if (whatregs & WHATREGS_GEN)
{
struct econtext ec; /* general regs */
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
int retval;
int i;
ecp = registers_addr (PIDGET (inferior_ptid));
{
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
for (regno = reglo; regno <= reghi; regno++)
{
int ptrace_fun = PTRACE_PEEKTHREAD;
char mess[128]; /* For messages */
register int i;
unsigned int offset; /* Offset of registers within the u area. */
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
int tid;
if (CANNOT_FETCH_REGISTER (regno))
fetch_inferior_registers (int regno)
{
register unsigned int regaddr;
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
register int i;
- char *zerobuf = alloca (max_register_size (current_gdbarch));
- memset (zerobuf, 0, max_register_size (current_gdbarch));
+ char zerobuf[MAX_REGISTER_SIZE];
+ memset (zerobuf, 0, MAX_REGISTER_SIZE);
deprecated_registers_fetched ();
int bad_reg = -1;
register reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
- char *zerobuf = alloca (max_register_size (current_gdbarch));
- memset (zerobuf, 0, max_register_size (current_gdbarch));
+ char zerobuf[MAX_REGISTER_SIZE];
+ memset (zerobuf, 0, MAX_REGISTER_SIZE);
/* If u.u_ar0 was an absolute address in the core file, relativize it now,
{
register int regi;
register greg_t *regp = &(*gregsetp)[0];
- char *zerobuf = alloca (max_register_size (current_gdbarch));
- memset (zerobuf, 0, max_register_size (current_gdbarch));
+ char zerobuf[MAX_REGISTER_SIZE];
+ memset (zerobuf, 0, MAX_REGISTER_SIZE);
for (regi = 0; regi <= CXT_RA; regi++)
supply_register (regi, (char *) (regp + regi));
supply_fpregset (fpregset_t *fpregsetp)
{
register int regi;
- char *zerobuf = alloca (max_register_size (current_gdbarch));
- memset (zerobuf, 0, max_register_size (current_gdbarch));
+ char zerobuf[MAX_REGISTER_SIZE];
+ memset (zerobuf, 0, MAX_REGISTER_SIZE);
for (regi = 0; regi < 32; regi++)
supply_register (FP0_REGNUM + regi,
monitor_supply_register (int regno, char *valstr)
{
ULONGEST val;
- unsigned char *regbuf = alloca (max_register_size (current_gdbarch));
+ unsigned char regbuf[MAX_REGISTER_SIZE];
char *p;
val = 0;
long *register_offset;
long *sizeof_register;
- /* Useful constant. Largest of all the registers. */
- long max_register_size;
-
/* Cached table containing the type of each register. */
struct type **register_type;
};
read_register_bytes() and write_register_bytes() registers. */
descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
- descr->max_register_size = 0;
for (i = 0; i < descr->nr_cooked_registers; i++)
{
/* FIXME: cagney/2001-12-04: This code shouldn't need to use
entirely avoid this uglyness. */
descr->register_offset[i] = REGISTER_BYTE (i);
descr->sizeof_register[i] = REGISTER_RAW_SIZE (i);
- if (descr->max_register_size < REGISTER_RAW_SIZE (i))
- descr->max_register_size = REGISTER_RAW_SIZE (i);
- if (descr->max_register_size < REGISTER_VIRTUAL_SIZE (i))
- descr->max_register_size = REGISTER_VIRTUAL_SIZE (i);
+ gdb_assert (MAX_REGISTER_SIZE >= REGISTER_RAW_SIZE (i));
+ gdb_assert (MAX_REGISTER_SIZE >= REGISTER_VIRTUAL_SIZE (i));
}
/* Compute the real size of the register buffer. Start out by
long offset = 0;
descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
- descr->max_register_size = 0;
for (i = 0; i < descr->nr_cooked_registers; i++)
{
descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
descr->register_offset[i] = offset;
offset += descr->sizeof_register[i];
- if (descr->max_register_size < descr->sizeof_register[i])
- descr->max_register_size = descr->sizeof_register[i];
+ gdb_assert (MAX_REGISTER_SIZE >= descr->sizeof_register[i]);
}
/* Set the real size of the register cache buffer. */
descr->sizeof_cooked_registers = offset;
/* Utility functions returning useful register attributes stored in
the regcache descr. */
-int
-max_register_size (struct gdbarch *gdbarch)
-{
- struct regcache_descr *descr = regcache_descr (gdbarch);
- return descr->max_register_size;
-}
-
int
register_size (struct gdbarch *gdbarch, int regnum)
{
void *src)
{
struct gdbarch *gdbarch = dst->descr->gdbarch;
- void *buf = alloca (max_register_size (gdbarch));
+ char buf[MAX_REGISTER_SIZE];
int regnum;
/* The DST should be `read-only', if it wasn't then the save would
end up trying to write the register values back out to the
void *src)
{
struct gdbarch *gdbarch = dst->descr->gdbarch;
- void *buf = alloca (max_register_size (gdbarch));
+ char buf[MAX_REGISTER_SIZE];
int regnum;
/* The dst had better not be read-only. If it is, the `restore'
doesn't make much sense. */
regcache_read_ftype *read, regcache_write_ftype *write)
{
struct regcache_descr *descr = regcache->descr;
- bfd_byte *reg = alloca (descr->max_register_size);
+ bfd_byte reg[MAX_REGISTER_SIZE];
gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
/* Something to do? */
int footnote_register_offset = 0;
int footnote_register_type_name_null = 0;
long register_offset = 0;
- unsigned char *buf = alloca (regcache->descr->max_register_size);
+ unsigned char buf[MAX_REGISTER_SIZE];
#if 0
fprintf_unfiltered (file, "legacy_p %d\n", regcache->descr->legacy_p);
regcache->descr->sizeof_raw_registers);
fprintf_unfiltered (file, "sizeof_raw_register_valid_p %ld\n",
regcache->descr->sizeof_raw_register_valid_p);
- fprintf_unfiltered (file, "max_register_size %ld\n",
- regcache->descr->max_register_size);
fprintf_unfiltered (file, "NUM_REGS %d\n", NUM_REGS);
fprintf_unfiltered (file, "NUM_PSEUDO_REGS %d\n", NUM_PSEUDO_REGS);
#endif
extern struct type *register_type (struct gdbarch *gdbarch, int regnum);
-/* Return the size of the largest register. Used when allocating
- space for an aribtrary register value. */
-
-extern int max_register_size (struct gdbarch *gdbarch);
-
-
/* Return the size of register REGNUM. All registers should have only
one size.
fetch_regs_from_dump (int (*nextchar) (), char *want)
{
int regno;
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
int thischar = nextchar ();
&rpc, &rfp, &rsp, flags);
if (nfields >= 3)
{
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rpc);
supply_register (PC_REGNUM, buf);
}
{
- char *buf = alloca (max_register_size (current_gdbarch));
+ char buf[MAX_REGISTER_SIZE];
/* We got the number the register holds, but gdb expects to see a
value in the target byte ordering. */
}
else if (REGISTER_SIM_REGNO (regno) >= 0)
{
- char *tmp = alloca (max_register_size (current_gdbarch));
+ char tmp[MAX_REGISTER_SIZE];
int nr_bytes;
deprecated_read_register_gen (regno, tmp);
nr_bytes = sim_store_register (gdbsim_desc,
rom68k_supply_one_register (int regno, unsigned char *hex)
{
ULONGEST value;
- unsigned char *regbuf = alloca (max_register_size (current_gdbarch));
+ unsigned char regbuf[MAX_REGISTER_SIZE];
value = 0;
while (*hex != '\0')
static void
sh_do_register (int regnum)
{
- char *raw_buffer = alloca (max_register_size (current_gdbarch));
+ char raw_buffer[MAX_REGISTER_SIZE];
fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout);
if (regno != -1)
{
- char *raw = alloca (max_register_size (current_gdbarch));
+ char raw[MAX_REGISTER_SIZE];
deprecated_read_register_gen (regno, raw);
thread_db_fetch_registers (-1);