From 1cdb71fe7e3a2a6b0484c98d52e4b6f41081750d Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 19 Dec 2001 20:21:43 +0000 Subject: * 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. --- gdb/hppa-tdep.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'gdb/hppa-tdep.c') 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)); +} -- cgit v1.2.1