diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1995-08-12 10:21:12 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1995-08-12 10:21:12 +0000 |
commit | 07781ac0c3881d419132b855f1c592b0d40d12d9 (patch) | |
tree | e19c4e1e77748e9973cf21a130265f7f4c740136 /gdb/rs6000-tdep.c | |
parent | f2d1b56f40d1723e46a7969f36ff1c20c73fc204 (diff) | |
download | gdb-07781ac0c3881d419132b855f1c592b0d40d12d9.zip gdb-07781ac0c3881d419132b855f1c592b0d40d12d9.tar.gz gdb-07781ac0c3881d419132b855f1c592b0d40d12d9.tar.bz2 |
* rs6000-tdep.c (extract_return_value): Fix returning of values
whose length is less than the register size for big endian targets.
Diffstat (limited to 'gdb/rs6000-tdep.c')
-rw-r--r-- | gdb/rs6000-tdep.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index bbfe906..a645645 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)); + } } |