@@ -1978,11 +1978,11 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
struct type *member_type = check_typedef (TYPE_FIELD_TYPE (type, 0));
int len = TYPE_LENGTH (member_type);
int i;
+ bfd_byte *tmpbuf = (bfd_byte *) alloca (max_register_size (gdbarch));
for (i = 0; i < elements; i++)
{
int regno = AARCH64_V0_REGNUM + i;
- bfd_byte tmpbuf[MAX_REGISTER_SIZE];
if (aarch64_debug)
{
@@ -2236,7 +2236,7 @@ aarch64_pseudo_read_value (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum)
{
- gdb_byte reg_buf[MAX_REGISTER_SIZE];
+ gdb_byte *reg_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
struct value *result_value;
gdb_byte *buf;
@@ -2331,13 +2331,13 @@ static void
aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
- gdb_byte reg_buf[MAX_REGISTER_SIZE];
+ gdb_byte *reg_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
/* Ensure the register buffer is zero, we want gdb writes of the
various 'scalar' pseudo registers to behavior like architectural
writes, register width bytes are written the remainder are set to
zero. */
- memset (reg_buf, 0, sizeof (reg_buf));
+ memset (reg_buf, 0, register_size (gdbarch, regnum));
regnum -= gdbarch_num_regs (gdbarch);
@@ -244,7 +244,7 @@ alpha_register_to_value (struct frame_info *frame, int regnum,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte in[MAX_REGISTER_SIZE];
+ gdb_byte *in = (gdb_byte *) alloca (register_size (gdbarch, regnum));
/* Convert to TYPE. */
if (!get_frame_register_bytes (frame, regnum, 0,
@@ -266,7 +266,8 @@ static void
alpha_value_to_register (struct frame_info *frame, int regnum,
struct type *valtype, const gdb_byte *in)
{
- gdb_byte out[MAX_REGISTER_SIZE];
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+ gdb_byte *out = (gdb_byte *) alloca (register_size (gdbarch, regnum));
switch (TYPE_LENGTH (valtype))
{
@@ -8150,7 +8150,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
switch (gdbarch_tdep (gdbarch)->fp_model)
{
@@ -689,7 +689,7 @@ static enum register_status
bfin_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, gdb_byte *buffer)
{
- gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
enum register_status status;
if (regnum != BFIN_CC_REGNUM)
@@ -710,7 +710,7 @@ static void
bfin_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buffer)
{
- gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
if (regnum != BFIN_CC_REGNUM)
internal_error (__FILE__, __LINE__,
@@ -1252,7 +1252,7 @@ frame_unwind_register_signed (struct frame_info *frame, int regnum)
struct gdbarch *gdbarch = frame_unwind_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, regnum);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (size);
frame_unwind_register (frame, regnum, buf);
return extract_signed_integer (buf, size, byte_order);
@@ -1270,7 +1270,7 @@ frame_unwind_register_unsigned (struct frame_info *frame, int regnum)
struct gdbarch *gdbarch = frame_unwind_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, regnum);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (size);
frame_unwind_register (frame, regnum, buf);
return extract_unsigned_integer (buf, size, byte_order);
@@ -1389,6 +1389,8 @@ get_frame_register_bytes (struct frame_info *frame, int regnum,
error (_("Bad debug information detected: "
"Attempt to read %d bytes from registers."), len);
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
+
/* Copy the data. */
while (len > 0)
{
@@ -1410,7 +1412,6 @@ get_frame_register_bytes (struct frame_info *frame, int regnum,
}
else
{
- gdb_byte buf[MAX_REGISTER_SIZE];
enum lval_type lval;
CORE_ADDR addr;
int realnum;
@@ -1446,6 +1447,8 @@ put_frame_register_bytes (struct frame_info *frame, int regnum,
regnum++;
}
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
+
/* Copy the data. */
while (len > 0)
{
@@ -1460,8 +1463,6 @@ put_frame_register_bytes (struct frame_info *frame, int regnum,
}
else
{
- gdb_byte buf[MAX_REGISTER_SIZE];
-
deprecated_frame_register_read (frame, regnum, buf);
memcpy (buf + offset, myaddr, curr_len);
put_frame_register (frame, regnum, buf);
@@ -413,9 +413,10 @@ frv_linux_supply_gregset (const struct regset *regset,
int regnum, const void *gregs, size_t len)
{
int regi;
- char zerobuf[MAX_REGISTER_SIZE];
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ char *zerobuf = (char *) alloca (max_register_size (gdbarch));
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, max_register_size (gdbarch));
/* gr0 always contains 0. Also, the kernel passes the TBR value in
this slot. */
@@ -3250,7 +3250,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
int regnum,
struct value *result_value)
{
- gdb_byte raw_buf[MAX_REGISTER_SIZE];
+ gdb_byte *raw_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
enum register_status status;
gdb_byte *buf = value_contents_raw (result_value);
@@ -3455,7 +3455,7 @@ void
i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
- gdb_byte raw_buf[MAX_REGISTER_SIZE];
+ gdb_byte *raw_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
if (i386_mmx_regnum_p (gdbarch, regnum))
{
@@ -5037,7 +5037,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
uint32_t opcode;
uint8_t opcode8;
ULONGEST addr;
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
struct i386_record_s ir;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
uint8_t rex_w = -1;
@@ -899,7 +899,8 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
const gdb_byte *regs = (const gdb_byte *) xsave;
int i;
unsigned int clear_bv;
- static const gdb_byte zero[MAX_REGISTER_SIZE] = { 0 };
+ gdb_byte *zero = (gdb_byte *) alloca (max_register_size (gdbarch));
+ memset (zero, 0, max_register_size (gdbarch));
enum
{
none = 0x0,
@@ -1227,7 +1227,7 @@ ia64_register_to_value (struct frame_info *frame, int regnum,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte in[MAX_REGISTER_SIZE];
+ gdb_byte *in = (gdb_byte *) alloca (register_size (gdbarch, regnum));
/* Convert to TYPE. */
if (!get_frame_register_bytes (frame, regnum, 0,
@@ -1245,7 +1245,7 @@ ia64_value_to_register (struct frame_info *frame, int regnum,
struct type *valtype, const gdb_byte *in)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte out[MAX_REGISTER_SIZE];
+ gdb_byte *out = (gdb_byte *) alloca (register_size (gdbarch, regnum));
convert_typed_floating (in, valtype, out, ia64_ext_type (gdbarch));
put_frame_register (frame, regnum, out);
}
@@ -1453,6 +1453,9 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
}
}
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ gdb_byte *regval = (gdb_byte *) alloca (register_size (gdbarch, sp_regnum));
+
/* Loop, looking for prologue instructions, keeping track of
where preserved registers were spilled. */
while (pc < lim_pc)
@@ -1516,7 +1519,6 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
else if (qp == 0 && rN == 2
&& ((rM == fp_reg && fp_reg != 0) || rM == 12))
{
- gdb_byte buf[MAX_REGISTER_SIZE];
CORE_ADDR saved_sp = 0;
/* adds r2, spilloffset, rFramePointer
or
@@ -1532,10 +1534,9 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
this'll be wrong. FIXME */
if (this_frame)
{
- struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- get_frame_register (this_frame, sp_regnum, buf);
- saved_sp = extract_unsigned_integer (buf, 8, byte_order);
+ get_frame_register (this_frame, sp_regnum, regval);
+ saved_sp = extract_unsigned_integer (regval, 8, byte_order);
}
spill_addr = saved_sp
+ (rM == 12 ? 0 : mem_stack_frame_size)
@@ -2289,8 +2290,6 @@ static struct value *
ia64_sigtramp_frame_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
-
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct ia64_frame_cache *cache =
@@ -2305,6 +2304,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *this_frame,
{
CORE_ADDR pc = 0;
CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
if (addr != 0)
{
@@ -2495,8 +2495,8 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
long new_sof, old_sof;
- gdb_byte buf[MAX_REGISTER_SIZE];
-
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
+
/* We never call any libunwind routines that need to write registers. */
gdb_assert (!write);
@@ -2575,8 +2575,8 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum,
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
long new_sof, old_sof;
- gdb_byte buf[MAX_REGISTER_SIZE];
-
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
+
/* We never call any libunwind routines that need to write registers. */
gdb_assert (!write);
@@ -2982,7 +2982,8 @@ ia64_libunwind_frame_prev_register (struct frame_info *this_frame,
{
int rrb_pr = 0;
ULONGEST cfm;
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf
+ = (gdb_byte *) alloca (register_size (gdbarch, IA64_CFM_REGNUM));
/* Fetch predicate register rename base from current frame
marker for this frame. */
@@ -3229,9 +3230,9 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
float_elt_type = is_float_or_hfa_type (type);
if (float_elt_type != NULL)
{
- gdb_byte from[MAX_REGISTER_SIZE];
int offset = 0;
int regnum = IA64_FR8_REGNUM;
+ gdb_byte *from = (gdb_byte *) alloca (register_size (gdbarch, regnum));
int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
while (n-- > 0)
@@ -3294,9 +3295,9 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
float_elt_type = is_float_or_hfa_type (type);
if (float_elt_type != NULL)
{
- gdb_byte to[MAX_REGISTER_SIZE];
int offset = 0;
int regnum = IA64_FR8_REGNUM;
+ gdb_byte *to = (gdb_byte *) alloca (register_size (gdbarch, regnum));
int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
while (n-- > 0)
@@ -3854,9 +3855,9 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
argoffset = 0;
len = TYPE_LENGTH (type);
+ gdb_byte *to = (gdb_byte *) alloca (max_register_size (gdbarch));
while (len > 0 && floatreg < IA64_FR16_REGNUM)
{
- gdb_byte to[MAX_REGISTER_SIZE];
convert_typed_floating (value_contents (arg) + argoffset,
float_elt_type, to,
ia64_ext_type (gdbarch));
@@ -677,7 +677,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
enum type_code typecode;
CORE_ADDR regval;
gdb_byte *val;
- gdb_byte valbuf[MAX_REGISTER_SIZE];
+ gdb_byte *valbuf = (gdb_byte *) alloca (max_register_size (gdbarch));
int len;
/* First force sp to a 4-byte alignment. */
@@ -707,7 +707,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
typecode = TYPE_CODE (type);
len = TYPE_LENGTH (type);
- memset (valbuf, 0, sizeof (valbuf));
+ memset (valbuf, 0, max_register_size (gdbarch));
/* Passes structures that do not fit in 2 registers by reference. */
if (len > 8
@@ -105,7 +105,7 @@ fetch_register (struct regcache *regcache, int regno)
struct gdbarch *gdbarch = get_regcache_arch (regcache);
long regaddr, val;
int i;
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regno));
int tid;
/* Overload thread id onto process id. */
@@ -160,7 +160,7 @@ store_register (const struct regcache *regcache, int regno)
long regaddr, val;
int i;
int tid;
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regno));
/* Overload thread id onto process id. */
tid = ptid_get_lwp (inferior_ptid);
@@ -1135,8 +1135,8 @@ register_changed_p (int regnum, struct regcache *prev_regs,
struct regcache *this_regs)
{
struct gdbarch *gdbarch = get_regcache_arch (this_regs);
- gdb_byte prev_buffer[MAX_REGISTER_SIZE];
- gdb_byte this_buffer[MAX_REGISTER_SIZE];
+ gdb_byte *prev_buffer = (gdb_byte *) alloca (max_register_size (gdbarch));
+ gdb_byte *this_buffer = (gdb_byte *) alloca (max_register_size (gdbarch));
enum register_status prev_status;
enum register_status this_status;
@@ -63,7 +63,7 @@ mips_fbsd_supply_reg (struct regcache *regcache, int regnum, const void *addr,
else
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
LONGEST val;
val = extract_signed_integer ((const gdb_byte *) addr, len, byte_order);
@@ -90,7 +90,7 @@ mips_fbsd_collect_reg (const struct regcache *regcache, int regnum, void *addr,
else
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
LONGEST val;
regcache_raw_collect (regcache, regnum, buf);
@@ -118,7 +118,8 @@ supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
+
store_signed_integer (buf, register_size (gdbarch, regnum), byte_order,
extract_signed_integer ((const gdb_byte *) addr, 4,
byte_order));
@@ -131,12 +132,12 @@ void
mips_supply_gregset (struct regcache *regcache,
const mips_elf_gregset_t *gregsetp)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int regi;
const mips_elf_greg_t *regp = *gregsetp;
- char zerobuf[MAX_REGISTER_SIZE];
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ char *zerobuf = (char *) alloca (max_register_size (gdbarch));
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, max_register_size (gdbarch));
for (regi = EF_REG0 + 1; regi <= EF_REG31; regi++)
supply_32bit_reg (regcache, regi - EF_REG0, regp + regi);
@@ -245,9 +246,9 @@ mips_supply_fpregset (struct regcache *regcache,
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int regi;
- char zerobuf[MAX_REGISTER_SIZE];
+ char *zerobuf = (char *) alloca (max_register_size (gdbarch));
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, max_register_size (gdbarch));
for (regi = 0; regi < 32; regi++)
regcache_raw_supply (regcache,
@@ -377,12 +378,12 @@ void
mips64_supply_gregset (struct regcache *regcache,
const mips64_elf_gregset_t *gregsetp)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int regi;
const mips64_elf_greg_t *regp = *gregsetp;
- gdb_byte zerobuf[MAX_REGISTER_SIZE];
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ gdb_byte *zerobuf = (gdb_byte *) alloca (max_register_size (gdbarch));
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, max_register_size (gdbarch));
for (regi = MIPS64_EF_REG0 + 1; regi <= MIPS64_EF_REG31; regi++)
supply_64bit_reg (regcache, regi - MIPS64_EF_REG0,
@@ -470,7 +471,7 @@ mips64_fill_gregset (const struct regcache *regcache,
if (regaddr != -1)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regno));
LONGEST val;
regcache_raw_collect (regcache, regno, buf);
@@ -574,7 +575,7 @@ mips64_fill_fpregset (const struct regcache *regcache,
}
else if (regno == mips_regnum (gdbarch)->fp_control_status)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regno));
LONGEST val;
regcache_raw_collect (regcache, regno, buf);
@@ -585,7 +586,7 @@ mips64_fill_fpregset (const struct regcache *regcache,
}
else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regno));
LONGEST val;
regcache_raw_collect (regcache, regno, buf);
@@ -4523,10 +4523,10 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now load as many as possible of the first arguments into
registers, and push the rest onto the stack. Loop thru args
from first to last. */
+ gdb_byte *valbuf = (gdb_byte *) alloca (max_register_size (gdbarch));
for (argnum = 0; argnum < nargs; argnum++)
{
const gdb_byte *val;
- gdb_byte valbuf[MAX_REGISTER_SIZE];
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
@@ -5757,7 +5757,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
/* A struct that contains one or two floats. Each value is part
in the least significant part of their floating point
register.. */
- gdb_byte reg[MAX_REGISTER_SIZE];
+ gdb_byte *reg = (gdb_byte *) alloca (max_register_size (gdbarch));
int regnum;
int field;
for (field = 0, regnum = mips_regnum (gdbarch)->fp0;
@@ -6472,7 +6472,7 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame,
{
struct gdbarch *gdbarch = get_frame_arch (frame);
/* Do values for GP (int) regs. */
- gdb_byte raw_buffer[MAX_REGISTER_SIZE];
+ gdb_byte *raw_buffer = (gdb_byte *) alloca (max_register_size (gdbarch));
int ncols = (mips_abi_regsize (gdbarch) == 8 ? 4 : 8); /* display cols
per row. */
int col, byte;
@@ -86,7 +86,9 @@ am33_supply_gregset_method (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
- char zerobuf[MAX_REGISTER_SIZE];
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int regsize = register_size (gdbarch, regnum);
+ char *zerobuf = (char *) alloca (regsize);
const mn10300_elf_greg_t *regp = (const mn10300_elf_greg_t *) gregs;
int i;
@@ -188,15 +190,15 @@ am33_supply_gregset_method (const struct regset *regset,
/* ssp, msp, and usp are inaccessible. */
case E_E8_REGNUM:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, regsize);
regcache_raw_supply (regcache, E_E8_REGNUM, zerobuf);
break;
case E_E9_REGNUM:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, regsize);
regcache_raw_supply (regcache, E_E9_REGNUM, zerobuf);
break;
case E_E10_REGNUM:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, regsize);
regcache_raw_supply (regcache, E_E10_REGNUM, zerobuf);
break;
@@ -218,11 +220,11 @@ am33_supply_gregset_method (const struct regset *regset,
break;
case E_FPCR_REGNUM + 1:
/* The two unused registers beyond fpcr are inaccessible. */
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, regsize);
regcache_raw_supply (regcache, E_FPCR_REGNUM + 1, zerobuf);
break;
case E_FPCR_REGNUM + 2:
- memset (zerobuf, 0, MAX_REGISTER_SIZE);
+ memset (zerobuf, 0, regsize);
regcache_raw_supply (regcache, E_FPCR_REGNUM + 2, zerobuf);
break;
default: /* An error, obviously, but should we error out? */
@@ -195,7 +195,7 @@ static void
mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, void *valbuf)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
int len = TYPE_LENGTH (type);
int reg, regsz;
@@ -1223,7 +1223,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
int stack_offset = 0;
int argnum;
const gdb_byte *val;
- gdb_byte valbuf[MAX_REGISTER_SIZE];
+ gdb_byte *valbuf = (gdb_byte *) alloca (max_register_size (gdbarch));
/* This should be a nop, but align the stack just in case something
went wrong. Stacks are four byte aligned on the mn10300. */
@@ -496,7 +496,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno);
int bytes_transferred;
unsigned int offset; /* Offset of registers within the u area. */
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regno));
if (altivec_register_p (gdbarch, regno))
{
@@ -983,7 +983,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno);
int i;
size_t bytes_to_transfer;
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, regno));
if (altivec_register_p (gdbarch, regno))
{
@@ -69,6 +69,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ULONGEST saved_sp;
int argspace = 0; /* 0 is an initial wrong guess. */
int write_pass;
+ gdb_byte *regval = (gdb_byte *) alloca (max_register_size (gdbarch));
gdb_assert (tdep->wordsize == 4);
@@ -134,7 +135,6 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Always store the floating point value using
the register's floating-point format. */
- gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum + freg);
convert_typed_floating (val, type, regval, regtype);
@@ -278,7 +278,6 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
if (write_pass)
{
- gdb_byte regval[MAX_REGISTER_SIZE];
const gdb_byte *p;
/* 32-bit decimal floats are right aligned in the
@@ -364,7 +363,6 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass)
{
int regnum = tdep->ppc_fp0_regnum + freg;
- gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, regnum);
convert_typed_floating (elval, eltype,
@@ -411,8 +409,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
else
{
- gdb_byte word[MAX_REGISTER_SIZE];
- store_unsigned_integer (word, tdep->wordsize, byte_order,
+ store_unsigned_integer (regval, tdep->wordsize, byte_order,
unpack_long (eltype, elval));
if (greg <= 10)
@@ -420,14 +417,14 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass)
regcache_cooked_write (regcache,
tdep->ppc_gp0_regnum + greg,
- word);
+ regval);
greg++;
}
else
{
argoffset = align_up (argoffset, tdep->wordsize);
if (write_pass)
- write_memory (sp + argoffset, word, tdep->wordsize);
+ write_memory (sp + argoffset, regval, tdep->wordsize);
argoffset += tdep->wordsize;
}
}
@@ -516,8 +513,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Reduce the parameter down to something that fits in a
"word". */
- gdb_byte word[MAX_REGISTER_SIZE];
- memset (word, 0, MAX_REGISTER_SIZE);
+ memset (regval, 0, max_register_size (gdbarch));
if (len > tdep->wordsize
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION)
@@ -535,31 +531,31 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
write_memory (sp + structoffset, val, len);
/* ... and then a "word" pointing to that address is
passed as the parameter. */
- store_unsigned_integer (word, tdep->wordsize, byte_order,
+ store_unsigned_integer (regval, tdep->wordsize, byte_order,
sp + structoffset);
structoffset += len;
}
else if (TYPE_CODE (type) == TYPE_CODE_INT)
/* Sign or zero extend the "int" into a "word". */
- store_unsigned_integer (word, tdep->wordsize, byte_order,
+ store_unsigned_integer (regval, tdep->wordsize, byte_order,
unpack_long (type, val));
else
/* Always goes in the low address. */
- memcpy (word, val, len);
+ memcpy (regval, val, len);
/* Store that "word" in a register, or on the stack.
The words have "4" byte alignment. */
if (greg <= 10)
{
if (write_pass)
regcache_cooked_write (regcache,
- tdep->ppc_gp0_regnum + greg, word);
+ tdep->ppc_gp0_regnum + greg, regval);
greg++;
}
else
{
argoffset = align_up (argoffset, tdep->wordsize);
if (write_pass)
- write_memory (sp + argoffset, word, tdep->wordsize);
+ write_memory (sp + argoffset, regval, tdep->wordsize);
argoffset += tdep->wordsize;
}
}
@@ -621,9 +617,11 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype,
/* 32-bit and 64-bit decimal floats in f1. */
if (TYPE_LENGTH (valtype) <= 8)
{
+ int regnum = tdep->ppc_fp0_regnum + 1;
if (writebuf != NULL)
{
- gdb_byte regval[MAX_REGISTER_SIZE];
+ gdb_byte *regval = (gdb_byte *) alloca (register_size (gdbarch,
+ regnum));
const gdb_byte *p;
/* 32-bit decimal float is right aligned in the doubleword. */
@@ -635,11 +633,11 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype,
else
p = writebuf;
- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, p);
+ regcache_cooked_write (regcache, regnum, p);
}
if (readbuf != NULL)
{
- regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, readbuf);
+ regcache_cooked_read (regcache, regnum, readbuf);
/* Left align 32-bit decimal float. */
if (TYPE_LENGTH (valtype) == 4)
@@ -695,6 +693,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
+ gdb_byte *regval = (gdb_byte *) alloca (max_register_size (gdbarch));
gdb_assert (tdep->wordsize == 4);
@@ -706,7 +705,6 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
{
/* Floats and doubles stored in "f1". Convert the value to
the required type. */
- gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch,
tdep->ppc_fp0_regnum + 1);
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
@@ -716,7 +714,6 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
{
/* Floats and doubles stored in "f1". Convert the value to
the register's "double" type. */
- gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
convert_typed_floating (writebuf, type, regval, regtype);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
@@ -847,7 +844,6 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
if (TYPE_CODE (eltype) == TYPE_CODE_FLT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + i;
- gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch, regnum);
if (writebuf != NULL)
@@ -972,12 +968,14 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
regcache_cooked_write (regcache, tdep->ppc_ev0_regnum + 3, writebuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
+
+ gdb_byte *regvals = (gdb_byte *) alloca (max_register_size (gdbarch) * 2);
+
if (broken_gcc && TYPE_LENGTH (type) <= 8)
{
/* GCC screwed up for structures or unions whose size is less
than or equal to 8 bytes.. Instead of left-aligning, it
right-aligns the data into the buffer formed by r3, r4. */
- gdb_byte regvals[MAX_REGISTER_SIZE * 2];
int len = TYPE_LENGTH (type);
int offset = (2 * tdep->wordsize - len) % tdep->wordsize;
@@ -992,7 +990,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
}
if (writebuf)
{
- memset (regvals, 0, sizeof regvals);
+ memset (regvals, 0, max_register_size (gdbarch) * 2);
memcpy (regvals + offset, writebuf, len);
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
regvals + 0 * tdep->wordsize);
@@ -1010,7 +1008,6 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
/* This matches SVr4 PPC, it does not match GCC. */
/* The value is right-padded to 8 bytes and then loaded, as
two "words", into r3/r4. */
- gdb_byte regvals[MAX_REGISTER_SIZE * 2];
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
regvals + 0 * tdep->wordsize);
if (TYPE_LENGTH (type) > tdep->wordsize)
@@ -1023,8 +1020,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
/* This matches SVr4 PPC, it does not match GCC. */
/* The value is padded out to 8 bytes and then loaded, as
two "words" into r3/r4. */
- gdb_byte regvals[MAX_REGISTER_SIZE * 2];
- memset (regvals, 0, sizeof regvals);
+ memset (regvals, 0, max_register_size (gdbarch) * 2);
memcpy (regvals, writebuf, TYPE_LENGTH (type));
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
regvals + 0 * tdep->wordsize);
@@ -1340,7 +1336,7 @@ ppc64_sysv_abi_push_integer (struct gdbarch *gdbarch, ULONGEST val,
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (max_register_size (gdbarch));
if (argpos->regcache)
store_unsigned_integer (buf, tdep->wordsize, byte_order, val);
@@ -1369,7 +1365,8 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
{
int regnum = tdep->ppc_fp0_regnum + argpos->freg;
struct type *regtype = register_type (gdbarch, regnum);
- gdb_byte regval[MAX_REGISTER_SIZE];
+ gdb_byte *regval = (gdb_byte *) alloca (register_size (gdbarch,
+ regnum));
convert_typed_floating (val, type, regval, regtype);
regcache_cooked_write (argpos->regcache, regnum, regval);
@@ -1814,7 +1811,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
struct type *regtype = register_type (gdbarch, regnum);
- gdb_byte regval[MAX_REGISTER_SIZE];
+ gdb_byte *regval = (gdb_byte *) alloca (register_size (gdbarch, regnum));
if (writebuf != NULL)
{
@@ -2069,10 +2066,10 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1)
/ tdep->wordsize);
int i;
+ gdb_byte *regval = (gdb_byte *) alloca (max_register_size (gdbarch));
for (i = 0; i < n_regs; i++)
{
- gdb_byte regval[MAX_REGISTER_SIZE];
int regnum = tdep->ppc_gp0_regnum + 3 + i;
int offset = i * tdep->wordsize;
int len = TYPE_LENGTH (valtype) - offset;
@@ -2082,7 +2079,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
if (writebuf != NULL)
{
- memset (regval, 0, sizeof regval);
+ memset (regval, 0, register_size (gdbarch, regnum));
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
&& offset == 0)
memcpy (regval + tdep->wordsize - len, writebuf, len);
@@ -698,7 +698,8 @@ record_full_exec_insn (struct regcache *regcache,
{
case record_full_reg: /* reg */
{
- gdb_byte reg[MAX_REGISTER_SIZE];
+ gdb_byte *reg = (gdb_byte *) alloca (register_size (gdbarch,
+ entry->u.reg.num));
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog,
@@ -792,15 +793,17 @@ static void
record_full_core_open_1 (const char *name, int from_tty)
{
struct regcache *regcache = get_current_regcache ();
- int regnum = gdbarch_num_regs (get_regcache_arch (regcache));
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int regnum = gdbarch_num_regs (gdbarch);
+ int regmaxsize = max_register_size (gdbarch);
int i;
/* Get record_full_core_regbuf. */
target_fetch_registers (regcache, -1);
- record_full_core_regbuf = (gdb_byte *) xmalloc (MAX_REGISTER_SIZE * regnum);
+ record_full_core_regbuf = (gdb_byte *) xmalloc (regmaxsize * regnum);
for (i = 0; i < regnum; i ++)
regcache_raw_collect (regcache, i,
- record_full_core_regbuf + MAX_REGISTER_SIZE * i);
+ record_full_core_regbuf + regmaxsize * i);
/* Get record_full_core_start and record_full_core_end. */
if (build_section_table (core_bfd, &record_full_core_start,
@@ -2038,6 +2041,9 @@ record_full_core_fetch_registers (struct target_ops *ops,
struct regcache *regcache,
int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int regmaxsize = max_register_size (gdbarch);
+
if (regno < 0)
{
int num = gdbarch_num_regs (get_regcache_arch (regcache));
@@ -2045,11 +2051,11 @@ record_full_core_fetch_registers (struct target_ops *ops,
for (i = 0; i < num; i ++)
regcache_raw_supply (regcache, i,
- record_full_core_regbuf + MAX_REGISTER_SIZE * i);
+ record_full_core_regbuf + regmaxsize * i);
}
else
regcache_raw_supply (regcache, regno,
- record_full_core_regbuf + MAX_REGISTER_SIZE * regno);
+ record_full_core_regbuf + regmaxsize * regno);
}
/* "to_prepare_to_store" method for prec over corefile. */
@@ -2067,9 +2073,12 @@ record_full_core_store_registers (struct target_ops *ops,
struct regcache *regcache,
int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int regmaxsize = max_register_size (gdbarch);
+
if (record_full_gdb_operation_disable)
regcache_raw_collect (regcache, regno,
- record_full_core_regbuf + MAX_REGISTER_SIZE * regno);
+ record_full_core_regbuf + regmaxsize * regno);
else
error (_("You can't do that without a process to debug."));
}
@@ -2265,7 +2274,7 @@ init_record_full_core_ops (void)
record_full_reg:
1 byte: record type (record_full_reg, see enum record_full_type).
8 bytes: register id (network byte order).
- MAX_REGISTER_SIZE bytes: register value.
+ max_register_size bytes: register value.
record_full_mem:
1 byte: record type (record_full_mem, see enum record_full_type).
8 bytes: memory length (network byte order).
@@ -439,6 +439,9 @@ gdbsim_fetch_register (struct target_ops *ops,
return;
}
+ int regsize = register_size (gdbarch, regno);
+ gdb_byte *buf = (gdb_byte *) alloca (regsize);
+
switch (gdbarch_register_sim_regno (gdbarch, regno))
{
case LEGACY_SIM_REGNO_IGNORE:
@@ -447,10 +450,9 @@ gdbsim_fetch_register (struct target_ops *ops,
{
/* For moment treat a `does not exist' register the same way
as an ``unavailable'' register. */
- gdb_byte buf[MAX_REGISTER_SIZE];
int nr_bytes;
- memset (buf, 0, MAX_REGISTER_SIZE);
+ memset (buf, 0, regsize);
regcache_raw_supply (regcache, regno, buf);
break;
}
@@ -458,18 +460,17 @@ gdbsim_fetch_register (struct target_ops *ops,
default:
{
static int warn_user = 1;
- gdb_byte buf[MAX_REGISTER_SIZE];
int nr_bytes;
gdb_assert (regno >= 0 && regno < gdbarch_num_regs (gdbarch));
- memset (buf, 0, MAX_REGISTER_SIZE);
+ memset (buf, 0, regsize);
nr_bytes = sim_fetch_register (sim_data->gdbsim_desc,
gdbarch_register_sim_regno
(gdbarch, regno),
buf,
- register_size (gdbarch, regno));
+ regsize);
if (nr_bytes > 0
- && nr_bytes != register_size (gdbarch, regno) && warn_user)
+ && nr_bytes != regsize && warn_user)
{
fprintf_unfiltered (gdb_stderr,
"Size of register %s (%d/%d) "
@@ -478,7 +479,7 @@ gdbsim_fetch_register (struct target_ops *ops,
regno,
gdbarch_register_sim_regno
(gdbarch, regno),
- nr_bytes, register_size (gdbarch, regno));
+ nr_bytes, regsize);
warn_user = 0;
}
/* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
@@ -492,7 +493,7 @@ gdbsim_fetch_register (struct target_ops *ops,
fprintf_unfiltered (gdb_stdlog,
"gdbsim_fetch_register: %d", regno);
/* FIXME: We could print something more intelligible. */
- dump_mem (buf, register_size (gdbarch, regno));
+ dump_mem (buf, regsize);
}
break;
}
@@ -516,15 +517,16 @@ gdbsim_store_register (struct target_ops *ops,
}
else if (gdbarch_register_sim_regno (gdbarch, regno) >= 0)
{
- gdb_byte tmp[MAX_REGISTER_SIZE];
+ int regsize = register_size (gdbarch, regno);
+ gdb_byte *tmp = (gdb_byte *) alloca (regsize);
int nr_bytes;
regcache_cooked_read (regcache, regno, tmp);
nr_bytes = sim_store_register (sim_data->gdbsim_desc,
gdbarch_register_sim_regno
(gdbarch, regno),
- tmp, register_size (gdbarch, regno));
- if (nr_bytes > 0 && nr_bytes != register_size (gdbarch, regno))
+ tmp, regsize);
+ if (nr_bytes > 0 && nr_bytes != regsize)
internal_error (__FILE__, __LINE__,
_("Register size different to expected"));
if (nr_bytes < 0)
@@ -538,7 +540,7 @@ gdbsim_store_register (struct target_ops *ops,
{
fprintf_unfiltered (gdb_stdlog, "gdbsim_store_register: %d", regno);
/* FIXME: We could print something more intelligible. */
- dump_mem (tmp, register_size (gdbarch, regno));
+ dump_mem (tmp, regsize);
}
}
}
@@ -236,6 +236,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
User may have to cast\args to handle promotion correctly
since gdb won't know if prototype supplied or not. */
+ gdb_byte *word = (gdb_byte *) alloca (max_register_size (gdbarch));
for (argno = 0, argbytes = 0; argno < nargs && ii < 8; ++ii)
{
int reg_size = register_size (gdbarch, ii + 3);
@@ -253,14 +254,12 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
Always store the floating point value using the register's
floating-point format. */
const int fp_regnum = tdep->ppc_fp0_regnum + 1 + f_argno;
- gdb_byte reg_val[MAX_REGISTER_SIZE];
struct type *reg_type = register_type (gdbarch, fp_regnum);
gdb_assert (len <= 8);
- convert_typed_floating (value_contents (arg), type,
- reg_val, reg_type);
- regcache_cooked_write (regcache, fp_regnum, reg_val);
+ convert_typed_floating (value_contents (arg), type, word, reg_type);
+ regcache_cooked_write (regcache, fp_regnum, word);
++f_argno;
}
@@ -270,7 +269,6 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Argument takes more than one register. */
while (argbytes < len)
{
- gdb_byte word[MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
memcpy (word,
((char *) value_contents (arg)) + argbytes,
@@ -290,8 +288,6 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else
{
/* Argument can fit in one register. No problem. */
- gdb_byte word[MAX_REGISTER_SIZE];
-
memset (word, 0, reg_size);
memcpy (word, value_contents (arg), len);
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
@@ -87,6 +87,7 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
User may have to cast\args to handle promotion correctly
since gdb won't know if prototype supplied or not. */
+ gdb_byte *word = (gdb_byte *) alloca (max_register_size (gdbarch));
for (argno = 0, argbytes = 0; argno < nargs && ii < 8; ++ii)
{
int reg_size = register_size (gdbarch, ii + 3);
@@ -105,24 +106,20 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
Always store the floating point value using the register's
floating-point format. */
const int fp_regnum = tdep->ppc_fp0_regnum + 1 + f_argno;
- gdb_byte reg_val[MAX_REGISTER_SIZE];
struct type *reg_type = register_type (gdbarch, fp_regnum);
gdb_assert (len <= 8);
- convert_typed_floating (value_contents (arg), type,
- reg_val, reg_type);
- regcache_cooked_write (regcache, fp_regnum, reg_val);
+ convert_typed_floating (value_contents (arg), type, word, reg_type);
+ regcache_cooked_write (regcache, fp_regnum, word);
++f_argno;
}
if (len > reg_size)
{
-
/* Argument takes more than one register. */
while (argbytes < len)
{
- gdb_byte word[MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
memcpy (word,
((char *) value_contents (arg)) + argbytes,
@@ -142,8 +139,6 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
else
{
/* Argument can fit in one register. No problem. */
- gdb_byte word[MAX_REGISTER_SIZE];
-
memset (word, 0, reg_size);
memcpy (word, value_contents (arg), len);
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
@@ -162,7 +162,7 @@ static void
fetch_register (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- int addr[MAX_REGISTER_SIZE];
+ int *addr = (int *) alloca (register_size (gdbarch, regno) * sizeof (int));
int nr, isfloat;
/* Retrieved values may be -1, so infer errors from errno. */
@@ -222,7 +222,7 @@ static void
store_register (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- int addr[MAX_REGISTER_SIZE];
+ int *addr = (int *) alloca (register_size (gdbarch, regno) * sizeof (int));
int nr, isfloat;
/* Fetch the register's value from the register cache. */
@@ -2590,8 +2590,7 @@ rs6000_register_to_value (struct frame_info *frame,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte from[MAX_REGISTER_SIZE];
-
+ gdb_byte *from = (gdb_byte *) alloca (register_size (gdbarch, regnum));
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (!get_frame_register_bytes (frame, regnum, 0,
@@ -2612,7 +2611,7 @@ rs6000_value_to_register (struct frame_info *frame,
const gdb_byte *from)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte to[MAX_REGISTER_SIZE];
+ gdb_byte *to = (gdb_byte *) alloca (register_size (gdbarch, regnum));
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
@@ -1648,7 +1648,6 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
int base_regnum;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
enum register_status status;
if (reg_nr == PSEUDO_BANK_REGNUM)
@@ -1656,6 +1655,8 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
base_regnum = dr_reg_base_num (gdbarch, reg_nr);
+ gdb_byte *temp_buffer
+ = (gdb_byte *) alloca (register_size (gdbarch, base_regnum));
/* Build the value in the provided buffer. */
/* Read the real regs for which this one is an alias. */
@@ -1687,7 +1688,6 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
int base_regnum, portion;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
if (reg_nr == PSEUDO_BANK_REGNUM)
{
@@ -1704,6 +1704,8 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
base_regnum = dr_reg_base_num (gdbarch, reg_nr);
+ gdb_byte *temp_buffer
+ = (gdb_byte *) alloca (register_size (gdbarch, base_regnum));
/* We must pay attention to the endiannes. */
sh_register_convert_to_raw (gdbarch, register_type (gdbarch, reg_nr),
@@ -1528,7 +1528,8 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int base_regnum;
int offset = 0;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
+ gdb_byte *temp_buffer = (gdb_byte *) alloca (max_register_size (gdbarch));
+
enum register_status status;
if (reg_nr >= DR0_REGNUM
@@ -1704,7 +1705,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int base_regnum, portion;
int offset;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
+ gdb_byte *temp_buffer = (gdb_byte *) alloca (max_register_size (gdbarch));
if (reg_nr >= DR0_REGNUM
&& reg_nr <= DR_LAST_REGNUM)
@@ -514,6 +514,7 @@ sol_thread_store_registers (struct target_ops *ops,
td_err_e val;
prgregset_t gregset;
prfpregset_t fpregset;
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (!ptid_tid_p (inferior_ptid))
{
@@ -535,7 +536,7 @@ sol_thread_store_registers (struct target_ops *ops,
if (regnum != -1)
{
/* Not writing all the registers. */
- char old_value[MAX_REGISTER_SIZE];
+ char *old_value = (char *) alloca (register_size (gdbarch, regnum));
/* Save new register value. */
regcache_raw_collect (regcache, regnum, old_value);
@@ -1667,7 +1667,7 @@ frame_info (char *addr_exp, int from_tty)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int sp_size = register_size (gdbarch, gdbarch_sp_regnum (gdbarch));
- gdb_byte value[MAX_REGISTER_SIZE];
+ gdb_byte *value = (gdb_byte *) alloca (sp_size);
CORE_ADDR sp;
frame_register_unwind (fi, gdbarch_sp_regnum (gdbarch),
@@ -3565,7 +3565,7 @@ debug_print_register (const char * func,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i, size = register_size (gdbarch, regno);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte *buf = (gdb_byte *) alloca (size);
regcache_raw_collect (regcache, regno, buf);
fprintf_unfiltered (gdb_stdlog, " = ");
@@ -370,7 +370,10 @@ static void
xtensa_register_write_masked (struct regcache *regcache,
xtensa_register_t *reg, const gdb_byte *buffer)
{
- unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ unsigned int *value = (unsigned int *) alloca (max_register_size (gdbarch)
+ + 1);
+
const xtensa_mask_t *mask = reg->mask;
int shift = 0; /* Shift for next mask (mod 32). */
@@ -454,7 +457,9 @@ static enum register_status
xtensa_register_read_masked (struct regcache *regcache,
xtensa_register_t *reg, gdb_byte *buffer)
{
- unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ unsigned int *value = (unsigned int *) alloca (max_register_size (gdbarch)
+ + 1);
const xtensa_mask_t *mask = reg->mask;
int shift = 0;
@@ -559,12 +564,11 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
&& (regnum >= gdbarch_tdep (gdbarch)->a0_base)
&& (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
{
- gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+ int wb_regnum = gdbarch_tdep (gdbarch)->wb_regnum;
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, wb_regnum));
enum register_status status;
- status = regcache_raw_read (regcache,
- gdbarch_tdep (gdbarch)->wb_regnum,
- buf);
+ status = regcache_raw_read (regcache, wb_regnum, buf);
if (status != REG_VALID)
return status;
regnum = arreg_number (gdbarch, regnum,
@@ -655,10 +659,10 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
&& (regnum >= gdbarch_tdep (gdbarch)->a0_base)
&& (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
{
- gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+ int wb_regnum = gdbarch_tdep (gdbarch)->wb_regnum;
+ gdb_byte *buf = (gdb_byte *) alloca (register_size (gdbarch, wb_regnum));
- regcache_raw_read (regcache,
- gdbarch_tdep (gdbarch)->wb_regnum, buf);
+ regcache_raw_read (regcache, wb_regnum, buf);
regnum = arreg_number (gdbarch, regnum,
extract_unsigned_integer (buf, 4, byte_order));
}