2003-07-31 Michael Snyder <msnyder@redhat.com>

* value.h, values.c, infcall.c,	infcmd.c: Revert 07-30	change,
        which is already covered by the	new frames infrastructure.
This commit is contained in:
Michael Snyder 2003-07-31 23:41:25 +00:00
parent 6302298482
commit 4e7d75111e
5 changed files with 37 additions and 44 deletions

View file

@ -1,3 +1,8 @@
2003-07-31 Michael Snyder <msnyder@redhat.com>
* value.h, values.c, infcall.c, infcmd.c: Revert 07-30 change,
which is already covered by the new frames infrastructure.
2003-07-31 Andrew Cagney <cagney@redhat.com> 2003-07-31 Andrew Cagney <cagney@redhat.com>
* user-regs.c (struct user_reg): Add "next" link. * user-regs.c (struct user_reg): Add "next" link.
@ -21,7 +26,7 @@
2003-07-30 Michael Snyder <msnyder@redhat.com> 2003-07-30 Michael Snyder <msnyder@redhat.com>
* structs.h (value_being_returned): Add a struct_addr argument. * value.h (value_being_returned): Add a struct_addr argument.
* infcall.c (call_function_by_hand): Pass struct_addr to * infcall.c (call_function_by_hand): Pass struct_addr to
value_being_returned. value_being_returned.
* infcmd.c (print_return_value): Pass zero as struct_addr. * infcmd.c (print_return_value): Pass zero as struct_addr.

View file

@ -1056,10 +1056,8 @@ the function call).", name);
} }
else else
{ {
struct value *retval = value_being_returned (value_type, struct value *retval = value_being_returned (value_type, retbuf,
retbuf, struct_return);
struct_return,
struct_addr);
do_cleanups (retbuf_cleanup); do_cleanups (retbuf_cleanup);
return retval; return retval;
} }

View file

@ -1077,11 +1077,10 @@ print_return_value (int structure_return, struct type *value_type)
if (!structure_return) if (!structure_return)
{ {
value = value_being_returned (value_type, stop_registers, 0, 0); value = value_being_returned (value_type, stop_registers, structure_return);
stb = ui_out_stream_new (uiout); stb = ui_out_stream_new (uiout);
ui_out_text (uiout, "Value returned is "); ui_out_text (uiout, "Value returned is ");
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
record_latest_value (value));
ui_out_text (uiout, " = "); ui_out_text (uiout, " = ");
value_print (value, stb->stream, 0, Val_no_prettyprint); value_print (value, stb->stream, 0, Val_no_prettyprint);
ui_out_field_stream (uiout, "return-value", stb); ui_out_field_stream (uiout, "return-value", stb);
@ -1089,23 +1088,20 @@ print_return_value (int structure_return, struct type *value_type)
} }
else else
{ {
/* We cannot determine the contents of the structure because
it is on the stack, and we don't know where, since we did not
initiate the call, as opposed to the call_function_by_hand case */
#ifdef VALUE_RETURNED_FROM_STACK #ifdef VALUE_RETURNED_FROM_STACK
/* We cannot determine the contents of the structure because it
is on the stack, and we don't know where, since we did not
initiate the call, as opposed to the call_function_by_hand
case. */
value = 0; value = 0;
ui_out_text (uiout, "Value returned has type: "); ui_out_text (uiout, "Value returned has type: ");
ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type)); ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
ui_out_text (uiout, "."); ui_out_text (uiout, ".");
ui_out_text (uiout, " Cannot determine contents\n"); ui_out_text (uiout, " Cannot determine contents\n");
#else #else
value = value_being_returned (value_type, stop_registers, value = value_being_returned (value_type, stop_registers, structure_return);
structure_return, 0);
stb = ui_out_stream_new (uiout); stb = ui_out_stream_new (uiout);
ui_out_text (uiout, "Value returned is "); ui_out_text (uiout, "Value returned is ");
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
record_latest_value (value));
ui_out_text (uiout, " = "); ui_out_text (uiout, " = ");
value_print (value, stb->stream, 0, Val_no_prettyprint); value_print (value, stb->stream, 0, Val_no_prettyprint);
ui_out_field_stream (uiout, "return-value", stb); ui_out_field_stream (uiout, "return-value", stb);

View file

@ -420,8 +420,7 @@ extern struct value *value_subscript (struct value *array, struct value *idx);
extern struct value *value_being_returned (struct type *valtype, extern struct value *value_being_returned (struct type *valtype,
struct regcache *retbuf, struct regcache *retbuf,
int struct_return, int struct_return);
CORE_ADDR struct_addr);
extern struct value *value_in (struct value *element, struct value *set); extern struct value *value_in (struct value *element, struct value *set);

View file

@ -1212,36 +1212,31 @@ value_from_double (struct type *type, DOUBLEST num)
/* ARGSUSED */ /* ARGSUSED */
struct value * struct value *
value_being_returned (struct type *valtype, struct regcache *retbuf, value_being_returned (struct type *valtype, struct regcache *retbuf,
int struct_return, CORE_ADDR struct_addr) int struct_return)
{ {
struct value *val; struct value *val;
CORE_ADDR addr; CORE_ADDR addr;
if (struct_return) /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
{ if (EXTRACT_STRUCT_VALUE_ADDRESS_P ())
if (struct_addr != 0) if (struct_return)
{ {
/* Struct return addr supplied by hand_function_call. */ addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf);
return value_at (valtype, struct_addr, NULL); if (!addr)
} error ("Function return value unknown.");
/* If one of these is not defined, just use EXTRACT_RETURN_VALUE return value_at (valtype, addr, NULL);
instead. */ }
else if (EXTRACT_STRUCT_VALUE_ADDRESS_P ())
{ /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf); if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())
if (!addr) if (struct_return)
error ("Function return value unknown."); {
return value_at (valtype, addr, NULL); char *buf = deprecated_grub_regcache_for_registers (retbuf);
} addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf);
else if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()) if (!addr)
{ error ("Function return value unknown.");
char *buf = deprecated_grub_regcache_for_registers (retbuf); return value_at (valtype, addr, NULL);
addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf); }
if (!addr)
error ("Function return value unknown.");
return value_at (valtype, addr, NULL);
}
}
val = allocate_value (valtype); val = allocate_value (valtype);
CHECK_TYPEDEF (valtype); CHECK_TYPEDEF (valtype);