summaryrefslogtreecommitdiff
path: root/gdb/hppa-tdep.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2001-12-19 20:21:43 +0000
committerJeff Law <law@redhat.com>2001-12-19 20:21:43 +0000
commit8bba41cbf75577623db609614c24b70d43ac6a2a (patch)
tree099db86c5732fa13ccdaca208836ad7ced5fb2d0 /gdb/hppa-tdep.c
parent8841474abc9ab2d3b7ae86a9c11f3d1bfe59aaa2 (diff)
downloadgdb-8bba41cbf75577623db609614c24b70d43ac6a2a.tar.gz
* config/pa/tm-hppa.h (STORE_RETURN_VALUE): Use hppa_store_return_value.
(EXTRACT_RETURN_VALUE): Similarly. * hppa-tdep.c (hppa_store_return_value): New function. (hppa_extract_return_value): New function.
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r--gdb/hppa-tdep.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 3806be29568..af72d8c4f74 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -4680,3 +4680,53 @@ _initialize_hppa_tdep (void)
"Print unwind table entry at given address.",
&maintenanceprintlist);
}
+
+/* Copy the function value from VALBUF into the proper location
+ for a function return.
+
+ Called only in the context of the "return" command. */
+
+void
+hppa_store_return_value (struct type *type, char *valbuf)
+{
+ /* For software floating point, the return value goes into the
+ integer registers. But we do not have any flag to key this on,
+ so we always store the value into the integer registers.
+
+ If its a float value, then we also store it into the floating
+ point registers. */
+ write_register_bytes (REGISTER_BYTE (28)
+ + (TYPE_LENGTH (type) > 4
+ ? (8 - TYPE_LENGTH (type))
+ : (4 - TYPE_LENGTH (type))),
+ valbuf,
+ TYPE_LENGTH (type));
+ if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT)
+ write_register_bytes (REGISTER_BYTE (FP4_REGNUM),
+ valbuf,
+ TYPE_LENGTH (type));
+}
+
+/* Copy the function's return value into VALBUF.
+
+ This function is called only in the context of "target function calls",
+ ie. when the debugger forces a function to be called in the child, and
+ when the debugger forces a fucntion to return prematurely via the
+ "return" command. */
+
+void
+hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+{
+ if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT)
+ memcpy (valbuf,
+ (char *)regbuf + REGISTER_BYTE (FP4_REGNUM),
+ TYPE_LENGTH (type));
+ else
+ memcpy (valbuf,
+ ((char *)regbuf
+ + REGISTER_BYTE (28)
+ + (TYPE_LENGTH (type) > 4
+ ? (8 - TYPE_LENGTH (type))
+ : (4 - TYPE_LENGTH (type)))),
+ TYPE_LENGTH (type));
+}