summaryrefslogtreecommitdiff
path: root/gdb/values.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2003-07-30 20:59:10 +0000
committerMichael Snyder <msnyder@specifix.com>2003-07-30 20:59:10 +0000
commit73564819f786db4216b510ba9a1c49196ae5b153 (patch)
tree7ecdba2f7f68a4c98a4670ad3c371ebcd5a3d62f /gdb/values.c
parent79e362059c2b2095e39b1122006507100b88322b (diff)
downloadgdb-73564819f786db4216b510ba9a1c49196ae5b153.tar.gz
2003-07-30 Michael Snyder <msnyder@redhat.com>
* structs.h (value_being_returned): Add a struct_addr argument. * infcall.c (call_function_by_hand): Pass struct_addr to value_being_returned. * infcmd.c (print_return_value): Pass zero as struct_addr. * values.c (value_being_returned): If struct_addr is passed, use it instead of trying to recover it from the inferior.
Diffstat (limited to 'gdb/values.c')
-rw-r--r--gdb/values.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/gdb/values.c b/gdb/values.c
index 42395c886e2..7e7e9b15534 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -1212,31 +1212,36 @@ value_from_double (struct type *type, DOUBLEST num)
/* ARGSUSED */
struct value *
value_being_returned (struct type *valtype, struct regcache *retbuf,
- int struct_return)
+ int struct_return, CORE_ADDR struct_addr)
{
struct value *val;
CORE_ADDR addr;
- /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
- if (EXTRACT_STRUCT_VALUE_ADDRESS_P ())
- if (struct_return)
- {
- addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf);
- if (!addr)
- error ("Function return value unknown.");
- return value_at (valtype, addr, NULL);
- }
-
- /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
- if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())
- if (struct_return)
- {
- char *buf = deprecated_grub_regcache_for_registers (retbuf);
- addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf);
- if (!addr)
- error ("Function return value unknown.");
- return value_at (valtype, addr, NULL);
- }
+ if (struct_return)
+ {
+ if (struct_addr != 0)
+ {
+ /* Struct return addr supplied by hand_function_call. */
+ return value_at (valtype, struct_addr, NULL);
+ }
+ /* If one of these is not defined, just use EXTRACT_RETURN_VALUE
+ instead. */
+ else if (EXTRACT_STRUCT_VALUE_ADDRESS_P ())
+ {
+ addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf);
+ if (!addr)
+ error ("Function return value unknown.");
+ return value_at (valtype, addr, NULL);
+ }
+ else if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())
+ {
+ char *buf = deprecated_grub_regcache_for_registers (retbuf);
+ addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf);
+ if (!addr)
+ error ("Function return value unknown.");
+ return value_at (valtype, addr, NULL);
+ }
+ }
val = allocate_value (valtype);
CHECK_TYPEDEF (valtype);