* mips-nat.c (zerobuf): Delete.
(fetch_inferior_registers): Alloc local zerobuf.
(fetch_core_registers): Alloc local zerobuf.
* d10v-tdep.c (show_regs): Don't allocate a dynamic array using
MAX_REGISTER_RAW_SIZE or MAX_REGISTER_VIRTUAL_SIZE.
* thread-db.c (thread_db_store_registers): Ditto.
* sh-tdep.c (sh_do_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote-sim.c (gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump): Ditto.
* monitor.c (monitor_supply_register): Ditto.
* mipsv4-nat.c (supply_gregset, supply_fpregset): Ditto.
* mips-nat.c (fetch_inferior_registers): Ditto.
* m68klinux-nat.c (fetch_register): Ditto.
* lynx-nat.c (fetch_inferior_registers): Ditto.
(fetch_inferior_registers): Ditto.
* irix4-nat.c (supply_gregset, supply_fpregset): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers): Ditto.
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (fetch_register): Ditto.
* hppab-nat.c (fetch_register): Ditto.
* hppa-tdep.c (pa_register_look_aside): Ditto.
(pa_print_fp_reg, pa_strcat_fp_reg): Ditto.
* dve3900-rom.c (fetch_bitmapped_register): Ditto.
+2003-02-02 Andrew Cagney <ac131313@redhat.com>
+
+ * mips-nat.c (zerobuf): Delete.
+ (fetch_inferior_registers): Alloc local zerobuf.
+ (fetch_core_registers): Alloc local zerobuf.
+ * d10v-tdep.c (show_regs): Don't allocate a dynamic array using
+ MAX_REGISTER_RAW_SIZE or MAX_REGISTER_VIRTUAL_SIZE.
+ * thread-db.c (thread_db_store_registers): Ditto.
+ * sh-tdep.c (sh_do_register): Ditto.
+ * rom68k-rom.c (rom68k_supply_one_register): Ditto.
+ * remote-sim.c (gdbsim_store_register): Ditto.
+ * remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
+ * remote-e7000.c (fetch_regs_from_dump): Ditto.
+ * monitor.c (monitor_supply_register): Ditto.
+ * mipsv4-nat.c (supply_gregset, supply_fpregset): Ditto.
+ * mips-nat.c (fetch_inferior_registers): Ditto.
+ * m68klinux-nat.c (fetch_register): Ditto.
+ * lynx-nat.c (fetch_inferior_registers): Ditto.
+ (fetch_inferior_registers): Ditto.
+ * irix4-nat.c (supply_gregset, supply_fpregset): Ditto.
+ * hpux-thread.c (hpux_thread_fetch_registers): Ditto.
+ (hpux_thread_store_registers): Ditto.
+ * hppah-nat.c (fetch_register): Ditto.
+ * hppab-nat.c (fetch_register): Ditto.
+ * hppa-tdep.c (pa_register_look_aside): Ditto.
+ (pa_print_fp_reg, pa_strcat_fp_reg): Ditto.
+ * dve3900-rom.c (fetch_bitmapped_register): Ditto.
+
2003-02-01 Andrew Cagney <ac131313@redhat.com>
* gdbarch.sh: Explictly specify all method levels. When a
printf_filtered ("\n");
}
printf_filtered ("A0-A%d", NR_A_REGS - 1);
- for (a = A0_REGNUM; a < A0_REGNUM + NR_A_REGS; a++)
- {
- char num[MAX_REGISTER_RAW_SIZE];
- int i;
- printf_filtered (" ");
- deprecated_read_register_gen (a, (char *) &num);
- for (i = 0; i < MAX_REGISTER_RAW_SIZE; i++)
- {
- printf_filtered ("%02x", (num[i] & 0xff));
- }
- }
+ {
+ char *num = alloca (max_register_size (current_gdbarch));
+ for (a = A0_REGNUM; a < A0_REGNUM + NR_A_REGS; a++)
+ {
+ int i;
+ printf_filtered (" ");
+ deprecated_read_register_gen (a, (char *) &num);
+ for (i = 0; i < MAX_REGISTER_RAW_SIZE; i++)
+ {
+ printf_filtered ("%02x", (num[i] & 0xff));
+ }
+ }
+ }
printf_filtered ("\n");
}
fetch_bitmapped_register (int regno, struct bit_field *bf)
{
unsigned long val;
- unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
+ unsigned char *regbuf = alloca (max_register_size (current_gdbarch));
char *regname = NULL;
if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
int start;
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
long long reg_val;
if (!know_which)
static void
pa_print_fp_reg (int i)
{
- char raw_buffer[MAX_REGISTER_RAW_SIZE];
- char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
+ char *raw_buffer = alloca (max_register_size (current_gdbarch));
+ char *virtual_buffer = alloca (max_register_size (current_gdbarch));
/* 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[MAX_REGISTER_RAW_SIZE];
- char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
+ char *raw_buffer = alloca (max_register_size (current_gdbarch));
+ char *virtual_buffer = alloca (max_register_size (current_gdbarch));
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[MAX_REGISTER_RAW_SIZE];
+ char *raw_buf = alloca (max_register_size (current_gdbarch));
/* 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[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
register int i;
/* Offset of registers within the u area. */
static void
fetch_register (int regno)
{
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
unsigned int addr, len, offset;
int i;
child_ops.to_fetch_registers (regno);
else
{
- unsigned char buf[MAX_REGISTER_RAW_SIZE];
+ unsigned char *buf = alloca (max_register_size (current_gdbarch));
CORE_ADDR sp;
sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;
child_ops.to_store_registers (regno);
else
{
- unsigned char buf[MAX_REGISTER_RAW_SIZE];
+ unsigned char *buf = alloca (max_register_size (current_gdbarch));
CORE_ADDR sp;
sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;
{
register int regi;
register greg_t *regp = (greg_t *) (gregsetp->gp_regs);
- static char zerobuf[MAX_REGISTER_RAW_SIZE] =
- {0};
+ char *zerobuf = alloca (max_register_size (current_gdbarch));
+ memset (zerobuf, 0, max_register_size (current_gdbarch));
/* 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;
- static char zerobuf[MAX_REGISTER_RAW_SIZE] =
- {0};
+ char *zerobuf = alloca (max_register_size (current_gdbarch));
+ memset (zerobuf, 0, max_register_size (current_gdbarch));
for (regi = 0; regi < 32; regi++)
supply_register (FP0_REGNUM + regi,
if (whatregs & WHATREGS_GEN)
{
struct econtext ec; /* general regs */
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
int retval;
int i;
ecp = registers_addr (PIDGET (inferior_ptid));
- for (regno = reglo; regno <= reghi; regno++)
- {
- char buf[MAX_REGISTER_RAW_SIZE];
- int ptrace_fun = PTRACE_PEEKTHREAD;
-
+ {
+ char *buf = alloca (max_register_size (current_gdbarch));
+ for (regno = reglo; regno <= reghi; regno++)
+ {
+ int ptrace_fun = PTRACE_PEEKTHREAD;
+
#ifdef M68K
- ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD;
+ ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD;
#endif
-
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
- {
- unsigned int reg;
-
- errno = 0;
- reg = ptrace (ptrace_fun, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), 0);
- if (errno)
- perror_with_name ("ptrace(PTRACE_PEEKUSP)");
-
- *(int *) &buf[i] = reg;
- }
- supply_register (regno, buf);
- }
+
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+ {
+ unsigned int reg;
+
+ errno = 0;
+ reg = ptrace (ptrace_fun, PIDGET (inferior_ptid),
+ (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), 0);
+ if (errno)
+ perror_with_name ("ptrace(PTRACE_PEEKUSP)");
+
+ *(int *) &buf[i] = reg;
+ }
+ supply_register (regno, buf);
+ }
+ }
}
/* Store our register values back into the inferior.
char mess[128]; /* For messages */
register int i;
unsigned int offset; /* Offset of registers within the u area. */
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
int tid;
if (CANNOT_FETCH_REGISTER (regno))
: regno >= FP0_REGNUM ? FPR_BASE + (regno - FP0_REGNUM) \
: 0)
-static char zerobuf[MAX_REGISTER_RAW_SIZE] =
-{0};
-
static void fetch_core_registers (char *, unsigned, int, CORE_ADDR);
/* Get all registers from the inferior */
fetch_inferior_registers (int regno)
{
register unsigned int regaddr;
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
register int i;
+ char *zerobuf = alloca (max_register_size (current_gdbarch));
+ memset (zerobuf, 0, max_register_size (current_gdbarch));
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));
+
+
/* If u.u_ar0 was an absolute address in the core file, relativize it now,
so we can use it as an offset into core_reg_sect. When we're done,
"register 0" will be at core_reg_sect+reg_ptr, and we can use
{
register int regi;
register greg_t *regp = &(*gregsetp)[0];
- static char zerobuf[MAX_REGISTER_RAW_SIZE] =
- {0};
+ char *zerobuf = alloca (max_register_size (current_gdbarch));
+ memset (zerobuf, 0, max_register_size (current_gdbarch));
for (regi = 0; regi <= CXT_RA; regi++)
supply_register (regi, (char *) (regp + regi));
supply_fpregset (fpregset_t *fpregsetp)
{
register int regi;
- static char zerobuf[MAX_REGISTER_RAW_SIZE] =
- {0};
+ char *zerobuf = alloca (max_register_size (current_gdbarch));
+ memset (zerobuf, 0, max_register_size (current_gdbarch));
for (regi = 0; regi < 32; regi++)
supply_register (FP0_REGNUM + regi,
monitor_supply_register (int regno, char *valstr)
{
ULONGEST val;
- unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
+ unsigned char *regbuf = alloca (max_register_size (current_gdbarch));
char *p;
val = 0;
fetch_regs_from_dump (int (*nextchar) (), char *want)
{
int regno;
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
int thischar = nextchar ();
&rpc, &rfp, &rsp, flags);
if (nfields >= 3)
{
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rpc);
supply_register (PC_REGNUM, buf);
}
{
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
/* 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[MAX_REGISTER_RAW_SIZE];
+ char *tmp = alloca (max_register_size (current_gdbarch));
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[MAX_REGISTER_RAW_SIZE];
+ unsigned char *regbuf = alloca (max_register_size (current_gdbarch));
value = 0;
while (*hex != '\0')
static void
sh_do_register (int regnum)
{
- char raw_buffer[MAX_REGISTER_RAW_SIZE];
+ char *raw_buffer = alloca (max_register_size (current_gdbarch));
fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout);
if (regno != -1)
{
- char raw[MAX_REGISTER_RAW_SIZE];
+ char *raw = alloca (max_register_size (current_gdbarch));
deprecated_read_register_gen (regno, raw);
thread_db_fetch_registers (-1);