This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: always_use_struct_convention
- From: Jim Blandy <jimb at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: 11 Jun 2003 01:37:24 -0500
- Subject: RFA: always_use_struct_convention
This is almost obvious...
2003-06-11 Jim Blandy <jimb@redhat.com>
* arch-utils.c (always_use_struct_convention): New function.
* arch-utils.h (always_use_struct_convention): New prototype.
* alpha-tdep.c (alpha_use_struct_convention): Delete.
(alpha_gdbarch_init): Register always_use_struct_convention,
instead of alpha_use_struct_convention.
* cris-tdep.c (cris_use_struct_convention): Delete.
(cris_gdbarch_init): Register always_use_struct_convention,
instead of cris_use_struct_convention.
* frv-tdep.c (frv_use_struct_convention): Delete.
(frv_gdbarch_init): Register always_use_struct_convention,
instead of frv_use_struct_convention.
* h8300-tdep.c (h8300_use_struct_convention): Delete.
(h8300_gdbarch_init): Register always_use_struct_convention,
instead of h8300_use_struct_convention.
* mips_o32-tdep.c (mips_o32_use_struct_convention): Delete.
(mips_o32_gdbarch_init): Register always_use_struct_convention,
instead of mips_o32_use_struct_convention.
Index: gdb/alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.111
diff -c -r1.111 alpha-tdep.c
*** gdb/alpha-tdep.c 9 Jun 2003 17:35:55 -0000 1.111
--- gdb/alpha-tdep.c 11 Jun 2003 06:27:36 -0000
***************
*** 579,591 ****
}
}
- static int
- alpha_use_struct_convention (int gcc_p, struct type *type)
- {
- /* Structures are returned by ref in extra arg0. */
- return 1;
- }
-
static const unsigned char *
alpha_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
--- 579,584 ----
***************
*** 1540,1546 ****
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
! set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention);
set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value);
set_gdbarch_store_return_value (gdbarch, alpha_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch,
--- 1533,1539 ----
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
! set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention);
set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value);
set_gdbarch_store_return_value (gdbarch, alpha_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch,
Index: gdb/arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.84
diff -c -r1.84 arch-utils.c
*** gdb/arch-utils.c 9 Jun 2003 17:35:56 -0000 1.84
--- gdb/arch-utils.c 11 Jun 2003 06:27:36 -0000
***************
*** 73,78 ****
--- 73,85 ----
int
+ always_use_struct_convention (int gcc_p, struct type *value_type)
+ {
+ return 1;
+ }
+
+
+ int
legacy_register_sim_regno (int regnum)
{
/* Only makes sense to supply raw registers. */
Index: gdb/arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.47
diff -c -r1.47 arch-utils.h
*** gdb/arch-utils.h 9 Jun 2003 17:35:56 -0000 1.47
--- gdb/arch-utils.h 11 Jun 2003 06:27:36 -0000
***************
*** 43,48 ****
--- 43,52 ----
/* Implementation of store return value that grubs the register cache. */
extern gdbarch_store_return_value_ftype legacy_store_return_value;
+ /* To return any structure or union type by value, store it at the
+ address passed as an invisible first argument to the function. */
+ extern gdbarch_use_struct_convention_ftype always_use_struct_convention;
+
/* Frameless functions not identifable. */
extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_invocation_not;
Index: gdb/cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.75
diff -c -r1.75 cris-tdep.c
*** gdb/cris-tdep.c 9 Jun 2003 17:35:56 -0000 1.75
--- gdb/cris-tdep.c 11 Jun 2003 06:27:38 -0000
***************
*** 1100,1118 ****
return struct_return_address;
}
- /* Returns 1 if a value of the given type being returned from a function
- must have space allocated for it on the stack. gcc_p is true if the
- function being considered is known to have been compiled by GCC.
- In the CRIS ABI, structure return values are passed to the called
- function by reference in register R9 to a caller-allocated area, so
- this is always true. */
-
- int
- cris_use_struct_convention (int gcc_p, struct type *type)
- {
- return 1;
- }
-
/* Returns 1 if the given type will be passed by pointer rather than
directly. */
--- 1100,1105 ----
***************
*** 4273,4279 ****
set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return);
set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, cris_extract_struct_value_address);
! set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, cris_init_extra_frame_info);
--- 4260,4266 ----
set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return);
set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, cris_extract_struct_value_address);
! set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, cris_init_extra_frame_info);
Index: gdb/frv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/frv-tdep.c,v
retrieving revision 1.43
diff -c -r1.43 frv-tdep.c
*** gdb/frv-tdep.c 9 Jun 2003 17:35:56 -0000 1.43
--- gdb/frv-tdep.c 11 Jun 2003 06:27:39 -0000
***************
*** 738,755 ****
}
}
- /* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of
- EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc
- and TYPE is the type (which is known to be struct, union or array).
-
- The frv returns all structs in memory. */
-
- static int
- frv_use_struct_convention (int gcc_p, struct type *type)
- {
- return 1;
- }
-
static void
frv_extract_return_value (struct type *type, char *regbuf, char *valbuf)
{
--- 738,743 ----
***************
*** 1079,1085 ****
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs);
! set_gdbarch_use_struct_convention (gdbarch, frv_use_struct_convention);
set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value);
set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return);
--- 1067,1073 ----
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs);
! set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention);
set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value);
set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return);
Index: gdb/h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.65
diff -c -r1.65 h8300-tdep.c
*** gdb/h8300-tdep.c 9 Jun 2003 17:35:57 -0000 1.65
--- gdb/h8300-tdep.c 11 Jun 2003 06:27:40 -0000
***************
*** 1031,1042 ****
write_register (0, addr);
}
- static int
- h8300_use_struct_convention (int gcc_p, struct type *type)
- {
- return 1;
- }
-
static CORE_ADDR
h8300_extract_struct_value_address (char *regbuf)
{
--- 1031,1036 ----
***************
*** 1180,1186 ****
h8300_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, h8300_extract_struct_value_address);
! set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention);
set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
--- 1174,1180 ----
h8300_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, h8300_extract_struct_value_address);
! set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention);
set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
Index: gdb/mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.209
diff -c -r1.209 mips-tdep.c
*** gdb/mips-tdep.c 9 Jun 2003 22:20:43 -0000 1.209
--- gdb/mips-tdep.c 11 Jun 2003 06:27:43 -0000
***************
*** 768,779 ****
return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
}
- static int
- mips_o32_use_struct_convention (int gcc_p, struct type *type)
- {
- return 1; /* Structures are returned by ref in extra arg0. */
- }
-
/* Should call_function pass struct by reference?
For each architecture, structs are passed either by
value or by reference, depending on their size. */
--- 768,773 ----
***************
*** 5778,5784 ****
set_gdbarch_reg_struct_has_addr (gdbarch,
mips_o32_reg_struct_has_addr);
set_gdbarch_use_struct_convention (gdbarch,
! mips_o32_use_struct_convention);
break;
case MIPS_ABI_O64:
set_gdbarch_push_dummy_call (gdbarch, mips_o64_push_dummy_call);
--- 5772,5778 ----
set_gdbarch_reg_struct_has_addr (gdbarch,
mips_o32_reg_struct_has_addr);
set_gdbarch_use_struct_convention (gdbarch,
! always_use_struct_convention);
break;
case MIPS_ABI_O64:
set_gdbarch_push_dummy_call (gdbarch, mips_o64_push_dummy_call);