aboutsummaryrefslogtreecommitdiff
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
commit1cdb71fe7e3a2a6b0484c98d52e4b6f41081750d (patch)
treed6f8243cf6c2d9a583e20890db143fd877eea889 /gdb/hppa-tdep.c
parent97cb79ae08640ad0b6cee32c4d1b89735a25afc9 (diff)
downloadfsf-binutils-gdb-1cdb71fe7e3a2a6b0484c98d52e4b6f41081750d.zip
fsf-binutils-gdb-1cdb71fe7e3a2a6b0484c98d52e4b6f41081750d.tar.gz
fsf-binutils-gdb-1cdb71fe7e3a2a6b0484c98d52e4b6f41081750d.tar.bz2
* 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 3806be2..af72d8c 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));
+}