aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>1997-06-28 02:23:30 +0000
committerMichael Snyder <msnyder@vmware.com>1997-06-28 02:23:30 +0000
commit0af60e0326d6263693fcad779e7f41cdcaf012f7 (patch)
tree3d422e1e985af380f32d2ec24326bce27f83247c /gdb
parentd006e435275118ac736229dffd19874fee367f9f (diff)
downloadgdb-0af60e0326d6263693fcad779e7f41cdcaf012f7.zip
gdb-0af60e0326d6263693fcad779e7f41cdcaf012f7.tar.gz
gdb-0af60e0326d6263693fcad779e7f41cdcaf012f7.tar.bz2
Fri Jun 27 19:19:12 1997 Michael Snyder (msnyder@cleaver.cygnus.com)
* config/mips/tm-mips.h (USE_STRUCT_CONVENTION): MIPS_EABI returns structs in a register wherever possible.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/config/mips/tm-mips.h7
-rw-r--r--gdb/mips-tdep.c43
3 files changed, 45 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 407f956..0530076 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+Fri Jun 27 19:19:12 1997 Michael Snyder (msnyder@cleaver.cygnus.com)
+
+ * config/mips/tm-mips.h (USE_STRUCT_CONVENTION): MIPS_EABI returns
+ structs in a register wherever possible.
+ * mips-tdep.c (mips_extract_return_value): handle structs.
+ (mips_store_return_value): handle values smaller than MIPS_REGSIZE
+ (including structs, if gdb ever allows it).
+
start-sanitize-sh4
Fri Jun 20 17:58:34 1997 Fred Fish <fnf@cygnus.com>
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index 70bf2e4..ca92c35 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -331,9 +331,14 @@ extern void mips_store_return_value PARAMS ((struct type *, char *));
(extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
REGISTER_RAW_SIZE (V0_REGNUM)))
+#if MIPS_EABI
+#undef USE_STRUCT_CONVENTION
+#define USE_STRUCT_CONVENTION(gcc_p, type) \
+ (TYPE_LENGTH (type) > 2 * MIPS_REGSIZE)
+#else
/* Structures are returned by ref in extra arg0 */
#define USE_STRUCT_CONVENTION(gcc_p, type) 1
-
+#endif
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 7771cdb..285d379 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1907,15 +1907,21 @@ mips_extract_return_value (valtype, regbuf, valbuf)
regnum = 2;
if (TYPE_CODE (valtype) == TYPE_CODE_FLT
- && (mips_fpu == MIPS_FPU_DOUBLE
- || (mips_fpu == MIPS_FPU_SINGLE && len <= MIPS_REGSIZE)))
+ && (mips_fpu == MIPS_FPU_DOUBLE
+ || (mips_fpu == MIPS_FPU_SINGLE && len <= MIPS_REGSIZE)))
regnum = FP0_REGNUM;
- if (TARGET_BYTE_ORDER == BIG_ENDIAN
- && TYPE_CODE (valtype) != TYPE_CODE_FLT
- && len < REGISTER_RAW_SIZE (regnum))
- offset = REGISTER_RAW_SIZE (regnum) - len;
-
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ { /* "un-left-justify" the value from the register */
+ if (len < REGISTER_RAW_SIZE (regnum) &&
+ TYPE_CODE (valtype) != TYPE_CODE_FLT)
+ offset = REGISTER_RAW_SIZE (regnum) - len;
+ if (len > REGISTER_RAW_SIZE (regnum) && /* odd-size structs */
+ len < REGISTER_RAW_SIZE (regnum) * 2 &&
+ (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
+ TYPE_CODE (valtype) == TYPE_CODE_UNION))
+ offset = 2 * REGISTER_RAW_SIZE (regnum) - len;
+ }
memcpy (valbuf, regbuf + REGISTER_BYTE (regnum) + offset, len);
REGISTER_CONVERT_TO_TYPE (regnum, valtype, valbuf);
}
@@ -1928,18 +1934,31 @@ mips_store_return_value (valtype, valbuf)
char *valbuf;
{
int regnum;
+ int offset = 0;
+ int len = TYPE_LENGTH (valtype);
char raw_buffer[MAX_REGISTER_RAW_SIZE];
regnum = 2;
if (TYPE_CODE (valtype) == TYPE_CODE_FLT
- && (mips_fpu == MIPS_FPU_DOUBLE
- || (mips_fpu == MIPS_FPU_SINGLE && TYPE_LENGTH (valtype) <= 4))) /* FIXME!! */
+ && (mips_fpu == MIPS_FPU_DOUBLE
+ || (mips_fpu == MIPS_FPU_SINGLE && len <= MIPS_REGSIZE)))
regnum = FP0_REGNUM;
- memcpy(raw_buffer, valbuf, TYPE_LENGTH (valtype));
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ { /* "left-justify" the value in the register */
+ if (len < REGISTER_RAW_SIZE (regnum))
+ offset = REGISTER_RAW_SIZE (regnum) - len;
+ if (len > REGISTER_RAW_SIZE (regnum) && /* odd-size structs */
+ len < REGISTER_RAW_SIZE (regnum) * 2 &&
+ (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
+ TYPE_CODE (valtype) == TYPE_CODE_UNION))
+ offset = 2 * REGISTER_RAW_SIZE (regnum) - len;
+ }
+ memcpy(raw_buffer + offset, valbuf, len);
REGISTER_CONVERT_FROM_TYPE(regnum, valtype, raw_buffer);
-
- write_register_bytes(REGISTER_BYTE (regnum), raw_buffer, TYPE_LENGTH (valtype));
+ write_register_bytes(REGISTER_BYTE (regnum), raw_buffer,
+ len > REGISTER_RAW_SIZE (regnum) ?
+ len : REGISTER_RAW_SIZE (regnum));
}
/* Exported procedure: Is PC in the signal trampoline code */