+2003-10-01 Andrew Cagney <cagney@redhat.com>
+
+ * infcall.c (call_function_by_hand): When STRUCT_RETURN, always
+ use STRUCT_ADDR. When not using "struct return convention", pass
+ "0" to "value_being_returned". Add FIXMEs.
+ * infcmd.c (print_return_value): Pass an explicit 0/1 to
+ value_being_returned. Add comments.
+ * values.c (value_being_returned): Add fixme.
+ * hppa-tdep.c (hppa_extract_struct_value_address): Add FIXME.
+ (hppa_value_returned_from_stack): Add FIXME.
+
2003-09-30 David Carlton <carlton@kealia.com>
* dwarf2read.c (struct die_info): Add 'parent' field; replace
This function does the same stuff as value_being_returned in values.c, but
gets the value from the stack rather than from the buffer where all the
registers were saved when the function called completed. */
+/* FIXME: cagney/2003-09-27: This function is no longer needed. The
+ inferior function call code now directly handles the case described
+ above. */
struct value *
hppa_value_returned_from_stack (struct type *valtype, CORE_ADDR addr)
{
the address size is equal to the size of an int* _on the host_...
One possible implementation that crossed my mind is to use
extract_address. */
+ /* FIXME: cagney/2003-09-27: This function can probably go. ELZ
+ writes: We cannot assume on the pa that r28 still contains the
+ address of the returned structure. Usually this will be
+ overwritten by the callee. */
return (*(int *)(regbuf + DEPRECATED_REGISTER_BYTE (28)));
}
address of the returned structure. Usually this will be
overwritten by the callee. I don't know about other
architectures, so I defined this macro */
+ /* FIXME: cagney/2003-09-27: This is no longer needed. The problem
+ is now handled directly be by the code below. */
#ifdef DEPRECATED_VALUE_RETURNED_FROM_STACK
if (struct_return)
{
return DEPRECATED_VALUE_RETURNED_FROM_STACK (value_type, struct_addr);
}
#endif
- /* NOTE: cagney/2002-09-10: Only when the stack has been correctly
- aligned (using frame_align()) do we can trust STRUCT_ADDR and
- fetch the return value direct from the stack. This lack of trust
- comes about because legacy targets have a nasty habit of
- silently, and local to PUSH_ARGUMENTS(), moving STRUCT_ADDR. For
- such targets, just hope that value_being_returned() can find the
- adjusted value. */
- if (struct_return && gdbarch_frame_align_p (current_gdbarch))
+ if (struct_return)
{
+ /* NOTE: cagney/2003-09-27: This assumes that PUSH_DUMMY_CALL
+ has correctly stored STRUCT_ADDR in the target. In the past
+ that hasn't been the case, the old MIPS PUSH_ARGUMENTS
+ (PUSH_DUMMY_CALL precursor) would silently move the location
+ of the struct return value making STRUCT_ADDR bogus. If
+ you're seeing problems with values being returned using the
+ "struct return convention", check that PUSH_DUMMY_CALL isn't
+ playing tricks. */
struct value *retval = value_at (value_type, struct_addr, NULL);
do_cleanups (retbuf_cleanup);
return retval;
}
else
{
- struct value *retval = value_being_returned (value_type, retbuf,
- struct_return);
+ /* This call to value_being_returned is never made when the
+ function uses "struct return convention". Hence, pass "0"
+ instead of STRUCT_RETURN. Besides, VALUE_TYPE, in
+ combination with RETURN_VALUE() (nee USE_STRUCT_CONVENTION)
+ can be used to re-construct the value of STRUCT_RETURN. */
+ struct value *retval = value_being_returned (value_type, retbuf, 0);
do_cleanups (retbuf_cleanup);
return retval;
}
if (!structure_return)
{
- value = value_being_returned (value_type, stop_registers, structure_return);
+ value = value_being_returned (value_type, stop_registers, 0);
stb = ui_out_stream_new (uiout);
ui_out_text (uiout, "Value returned is ");
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
}
else
{
+ /* FIXME: 2003-09-27: This code block should be handling the
+ "use struct convention" case, and not the function
+ value_being_returned. This would allow the dramatic
+ simplification of value_being_returned (perhaphs renamed to
+ register_value_being_returned). */
+ /* FIXME: 2003-09-27: When returning from a nested inferior
+ function call, it's possible (with no help from the
+ architecture vector) to locate and return/print a "struct
+ return" value. This is just a more complicated case of what
+ is already being done in in the inferior function call code.
+ In fact, when inferior function calls are made async, this
+ will likely be made the norm. */
/* 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 */
ui_out_text (uiout, ".");
ui_out_text (uiout, " Cannot determine contents\n");
#else
- value = value_being_returned (value_type, stop_registers, structure_return);
+ value = value_being_returned (value_type, stop_registers, 1);
stb = ui_out_stream_new (uiout);
ui_out_text (uiout, "Value returned is ");
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
0 when it is using the value returning conventions (this often
means returning pointer to where structure is vs. returning value). */
+/* FIXME: cagney/2003-09-27: Should move the "struct return
+ convention" code to the only call site in print_return_value that
+ needs it. This function can then be renamed to
+ "register_value_being_returned" and with the "struct_return"
+ parameter dropped. */
+
struct value *
value_being_returned (struct type *valtype, struct regcache *retbuf,
int struct_return)