This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/mips] Fix bad stack allocation et.al.
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [patch/mips] Fix bad stack allocation et.al.
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 11 Jul 2000 01:07:10 +1000
FYI,
I've committed the attatched. It fixes some more obscure inferior
function call cases (for the old ABIs) where GDB would forget to
allocate space (or would miss allocate) space for numerous registers.
It also fixes many call-ar-st.exp failures :-)
Andrew
Mon Jul 10 18:06:18 2000 Andrew Cagney <cagney@b1.cygnus.com>
* mips-tdep.c (mips_push_arguments): Always align struct_addr on a
16 byte boundary. Align allocated argument space using
MIPS_STACK_ARGSIZE. Reserve space on stack for the struct return
and floating-point registers. Use fp_register_arg_p to determine
if float_argreg should be aligned.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.24
diff -p -r1.24 mips-tdep.c
*** mips-tdep.c 2000/07/07 09:19:02 1.24
--- mips-tdep.c 2000/07/10 15:00:31
*************** mips_push_arguments (nargs, args, sp, st
*** 2104,2116 ****
On at least one MIPS variant, stack frames need to be 128-bit
aligned, so we round to this widest known alignment. */
sp = ROUND_DOWN (sp, 16);
! struct_addr = ROUND_DOWN (struct_addr, MIPS_SAVED_REGSIZE);
/* Now make space on the stack for the args. We allocate more
than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
! len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_SAVED_REGSIZE);
sp -= ROUND_UP (len, 16);
if (mips_debug)
--- 2104,2116 ----
On at least one MIPS variant, stack frames need to be 128-bit
aligned, so we round to this widest known alignment. */
sp = ROUND_DOWN (sp, 16);
! struct_addr = ROUND_DOWN (struct_addr, 16);
/* Now make space on the stack for the args. We allocate more
than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
! len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_STACK_ARGSIZE);
sp -= ROUND_UP (len, 16);
if (mips_debug)
*************** mips_push_arguments (nargs, args, sp, st
*** 2126,2134 ****
{
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
! "mips_push_arguments: struct_return at r%d 0x%lx\n",
argreg, (long) struct_addr);
write_register (argreg++, struct_addr);
}
/* Now load as many as possible of the first arguments into
--- 2126,2136 ----
{
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
! "mips_push_arguments: struct_return reg=%d 0x%lx\n",
argreg, (long) struct_addr);
write_register (argreg++, struct_addr);
+ if (MIPS_REGS_HAVE_HOME_P)
+ stack_offset += MIPS_STACK_ARGSIZE;
}
/* Now load as many as possible of the first arguments into
*************** mips_push_arguments (nargs, args, sp, st
*** 2243,2248 ****
--- 2245,2253 ----
argreg += FP_REGISTER_DOUBLE ? 1 : 2;
}
}
+ /* Reserve space for the FP register. */
+ if (MIPS_REGS_HAVE_HOME_P)
+ stack_offset += ROUND_UP (len, MIPS_STACK_ARGSIZE);
}
else
{