From: Peter Schauer Date: Sat, 12 Aug 1995 10:21:12 +0000 (+0000) Subject: * rs6000-tdep.c (extract_return_value): Fix returning of values X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=07781ac0c3881d419132b855f1c592b0d40d12d9;p=binutils-gdb.git * rs6000-tdep.c (extract_return_value): Fix returning of values whose length is less than the register size for big endian targets. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a0addb16a9e..fd4e6803632 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Sat Aug 12 03:18:04 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * rs6000-tdep.c (extract_return_value): Fix returning of values + whose length is less than the register size for big endian targets. + Fri Aug 11 13:04:32 1995 Kung Hsu * symtab.c (list_symbols): if break command set breakpoint on matched diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index bbfe9060a62..a6456450d97 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -826,6 +826,7 @@ extract_return_value (valtype, regbuf, valbuf) char regbuf[REGISTER_BYTES]; char *valbuf; { + int offset = 0; if (TYPE_CODE (valtype) == TYPE_CODE_FLT) { @@ -843,9 +844,15 @@ extract_return_value (valtype, regbuf, valbuf) memcpy (valbuf, &ff, sizeof(float)); } } - else + else { /* return value is copied starting from r3. */ - memcpy (valbuf, ®buf[REGISTER_BYTE (3)], TYPE_LENGTH (valtype)); + if (TARGET_BYTE_ORDER == BIG_ENDIAN + && TYPE_LENGTH (valtype) < REGISTER_RAW_SIZE (3)) + offset = REGISTER_RAW_SIZE (3) - TYPE_LENGTH (valtype); + + memcpy (valbuf, regbuf + REGISTER_BYTE (3) + offset, + TYPE_LENGTH (valtype)); + } }