struct value *val = allocate_value (valtype);
/* If the function returns void, don't bother fetching the return
- value. */
+ value. See also "using_struct_return". */
if (TYPE_CODE (valtype) == TYPE_CODE_VOID)
return val;
NULL, NULL, NULL)
== RETURN_VALUE_REGISTER_CONVENTION);
gdbarch_return_value (current_gdbarch, valtype, retbuf,
- NULL, VALUE_CONTENTS_RAW (val));
+ VALUE_CONTENTS_RAW (val) /*read*/, NULL /*write*/);
return val;
}
-/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of
- EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc
- and TYPE is the type (which is known to be struct, union or array).
+/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of
+ EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc and TYPE
+ is the type (which is known to be struct, union or array).
On most machines, the struct convention is used unless we are
using gcc and the type is of a special size. */
if (code == TYPE_CODE_ERROR)
error ("Function return type unknown.");
+ if (code == TYPE_CODE_VOID)
+ /* A void return value is never in memory. See also corresponding
+ code in "register_value_being_returned". */
+ return 0;
+
if (!gdbarch_return_value_p (current_gdbarch))
{
/* FIXME: cagney/2003-10-01: The below is dead. Instead an
/* Probe the architecture for the return-value convention. */
return (gdbarch_return_value (current_gdbarch, value_type,
NULL, NULL, NULL)
- == RETURN_VALUE_STRUCT_CONVENTION);
+ != RETURN_VALUE_REGISTER_CONVENTION);
}
-/* Store VAL so it will be returned if a function returns now.
- Does not verify that VAL's type matches what the current
- function wants to return. */
-
-void
-set_return_value (struct value *val)
-{
- struct type *type = check_typedef (VALUE_TYPE (val));
- enum type_code code = TYPE_CODE (type);
-
- if (code == TYPE_CODE_ERROR)
- error ("Function return type unknown.");
-
- if (gdbarch_return_value_p (current_gdbarch))
- {
- switch (gdbarch_return_value (current_gdbarch, type, NULL, NULL, NULL))
- {
- case RETURN_VALUE_REGISTER_CONVENTION:
- /* Success. The architecture can deal with it, write it to
- the regcache. */
- gdbarch_return_value (current_gdbarch, type, current_regcache,
- VALUE_CONTENTS (val), NULL);
- return;
- case RETURN_VALUE_STRUCT_CONVENTION:
- /* Failure. For the moment, assume that it is not possible
- to find the location, on the stack, at which the "struct
- return" value should be stored. Only a warning because
- an error aborts the "return" command leaving GDB in a
- weird state. */
- warning ("Location of return value unknown");
- return;
- }
- }
-
-
- if (code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION) /* FIXME, implement struct return. */
- /* FIXME: cagney/2003-10-20: This should be an internal-warning.
- The problem is that while GDB's core supports "struct return"
- using "register convention", many architectures haven't been
- updated to implement the mechanisms needed to make it work.
- It's a warning, and not an error, as otherwize it will jump out
- of the "return" command leaving both GDB and the user in a very
- confused state. */
- {
- warning ("This architecture does not support specifying a struct or union return-value.");
- return;
- }
-
- STORE_RETURN_VALUE (type, current_regcache, VALUE_CONTENTS (val));
-}
-\f
void
_initialize_values (void)
{