From 138dd57ce055b215ebf28057a2a54fcaf1048f66 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Thu, 26 Aug 1993 21:49:40 +0000 Subject: [PATCH] * config/mips/tm-mips.h (EXTRACT_STRUCT_VALUE_ADDRESS): Get struct return address from v0, not a0. --- gdb/config/mips/tm-mips.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index d414e5789e2..f2b657c3e19 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -115,6 +115,7 @@ extern CORE_ADDR mips_skip_prologue PARAMS ((CORE_ADDR addr, int lenient)); but do serve to get the desired values when passed to read_register. */ #define ZERO_REGNUM 0 /* read-only register, always 0 */ +#define V0_REGNUM 2 /* Function integer return value */ #define A0_REGNUM 4 /* Loc of first arg during a subr call */ #define SP_REGNUM 29 /* Contains address of top of stack */ #define RA_REGNUM 31 /* Contains return address value */ @@ -232,8 +233,13 @@ extern CORE_ADDR mips_skip_prologue PARAMS ((CORE_ADDR addr, int lenient)); /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ +/* The address is passed in a0 upon entry to the function, but when + the function exits, the compiler has copied the value to v0. This + seems to be a convention followed by both cc and gcc. */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF+16)) +#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ + (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ + REGISTER_RAW_SIZE (V0_REGNUM))) /* Structures are returned by ref in extra arg0 */ #define USE_STRUCT_CONVENTION(gcc_p, type) 1 -- 2.30.2