/* Frameless functions not identifable. */
extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_invocation_not;
+/* Only structures, unions, and arrays are returned using the struct
+ convention. Note that arrays are never passed by value in the C
+ language family, so that case is irrelevant for C. */
+extern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not;
+
/* Map onto old REGISTER_NAMES. */
extern char *legacy_register_name (int i);
gdbarch_register_convert_to_raw_ftype *register_convert_to_raw;
gdbarch_pointer_to_address_ftype *pointer_to_address;
gdbarch_address_to_pointer_ftype *address_to_pointer;
+ gdbarch_return_value_on_stack_ftype *return_value_on_stack;
gdbarch_extract_return_value_ftype *extract_return_value;
gdbarch_push_arguments_ftype *push_arguments;
gdbarch_push_dummy_frame_ftype *push_dummy_frame;
0,
0,
0,
+ 0,
/* startup_gdbarch() */
};
struct gdbarch *current_gdbarch = &startup_gdbarch;
gdbarch->register_convertible = generic_register_convertible_not;
gdbarch->pointer_to_address = generic_pointer_to_address;
gdbarch->address_to_pointer = generic_address_to_pointer;
+ gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
gdbarch->breakpoint_from_pc = legacy_breakpoint_from_pc;
gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
/* Skip verify of register_convert_to_raw, invalid_p == 0 */
/* Skip verify of pointer_to_address, invalid_p == 0 */
/* Skip verify of address_to_pointer, invalid_p == 0 */
+ /* Skip verify of return_value_on_stack, invalid_p == 0 */
if ((GDB_MULTI_ARCH >= 2)
&& (gdbarch->extract_return_value == 0))
internal_error ("gdbarch: verify_gdbarch: extract_return_value invalid");
"gdbarch_update: ADDRESS_TO_POINTER = 0x%08lx\n",
(long) current_gdbarch->address_to_pointer
/*ADDRESS_TO_POINTER ()*/);
+ fprintf_unfiltered (gdb_stdlog,
+ "gdbarch_update: RETURN_VALUE_ON_STACK = 0x%08lx\n",
+ (long) current_gdbarch->return_value_on_stack
+ /*RETURN_VALUE_ON_STACK ()*/);
fprintf_unfiltered (gdb_stdlog,
"gdbarch_update: EXTRACT_RETURN_VALUE = 0x%08lx\n",
(long) current_gdbarch->extract_return_value
gdbarch->address_to_pointer = address_to_pointer;
}
+int
+gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type)
+{
+ if (GDB_MULTI_ARCH == 0)
+ return generic_return_value_on_stack_not (type);
+ if (gdbarch->return_value_on_stack == 0)
+ internal_error ("gdbarch: gdbarch_return_value_on_stack invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value_on_stack called\n");
+ return gdbarch->return_value_on_stack (type);
+}
+
+void
+set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch,
+ gdbarch_return_value_on_stack_ftype return_value_on_stack)
+{
+ gdbarch->return_value_on_stack = return_value_on_stack;
+}
+
void
gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf)
{
#define ADDRESS_TO_POINTER(type, buf, addr) (gdbarch_address_to_pointer (current_gdbarch, type, buf, addr))
#endif
+typedef int (gdbarch_return_value_on_stack_ftype) (struct type *type);
+extern int gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type);
+extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_return_value_on_stack_ftype *return_value_on_stack);
+#if (GDB_MULTI_ARCH > 1) || !defined (RETURN_VALUE_ON_STACK)
+#define RETURN_VALUE_ON_STACK(type) (gdbarch_return_value_on_stack (current_gdbarch, type))
+#endif
+
typedef void (gdbarch_extract_return_value_ftype) (struct type *type, char *regbuf, char *valbuf);
extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf);
extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value);
f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, char *buf:type, buf:::generic_pointer_to_address:0
f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, char *buf, CORE_ADDR addr:type, buf, addr:::generic_address_to_pointer:0
#
+f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not:0
f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0
f:1:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr::0:0
f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0
#define USE_STRUCT_CONVENTION(gcc_p,type) generic_use_struct_convention (gcc_p, type)
#endif
-/* Some fundamental types (such as long double) are returned on the stack for
- certain architectures. This macro should return true for any type besides
- struct, union or array that gets returned on the stack. */
-
-#ifndef RETURN_VALUE_ON_STACK
-#define RETURN_VALUE_ON_STACK(TYPE) 0
-#endif
/* Return true if the function specified is using the structure returning
convention on this machine to return arguments, or 0 if it is using