diff options
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r-- | gdb/mips-tdep.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c6ec5f9..2bd7127 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1227,6 +1227,7 @@ mips_extract_return_value (valtype, regbuf, valbuf) char *valbuf; { int regnum; + int offset = 0; regnum = 2; if (TYPE_CODE (valtype) == TYPE_CODE_FLT @@ -1234,7 +1235,13 @@ mips_extract_return_value (valtype, regbuf, valbuf) || (mips_fpu == MIPS_FPU_SINGLE && TYPE_LENGTH (valtype) <= 4))) regnum = FP0_REGNUM; - memcpy (valbuf, regbuf + REGISTER_BYTE (regnum), TYPE_LENGTH (valtype)); + if (TARGET_BYTE_ORDER == BIG_ENDIAN + && TYPE_CODE (valtype) != TYPE_CODE_FLT + && TYPE_LENGTH (valtype) < REGISTER_RAW_SIZE (regnum)) + offset = REGISTER_RAW_SIZE (regnum) - TYPE_LENGTH (valtype); + + memcpy (valbuf, regbuf + REGISTER_BYTE (regnum) + offset, + TYPE_LENGTH (valtype)); #ifdef REGISTER_CONVERT_TO_TYPE REGISTER_CONVERT_TO_TYPE(regnum, valtype, valbuf); #endif |