This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: d10v inferior function calls
- From: Jackie Smith Cashion <jsmith at redhat dot com>
- To: GDB Patches <gdb-patches at sources dot redhat dot com>
- Date: Mon, 03 Dec 2001 10:31:39 -0600
- Subject: RFA: d10v inferior function calls
The following patch is needed for d10v inferior function calls. Please
consider it for approval.
2001-12-03 Jackie Smith Cashion <jsmith@redhat.com>
From Andrew Cagney <cagney@redhat.com>:
* d10v-tdep.c (d10v_frame_chain_valid): Check if the caller's PC
is in the entry function.
(d10v_use_struct_convention): Store multi-field struct and union
return values on the stack.
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 d10v-tdep.c
*** d10v-tdep.c 2001/11/15 02:18:46 1.26
--- d10v-tdep.c 2001/12/03 17:25:19
*************** static void do_d10v_pop_frame (struct fr
*** 103,109 ****
static int
d10v_frame_chain_valid (CORE_ADDR chain, struct frame_info *frame)
{
! return ((chain) != 0 && (frame) != 0 && (frame)->pc > IMEM_START);
}
static CORE_ADDR
--- 103,111 ----
static int
d10v_frame_chain_valid (CORE_ADDR chain, struct frame_info *frame)
{
! return ((chain) != 0 && (frame) != 0
! && (frame)->pc > IMEM_START
! && !inside_entry_file (FRAME_SAVED_PC (frame)));
}
static CORE_ADDR
*************** d10v_stack_align (CORE_ADDR len)
*** 122,128 ****
static int
d10v_use_struct_convention (int gcc_p, struct type *type)
{
! return (TYPE_LENGTH (type) > 8);
}
--- 124,154 ----
static int
d10v_use_struct_convention (int gcc_p, struct type *type)
{
! long alignment;
! int i;
! /* The d10v only passes a struct in a register when that structure
! has an alignment that matches the size of a register. */
! /* If the structure doesn't fit in 4 registers, put it on the
! stack. */
! if (TYPE_LENGTH (type) > 8)
! return 1;
! /* If the struct contains only one field, don't put it on the stack
! - gcc can fit it in one or more registers. */
! if (TYPE_NFIELDS (type) == 1)
! return 0;
! alignment = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0));
! for (i = 1; i < TYPE_NFIELDS (type); i++)
! {
! /* If the alignment changes, just assume it goes on the
! stack. */
! if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)) != alignment)
! return 1;
! }
! /* If the alignment is suitable for the d10v's 16 bit registers,
! don't put it on the stack. */
! if (alignment == 2 || alignment == 4)
! return 0;
! return 1;
}