2001-11-29 Jim Blandy <jimb@redhat.com>
+ Tighten up GDB's support for returning structs by value.
+ * s390-tdep.c (s390_use_struct_convention): New function.
+ (s390_gdbarch_init): Register it as the S/390's
+ USE_STRUCT_CONVENTION method. Register
+ generic_cannot_extract_struct_value_address as our
+ EXTRACT_STRUCT_VALUE_ADDRESS method.
+ * arch-utils.c (generic_cannot_extract_struct_value_address): New
+ function.
+ * arch-utils.h: Add corresponding prototype.
+
* values.c (value_being_returned): Make error message a proper
sentence.
}
+/* Under some ABI's that specify the `struct convention' for returning
+ structures by value, by the time we've returned from the function,
+ the return value is sitting there in the caller's buffer, but GDB
+ has no way to find the address of that buffer.
+
+ On such architectures, use this function as your
+ extract_struct_value_address method. When asked to a struct
+ returned by value in this fashion, GDB will print a nice error
+ message, instead of garbage. */
+CORE_ADDR
+generic_cannot_extract_struct_value_address (char *dummy)
+{
+ return 0;
+}
+
int
default_register_sim_regno (int num)
{
return sp;
}
+
+static int
+s390_use_struct_convention (int gcc_p, struct type *value_type)
+{
+ enum type_code code = TYPE_CODE (value_type);
+
+ return (code == TYPE_CODE_STRUCT
+ || code == TYPE_CODE_UNION);
+}
+
+
/* Return the GDB type object for the "standard" data type
of data in register N. */
struct type *
set_gdbarch_cannot_fetch_register (gdbarch, s390_cannot_fetch_register);
set_gdbarch_cannot_store_register (gdbarch, s390_cannot_fetch_register);
set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
- set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
+ set_gdbarch_use_struct_convention (gdbarch, s390_use_struct_convention);
set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
set_gdbarch_register_name (gdbarch, s390_register_name);
set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
+ set_gdbarch_extract_struct_value_address
+ (gdbarch, generic_cannot_extract_struct_value_address);
/* Parameters for inferior function calls. */
set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_extract_struct_value_address (gdbarch, 0);
set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_push_return_address (gdbarch, s390_push_return_address);
set_gdbarch_sizeof_call_dummy_words (gdbarch,