- else if (gdbarch_return_value_p (current_gdbarch))
- /* 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. */
+
+ switch (gdbarch_return_value (gdbarch, value_type, NULL, NULL, NULL))
+ {
+ case RETURN_VALUE_REGISTER_CONVENTION:
+ case RETURN_VALUE_ABI_RETURNS_ADDRESS:
+ case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
+ value = allocate_value (value_type);
+ gdbarch_return_value (gdbarch, value_type, stop_registers,
+ value_contents_raw (value), NULL);
+ break;
+ case RETURN_VALUE_STRUCT_CONVENTION:
+ value = NULL;
+ break;
+ default:
+ internal_error (__FILE__, __LINE__, _("bad switch"));
+ }
+
+ if (value)
+ {
+ /* Print it. */
+ stb = ui_out_stream_new (uiout);
+ old_chain = make_cleanup_ui_out_stream_delete (stb);
+ ui_out_text (uiout, "Value returned is ");
+ ui_out_field_fmt (uiout, "gdb-result-var", "$%d",
+ record_latest_value (value));
+ ui_out_text (uiout, " = ");
+ value_print (value, stb->stream, 0, Val_no_prettyprint);
+ ui_out_field_stream (uiout, "return-value", stb);
+ ui_out_text (uiout, "\n");
+ do_cleanups (old_chain);
+ }
+ else