From: Jim Blandy Date: Thu, 12 Jun 2003 23:25:37 +0000 (+0000) Subject: * arch-utils.c (always_use_struct_convention): New function. X-Git-Tag: jimb-ppc64-linux-20030613-branchpoint~28 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2b510420b0006d82bb208d647a177129ea190aad;p=pf3gnuchains%2Fpf3gnuchains4x.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d1806588c1..40c00db84b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2003-06-12 Jim Blandy + + * 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. + 2003-06-12 Andrew Cagney * wince.c: Include "mips-tdep.h". diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 0a1be317f7..4994f3d97d 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -579,13 +579,6 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache, } } -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) @@ -1540,7 +1533,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); - set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention); + 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, diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index d252bdb98f..9fa9ceade9 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -73,6 +73,13 @@ legacy_store_return_value (struct type *type, struct regcache *regcache, 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. */ diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index b7b9272b13..8fce25236f 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -43,6 +43,10 @@ extern gdbarch_extract_return_value_ftype legacy_extract_return_value; /* 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; diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index d529b41fe9..7f242e5861 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1100,19 +1100,6 @@ cris_extract_struct_value_address (char *regbuf) 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. */ - -static 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. */ @@ -4278,7 +4265,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index cf96d3d1bf..89cf9b2ce1 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -738,18 +738,6 @@ frv_frame_init_saved_regs (struct frame_info *frame) } } -/* 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) { @@ -1079,7 +1067,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 6f8f8d10e0..df7e013509 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1058,12 +1058,6 @@ h8300_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) 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) { @@ -1227,7 +1221,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 0952019ac9..57af8ec72e 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -768,12 +768,6 @@ mips_n32n64_use_struct_convention (int gcc_p, struct type *type) 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. */ @@ -5778,7 +5772,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_reg_struct_has_addr (gdbarch, mips_o32_reg_struct_has_addr); set_gdbarch_use_struct_convention (gdbarch, - mips_o32_use_struct_convention); + always_use_struct_convention); break; case MIPS_ABI_O64: set_gdbarch_push_dummy_call (gdbarch, mips_o64_push_dummy_call);