summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-02-02 05:46:14 +0000
committerAndrew Cagney <cagney@redhat.com>2003-02-02 05:46:14 +0000
commit2a81fc667153ee44d05d28acb5160083f81583b5 (patch)
tree67bf7faade96b004993d14aba6dabe1ae7e5728a
parent3fe1dcb3daac0e83e17b0b47054eb9f223e0a109 (diff)
downloadgdb-2a81fc667153ee44d05d28acb5160083f81583b5.tar.gz
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.
-rw-r--r--gdb/ChangeLog28
-rw-r--r--gdb/d10v-tdep.c24
-rw-r--r--gdb/dve3900-rom.c2
-rw-r--r--gdb/hppa-tdep.c12
-rw-r--r--gdb/hppab-nat.c2
-rw-r--r--gdb/hppah-nat.c2
-rw-r--r--gdb/hpux-thread.c4
-rw-r--r--gdb/irix4-nat.c8
-rw-r--r--gdb/lynx-nat.c46
-rw-r--r--gdb/m68klinux-nat.c2
-rw-r--r--gdb/mips-nat.c11
-rw-r--r--gdb/mipsv4-nat.c8
-rw-r--r--gdb/monitor.c2
-rw-r--r--gdb/remote-e7000.c2
-rw-r--r--gdb/remote-mips.c4
-rw-r--r--gdb/remote-sim.c2
-rw-r--r--gdb/rom68k-rom.c2
-rw-r--r--gdb/sh-tdep.c2
-rw-r--r--gdb/thread-db.c2
19 files changed, 100 insertions, 65 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c7b99e30000..0ecfdec1706 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,31 @@
+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
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c
index a627645da9b..4cd3c6300f3 100644
--- a/gdb/d10v-tdep.c
+++ b/gdb/d10v-tdep.c
@@ -864,17 +864,19 @@ show_regs (char *args, int from_tty)
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");
}
diff --git a/gdb/dve3900-rom.c b/gdb/dve3900-rom.c
index 96f45010f61..e7329f8988a 100644
--- a/gdb/dve3900-rom.c
+++ b/gdb/dve3900-rom.c
@@ -455,7 +455,7 @@ static void
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]))
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 6c009340714..db497efdeef 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2636,7 +2636,7 @@ pa_register_look_aside (char *raw_regs, int regnum, long *raw_val)
int start;
- char buf[MAX_REGISTER_RAW_SIZE];
+ char *buf = alloca (max_register_size (current_gdbarch));
long long reg_val;
if (!know_which)
@@ -2833,8 +2833,8 @@ pa_strcat_registers (char *raw_regs, int regnum, int fpregs,
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);
@@ -2876,8 +2876,8 @@ pa_print_fp_reg (int i)
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);
@@ -2891,7 +2891,7 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision)
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);
diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c
index d8595875c90..3ec3a57e9ac 100644
--- a/gdb/hppab-nat.c
+++ b/gdb/hppab-nat.c
@@ -55,7 +55,7 @@ static void
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. */
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index ce60fa31ffd..51b74fc7ba0 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -189,7 +189,7 @@ store_inferior_registers (int regno)
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;
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index 26d57ba2586..29dce0b4367 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -285,7 +285,7 @@ hpux_thread_fetch_registers (int regno)
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;
@@ -347,7 +347,7 @@ hpux_thread_store_registers (int regno)
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;
diff --git a/gdb/irix4-nat.c b/gdb/irix4-nat.c
index 2283887a6f9..b44c5bbba49 100644
--- a/gdb/irix4-nat.c
+++ b/gdb/irix4-nat.c
@@ -51,8 +51,8 @@ supply_gregset (gregset_t *gregsetp)
{
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. */
@@ -104,8 +104,8 @@ void
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,
diff --git a/gdb/lynx-nat.c b/gdb/lynx-nat.c
index 37edc2bcb5c..b5cb29a630a 100644
--- a/gdb/lynx-nat.c
+++ b/gdb/lynx-nat.c
@@ -282,7 +282,7 @@ fetch_inferior_registers (int regno)
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;
@@ -510,29 +510,31 @@ fetch_inferior_registers (int regno)
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.
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index cf47dd1dd0d..0f0a7d10241 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -135,7 +135,7 @@ fetch_register (int regno)
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))
diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c
index 16009c2e545..f893e339c2e 100644
--- a/gdb/mips-nat.c
+++ b/gdb/mips-nat.c
@@ -62,9 +62,6 @@
: 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 */
@@ -73,8 +70,10 @@ void
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 ();
@@ -175,6 +174,10 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
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
diff --git a/gdb/mipsv4-nat.c b/gdb/mipsv4-nat.c
index ec46df60826..2695f1f8dbf 100644
--- a/gdb/mipsv4-nat.c
+++ b/gdb/mipsv4-nat.c
@@ -47,8 +47,8 @@ supply_gregset (gregset_t *gregsetp)
{
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));
@@ -102,8 +102,8 @@ void
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,
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 5a9bb60f988..8f1450069b7 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -894,7 +894,7 @@ char *
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;
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index 49909b104b1..efacde31494 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -785,7 +785,7 @@ void
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 ();
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index fc1cf7aa055..a23f72d4606 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1791,7 +1791,7 @@ mips_wait (ptid_t ptid, struct target_waitstatus *status)
&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);
@@ -1972,7 +1972,7 @@ mips_fetch_registers (int regno)
}
{
- 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. */
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 3e2a7cdd505..cc216493924 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -359,7 +359,7 @@ gdbsim_store_register (int regno)
}
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,
diff --git a/gdb/rom68k-rom.c b/gdb/rom68k-rom.c
index c065a87a7c1..57c0a182327 100644
--- a/gdb/rom68k-rom.c
+++ b/gdb/rom68k-rom.c
@@ -88,7 +88,7 @@ static char *
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')
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index fc1049b0255..1f044d054a6 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -4009,7 +4009,7 @@ sh64_do_pseudo_register (int regnum)
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);
diff --git a/gdb/thread-db.c b/gdb/thread-db.c
index fbb018b5b4c..808c29570f6 100644
--- a/gdb/thread-db.c
+++ b/gdb/thread-db.c
@@ -941,7 +941,7 @@ thread_db_store_registers (int regno)
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);