aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2001-01-02 23:51:35 +0000
committerMichael Snyder <msnyder@vmware.com>2001-01-02 23:51:35 +0000
commitd19b71becfea1edf90f911d59a91f50b13fcac2f (patch)
tree3b8c7ab041d9a2ce2e82cc29b9d4cce180e5e758 /gdb
parent3cac1297fb8e88a9b7e87ba94d75573bcebc5482 (diff)
downloadgdb-d19b71becfea1edf90f911d59a91f50b13fcac2f.zip
gdb-d19b71becfea1edf90f911d59a91f50b13fcac2f.tar.gz
gdb-d19b71becfea1edf90f911d59a91f50b13fcac2f.tar.bz2
2001-01-02 Michael Snyder <msnyder@cleaver.cygnus.com>
* sh-tdep.c (sh_extract_return_value): Allow for small return type. (sh_sh4_extract_return_value): Call sh_extract_return_value for
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/sh-tdep.c19
2 files changed, 18 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 517e743..6d6ab82 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
2001-01-02 Michael Snyder <msnyder@cleaver.cygnus.com>
+ * sh-tdep.c (sh_extract_return_value): Allow for small return type.
+ (sh_sh4_extract_return_value): Call sh_extract_return_value for
+ non-float types.
* sparc-tdep.c (sparc_frame_chain): Fix typo in comment.
Update copyright notice.
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index b3a8f9f..74783bf 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1060,8 +1060,20 @@ sh_extract_return_value (struct type *type, char *regbuf, char *valbuf)
static void
sh_default_store_return_value (struct type *type, char *valbuf)
{
- write_register_bytes (REGISTER_BYTE (0),
- valbuf, TYPE_LENGTH (type));
+ char buf[32]; /* more than enough... */
+
+ if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (R0_REGNUM))
+ {
+ /* Add leading zeros to the value. */
+ memset (buf, 0, REGISTER_RAW_SIZE (R0_REGNUM));
+ memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
+ valbuf, TYPE_LENGTH (type));
+ write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf,
+ REGISTER_RAW_SIZE (R0_REGNUM));
+ }
+ else
+ write_register_bytes (REGISTER_BYTE (R0_REGNUM), valbuf,
+ TYPE_LENGTH (type));
}
static void
@@ -1071,8 +1083,7 @@ sh3e_sh4_store_return_value (struct type *type, char *valbuf)
write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
valbuf, TYPE_LENGTH (type));
else
- write_register_bytes (REGISTER_BYTE (0),
- valbuf, TYPE_LENGTH (type));
+ sh_default_store_return_value (type, valbuf);
}