From b81774d89c8276b67b2c7aa4bc903ee8a27ad575 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 26 Mar 2003 22:39:53 +0000 Subject: [PATCH] 2003-03-26 Andrew Cagney * gdbarch.sh (DEPRECATED_PUSH_ARGUMENTS): Rename PUSH_ARGUMENTS. (push_dummy_call): New pure multi-arch replacement with gdbarch, regcache and dummy_addr parameters. * gdbarch.h, gdbarch.c: Re-generate. * valops.c (hand_function_call): Use gdbarch_push_dummy_call when available; assume it will handle stack alignment and return address issues. Fall back to DEPRECATED_PUSH_ARGUMENTS and legacy_push_arguments. (legacy_push_arguments): Rename default_push_arguments. * value.h (legacy_push_arguments): Rename default_push_arguments. * i386-tdep.c (i386_push_arguments): Call legacy_push_arguments. * config/sparc/tm-sparc.h (DEPRECATED_PUSH_ARGUMENTS): Update. * config/sparc/tm-sp64.h (DEPRECATED_PUSH_ARGUMENTS): Update. * config/pa/tm-hppa.h (DEPRECATED_PUSH_ARGUMENTS): Update. * config/i386/tm-symmetry.h: Update. * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. * x86-64-tdep.c (x86_64_init_abi): Update. * v850-tdep.c (v850_gdbarch_init): Update. * sparc-tdep.c (sparc_gdbarch_init): Update. * sh-tdep.c (sh_gdbarch_init): Update. * s390-tdep.c (s390_gdbarch_init): Update. * rs6000-tdep.c (rs6000_gdbarch_init): Update. * mn10300-tdep.c (mn10300_gdbarch_init): Update. * mips-tdep.c (mips_gdbarch_init): Update. * mcore-tdep.c (mcore_gdbarch_init): Update. * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. * ia64-tdep.c (ia64_gdbarch_init): Update. * i386-tdep.c (i386_gdbarch_init): Update. * hppa-tdep.c (hppa_gdbarch_init): Update. * h8300-tdep.c (h8300_gdbarch_init): Update. * frv-tdep.c (frv_gdbarch_init): Update. * d10v-tdep.c (d10v_gdbarch_init): Update. * cris-tdep.c (cris_gdbarch_init): Update. * avr-tdep.c (avr_gdbarch_init): Update. * arm-tdep.c (arm_gdbarch_init): Update. * arm-linux-tdep.c (arm_linux_init_abi): Update. * alpha-tdep.c (alpha_gdbarch_init): Update. 2003-03-26 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Replace PUSH_ARGUMENTS with push_dummy_call, add gdbarch, regcache and dummy_addr parameters. --- gdb/ChangeLog | 40 +++++++++++++++ gdb/alpha-tdep.c | 3 +- gdb/arm-linux-tdep.c | 2 +- gdb/arm-tdep.c | 2 +- gdb/avr-tdep.c | 2 +- gdb/config/i386/tm-symmetry.h | 2 +- gdb/config/pa/tm-hppa.h | 2 +- gdb/config/sparc/tm-sp64.h | 4 +- gdb/config/sparc/tm-sparc.h | 2 +- gdb/cris-tdep.c | 4 +- gdb/d10v-tdep.c | 2 +- gdb/doc/ChangeLog | 6 +++ gdb/doc/gdbint.texinfo | 23 ++++++--- gdb/frv-tdep.c | 2 +- gdb/gdbarch.c | 92 +++++++++++++++++++++++++++-------- gdb/gdbarch.h | 46 ++++++++++++++---- gdb/gdbarch.sh | 4 +- gdb/h8300-tdep.c | 2 +- gdb/hppa-tdep.c | 2 +- gdb/i386-tdep.c | 4 +- gdb/ia64-tdep.c | 3 +- gdb/m68hc11-tdep.c | 2 +- gdb/mcore-tdep.c | 2 +- gdb/mips-tdep.c | 12 ++--- gdb/mn10300-tdep.c | 2 +- gdb/rs6000-tdep.c | 4 +- gdb/s390-tdep.c | 2 +- gdb/sh-tdep.c | 4 +- gdb/sparc-tdep.c | 4 +- gdb/v850-tdep.c | 2 +- gdb/valops.c | 58 ++++++++++++++++------ gdb/value.h | 6 +-- gdb/x86-64-tdep.c | 2 +- gdb/xstormy16-tdep.c | 2 +- 34 files changed, 257 insertions(+), 94 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8220a0ec99f..c98563de642 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,43 @@ +2003-03-26 Andrew Cagney + + * gdbarch.sh (DEPRECATED_PUSH_ARGUMENTS): Rename PUSH_ARGUMENTS. + (push_dummy_call): New pure multi-arch replacement with gdbarch, + regcache and dummy_addr parameters. + * gdbarch.h, gdbarch.c: Re-generate. + * valops.c (hand_function_call): Use gdbarch_push_dummy_call when + available; assume it will handle stack alignment and return + address issues. Fall back to DEPRECATED_PUSH_ARGUMENTS and + legacy_push_arguments. + (legacy_push_arguments): Rename default_push_arguments. + * value.h (legacy_push_arguments): Rename default_push_arguments. + * i386-tdep.c (i386_push_arguments): Call legacy_push_arguments. + * config/sparc/tm-sparc.h (DEPRECATED_PUSH_ARGUMENTS): Update. + * config/sparc/tm-sp64.h (DEPRECATED_PUSH_ARGUMENTS): Update. + * config/pa/tm-hppa.h (DEPRECATED_PUSH_ARGUMENTS): Update. + * config/i386/tm-symmetry.h: Update. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * d10v-tdep.c (d10v_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * arm-linux-tdep.c (arm_linux_init_abi): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + 2003-03-26 Daniel Jacobowitz * signals/signals.c (do_target_signal_to_host): Correct realtime diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index a6449e1e834..d12c69ff1ae 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -67,7 +67,6 @@ static gdbarch_frame_locals_address_ftype alpha_frame_locals_address; static gdbarch_skip_prologue_ftype alpha_skip_prologue; static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call; -static gdbarch_push_arguments_ftype alpha_push_arguments; static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy; static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target; @@ -1853,7 +1852,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Settings for calling functions in the inferior. */ set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0); set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_push_arguments (gdbarch, alpha_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, alpha_push_arguments); set_gdbarch_deprecated_pop_frame (gdbarch, alpha_pop_frame); /* On the Alpha, the call dummy code is never copied to user space, diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 01b45f13f89..fa4d8fa00ca 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -536,7 +536,7 @@ arm_linux_init_abi (struct gdbarch_info info, /* The following two overrides shouldn't be needed. */ set_gdbarch_deprecated_extract_return_value (gdbarch, arm_linux_extract_return_value); - set_gdbarch_push_arguments (gdbarch, arm_linux_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, arm_linux_push_arguments); /* Shared library handling. */ set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index dbe14836d96..4ac2a7da710 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2930,7 +2930,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_address (gdbarch, entry_point_address); set_gdbarch_push_return_address (gdbarch, arm_push_return_address); - set_gdbarch_push_arguments (gdbarch, arm_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, arm_push_arguments); /* Frame handling. */ set_gdbarch_deprecated_frame_chain_valid (gdbarch, arm_frame_chain_valid); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 73588375883..434c2e688bd 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1180,7 +1180,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer); set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address); - set_gdbarch_push_arguments (gdbarch, avr_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, avr_push_arguments); set_gdbarch_push_return_address (gdbarch, avr_push_return_address); set_gdbarch_deprecated_pop_frame (gdbarch, avr_pop_frame); diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h index a15f45f1c95..ea2229090e7 100644 --- a/gdb/config/i386/tm-symmetry.h +++ b/gdb/config/i386/tm-symmetry.h @@ -266,7 +266,7 @@ switch (regno) { \ passes it on the stack. gcc should be fixed in future versions to adopt native cc conventions. */ -#undef PUSH_ARGUMENTS +#undef DEPRECATED_PUSH_ARGUMENTS #undef STORE_STRUCT_RETURN #define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR)) diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 64a4fe1362f..33ef7a1a57b 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -614,7 +614,7 @@ extern CORE_ADDR hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, struct value **, struct type *, int); #if !GDB_MULTI_ARCH -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ +#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ (hppa_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))) extern CORE_ADDR hppa_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h index 8abec1c709c..0e0e404c8a8 100644 --- a/gdb/config/sparc/tm-sp64.h +++ b/gdb/config/sparc/tm-sp64.h @@ -208,8 +208,8 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, CORE_ADDR sparc64_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); -#undef PUSH_ARGUMENTS -#define PUSH_ARGUMENTS(A,B,C,D,E) \ +#undef DEPRECATED_PUSH_ARGUMENTS +#define DEPRECATED_PUSH_ARGUMENTS(A,B,C,D,E) \ (sparc64_push_arguments ((A), (B), (C), (D), (E))) /* Store the address of the place in which to copy the structure the diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 7b11c4fbd58..ef3996232cc 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -688,7 +688,7 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, void sparc_push_dummy_frame (void); void sparc_pop_frame (void); -#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ +#define DEPRECATED_PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ sparc32_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) extern CORE_ADDR sparc32_push_arguments (int, struct value **, CORE_ADDR, int, diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 8bf06466b7e..5c92edb2dec 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -4154,7 +4154,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) if (tdep->cris_abi == CRIS_ABI_ORIGINAL) { set_gdbarch_double_bit (gdbarch, 32); - set_gdbarch_push_arguments (gdbarch, cris_abi_original_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_original_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, cris_abi_original_store_return_value); set_gdbarch_deprecated_extract_return_value @@ -4165,7 +4165,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else if (tdep->cris_abi == CRIS_ABI_V2) { set_gdbarch_double_bit (gdbarch, 64); - set_gdbarch_push_arguments (gdbarch, cris_abi_v2_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_v2_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, cris_abi_v2_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, cris_abi_v2_extract_return_value); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index d9c95c78d31..cb1c6d231d7 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1692,7 +1692,7 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value); - set_gdbarch_push_arguments (gdbarch, d10v_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, d10v_push_arguments); set_gdbarch_push_return_address (gdbarch, d10v_push_return_address); set_gdbarch_store_return_value (gdbarch, d10v_store_return_value); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 3aeadd3ba3c..dfb422bbca2 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2003-03-26 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Replace + PUSH_ARGUMENTS with push_dummy_call, add gdbarch, regcache and + dummy_addr parameters. + 2003-03-25 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Delete diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 0522d726ade..bd2a722fedc 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3115,7 +3115,7 @@ See the file @file{inferior.h}. @item DEPRECATED_CALL_DUMMY_STACK_ADJUST @findex DEPRECATED_CALL_DUMMY_STACK_ADJUST Stack adjustment needed when performing an inferior function call. This -function is no longer needed. @xref{PUSH_ARGUMENTS}, which can handle +function is no longer needed. @xref{push_dummy_call}, which can handle all alignment directly. @item CANNOT_FETCH_REGISTER (@var{regno}) @@ -3703,14 +3703,21 @@ definition is only used in generic code when parsing "$ps".) If defined, used by @code{frame_pop} to remove a stack frame. This method has been superseeded by generic code. -@item PUSH_ARGUMENTS (@var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr}) -@findex PUSH_ARGUMENTS -@anchor{PUSH_ARGUMENTS} -Define this to push arguments onto the stack for inferior function -call. Returns the updated stack pointer value. +@item push_dummy_call (@var{gdbarch}, @var{regcache}, @var{dummy_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr}) +@findex push_dummy_call +@findex DEPRECATED_PUSH_ARGUMENTS. +@anchor{push_dummy_call} +Define this to push the dummy frame's call to the inferior function onto +the stack. In addition to pushing @var{nargs}, the code should push +@var{struct_addr} (when @var{struct_return}), and the return value (in +the call dummy at @var{dummy_addr}). -@item PUSH_DUMMY_FRAME -@findex PUSH_DUMMY_FRAME +Returns the updated top-of-stack pointer. + +This method replaces @code{DEPRECATED_PUSH_ARGUMENTS}. + +@item DEPRECATED_PUSH_DUMMY_FRAME +@findex DEPRECATED_PUSH_DUMMY_FRAME Used in @samp{call_function_by_hand} to create an artificial stack frame. @item REGISTER_BYTES diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index cb8dc55e679..e1b2e88aa02 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1090,7 +1090,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Settings for calling functions in the inferior. */ set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_push_arguments (gdbarch, frv_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, frv_push_arguments); set_gdbarch_push_return_address (gdbarch, frv_push_return_address); set_gdbarch_deprecated_pop_frame (gdbarch, frv_pop_frame); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index c45a70f054f..0430203193c 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -212,7 +212,8 @@ struct gdbarch gdbarch_address_to_pointer_ftype *address_to_pointer; gdbarch_integer_to_address_ftype *integer_to_address; gdbarch_return_value_on_stack_ftype *return_value_on_stack; - gdbarch_push_arguments_ftype *push_arguments; + gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments; + gdbarch_push_dummy_call_ftype *push_dummy_call; gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame; gdbarch_push_return_address_ftype *push_return_address; gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame; @@ -433,6 +434,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, @@ -543,7 +545,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->pointer_to_address = unsigned_pointer_to_address; current_gdbarch->address_to_pointer = unsigned_address_to_pointer; current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not; - current_gdbarch->push_arguments = default_push_arguments; current_gdbarch->extract_return_value = legacy_extract_return_value; current_gdbarch->store_return_value = legacy_store_return_value; current_gdbarch->use_struct_convention = generic_use_struct_convention; @@ -713,7 +714,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of address_to_pointer, invalid_p == 0 */ /* Skip verify of integer_to_address, has predicate */ /* Skip verify of return_value_on_stack, invalid_p == 0 */ - /* Skip verify of push_arguments, invalid_p == 0 */ + /* Skip verify of deprecated_push_arguments, has predicate */ + /* Skip verify of push_dummy_call, has predicate */ /* Skip verify of deprecated_push_dummy_frame, has predicate */ /* Skip verify of push_return_address, has predicate */ /* Skip verify of deprecated_pop_frame, has predicate */ @@ -1413,6 +1415,26 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_pop_frame /*DEPRECATED_POP_FRAME ()*/); #endif +#ifdef DEPRECATED_PUSH_ARGUMENTS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_ARGUMENTS_P()", + XSTRING (DEPRECATED_PUSH_ARGUMENTS_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS_P() = %d\n", + DEPRECATED_PUSH_ARGUMENTS_P ()); +#endif +#ifdef DEPRECATED_PUSH_ARGUMENTS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)", + XSTRING (DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS = <0x%08lx>\n", + (long) current_gdbarch->deprecated_push_arguments + /*DEPRECATED_PUSH_ARGUMENTS ()*/); +#endif #ifdef DEPRECATED_PUSH_DUMMY_FRAME_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1898,17 +1920,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: PS_REGNUM = %d\n", PS_REGNUM); #endif -#ifdef PUSH_ARGUMENTS - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)", - XSTRING (PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr))); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: PUSH_ARGUMENTS = <0x%08lx>\n", - (long) current_gdbarch->push_arguments - /*PUSH_ARGUMENTS ()*/); -#endif + "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n", + gdbarch_push_dummy_call_p (current_gdbarch)); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: push_dummy_call = 0x%08lx\n", + (long) current_gdbarch->push_dummy_call); #ifdef PUSH_RETURN_ADDRESS_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -4218,23 +4237,56 @@ set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch->return_value_on_stack = return_value_on_stack; } +int +gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_push_arguments != 0; +} + +CORE_ADDR +gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->deprecated_push_arguments == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_push_arguments invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n"); + return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr); +} + +void +set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, + gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments) +{ + gdbarch->deprecated_push_arguments = deprecated_push_arguments; +} + +int +gdbarch_push_dummy_call_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->push_dummy_call != 0; +} + CORE_ADDR -gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) +gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { gdb_assert (gdbarch != NULL); - if (gdbarch->push_arguments == 0) + if (gdbarch->push_dummy_call == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_push_arguments invalid"); + "gdbarch: gdbarch_push_dummy_call invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_push_arguments called\n"); - return gdbarch->push_arguments (nargs, args, sp, struct_return, struct_addr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n"); + return gdbarch->push_dummy_call (gdbarch, regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr); } void -set_gdbarch_push_arguments (struct gdbarch *gdbarch, - gdbarch_push_arguments_ftype push_arguments) +set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, + gdbarch_push_dummy_call_ftype push_dummy_call) { - gdbarch->push_arguments = push_arguments; + gdbarch->push_dummy_call = push_dummy_call; } int diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index dd66773a8ac..5f5c5157aa8 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1629,23 +1629,51 @@ extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_ #endif #endif +/* Replaced by PUSH_DUMMY_CALL */ + +#if defined (DEPRECATED_PUSH_ARGUMENTS) +/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_ARGUMENTS */ +#if !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (0) +#endif + +extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS_P) +#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (PUSH_ARGUMENTS) -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (default_push_arguments (nargs, args, sp, struct_return, struct_addr)) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS) +#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_ARGUMENTS"), 0) #endif -typedef CORE_ADDR (gdbarch_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); -extern CORE_ADDR gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); -extern void set_gdbarch_push_arguments (struct gdbarch *gdbarch, gdbarch_push_arguments_ftype *push_arguments); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_ARGUMENTS) -#error "Non multi-arch definition of PUSH_ARGUMENTS" +typedef CORE_ADDR (gdbarch_deprecated_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern CORE_ADDR gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern void set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS) +#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_ARGUMENTS) -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS) +#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_deprecated_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr)) #endif #endif +extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call); + #if defined (DEPRECATED_PUSH_DUMMY_FRAME) /* Legacy for systems yet to multi-arch DEPRECATED_PUSH_DUMMY_FRAME */ #if !defined (DEPRECATED_PUSH_DUMMY_FRAME_P) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index a1122e17ea9..5843ee20b35 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -555,7 +555,9 @@ f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, COR F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf # f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0 -f:2: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:::default_push_arguments::0 +# Replaced by PUSH_DUMMY_CALL +F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr +M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0 F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 F:2:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-:::0 diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index e78bc0f3813..6453f9943cb 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1150,7 +1150,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) * These values and methods are used when gdb calls a target function. */ set_gdbarch_push_return_address (gdbarch, h8300_push_return_address); set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value); - set_gdbarch_push_arguments (gdbarch, h8300_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments); set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, h8300_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, h8300_store_return_value); diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2f5412e2bb6..38676935b6c 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -5005,7 +5005,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_length (gdbarch, INSTRUCTION_SIZE * 28); set_gdbarch_call_dummy_start_offset (gdbarch, 0); /* set_gdbarch_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */ - set_gdbarch_push_arguments (gdbarch, hppa_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments); set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_read_pc (gdbarch, hppa_target_read_pc); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 02abc9e537e..0ac2876c17c 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -925,7 +925,7 @@ static CORE_ADDR i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { - sp = default_push_arguments (nargs, args, sp, struct_return, struct_addr); + sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr); if (struct_return) { @@ -1586,7 +1586,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_parm_boundary (gdbarch, 32); set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value); - set_gdbarch_push_arguments (gdbarch, i386_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, i386_push_arguments); set_gdbarch_push_return_address (gdbarch, i386_push_return_address); set_gdbarch_deprecated_pop_frame (gdbarch, i386_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, i386_store_struct_return); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 1b3d7657e45..6b4a8137bf8 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -96,7 +96,6 @@ static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value; static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address; static gdbarch_use_struct_convention_ftype ia64_use_struct_convention; static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation; -static gdbarch_push_arguments_ftype ia64_push_arguments; static gdbarch_push_return_address_ftype ia64_push_return_address; static gdbarch_saved_pc_after_call_ftype ia64_saved_pc_after_call; static void ia64_pop_frame_regular (struct frame_info *frame); @@ -2216,7 +2215,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Settings for calling functions in the inferior. */ set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_push_arguments (gdbarch, ia64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments); set_gdbarch_push_return_address (gdbarch, ia64_push_return_address); set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 02ba5c0b096..6b2a3ac5eeb 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1392,7 +1392,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value); - set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, m68hc11_push_arguments); set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address); set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack); diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index e3070b35d1e..c8ba612523b 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -1130,7 +1130,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_breakpoint_from_pc (gdbarch, mcore_breakpoint_from_pc); set_gdbarch_push_return_address (gdbarch, mcore_push_return_address); - set_gdbarch_push_arguments (gdbarch, mcore_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mcore_push_arguments); set_gdbarch_call_dummy_length (gdbarch, 0); /* Frames: */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 2a63d22e31d..4ed00c0cb95 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -5806,7 +5806,7 @@ mips_gdbarch_init (struct gdbarch_info info, switch (mips_abi) { case MIPS_ABI_O32: - set_gdbarch_push_arguments (gdbarch, mips_o32_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_o32_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_o32_store_return_value); set_gdbarch_extract_return_value (gdbarch, mips_o32_extract_return_value); tdep->mips_default_saved_regsize = 4; @@ -5825,7 +5825,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_o32_use_struct_convention); break; case MIPS_ABI_O64: - set_gdbarch_push_arguments (gdbarch, mips_o64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_o64_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_o64_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mips_o64_extract_return_value); tdep->mips_default_saved_regsize = 8; @@ -5844,7 +5844,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_o32_use_struct_convention); break; case MIPS_ABI_EABI32: - set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value); tdep->mips_default_saved_regsize = 4; @@ -5863,7 +5863,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_eabi_use_struct_convention); break; case MIPS_ABI_EABI64: - set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value); tdep->mips_default_saved_regsize = 8; @@ -5882,7 +5882,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_eabi_use_struct_convention); break; case MIPS_ABI_N32: - set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value); set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value); tdep->mips_default_saved_regsize = 8; @@ -5913,7 +5913,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_n32n64_reg_struct_has_addr); break; case MIPS_ABI_N64: - set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value); set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value); tdep->mips_default_saved_regsize = 8; diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 087c9df9f5b..24cc55f9b0f 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1196,7 +1196,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_push_arguments (gdbarch, mn10300_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments); set_gdbarch_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr); set_gdbarch_push_return_address (gdbarch, mn10300_push_return_address); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 539905ed977..5b330d587a2 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2924,9 +2924,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 64-bit code. At some point in the future, this matter needs to be revisited. */ if (sysv_abi && wordsize == 4) - set_gdbarch_push_arguments (gdbarch, ppc_sysv_abi_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, ppc_sysv_abi_push_arguments); else - set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, rs6000_push_arguments); set_gdbarch_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return); set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 18b7d108fe7..9c2f0282dd0 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1866,7 +1866,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_address (gdbarch, entry_point_address); set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_push_arguments (gdbarch, s390_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, s390_push_arguments); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 7649c6208bc..1a0fef1ea28 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -4375,7 +4375,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh_init_extra_frame_info); set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value); - set_gdbarch_push_arguments (gdbarch, sh_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, sh_push_arguments); set_gdbarch_deprecated_store_struct_return (gdbarch, sh_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); @@ -4617,7 +4617,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_chain (gdbarch, sh64_frame_chain); set_gdbarch_deprecated_get_saved_register (gdbarch, sh64_get_saved_register); set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value); - set_gdbarch_push_arguments (gdbarch, sh64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, sh64_push_arguments); /*set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return);*/ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index e9daad8de60..c638bd65ac4 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -3259,7 +3259,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_npc_regnum (gdbarch, SPARC32_NPC_REGNUM); set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM); set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); - set_gdbarch_push_arguments (gdbarch, sparc32_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, sparc32_push_arguments); set_gdbarch_read_fp (gdbarch, generic_target_read_fp); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); @@ -3315,7 +3315,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_npc_regnum (gdbarch, SPARC64_NPC_REGNUM); set_gdbarch_pc_regnum (gdbarch, SPARC64_PC_REGNUM); set_gdbarch_ptr_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_push_arguments (gdbarch, sparc64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, sparc64_push_arguments); /* NOTE different for at_entry */ set_gdbarch_read_fp (gdbarch, sparc64_read_fp); set_gdbarch_read_sp (gdbarch, sparc64_read_sp); diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 9bae316adcd..b90a6d92245 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1270,7 +1270,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) * These values and methods are used when gdb calls a target function. */ set_gdbarch_push_return_address (gdbarch, v850_push_return_address); set_gdbarch_deprecated_extract_return_value (gdbarch, v850_extract_return_value); - set_gdbarch_push_arguments (gdbarch, v850_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, v850_push_arguments); set_gdbarch_deprecated_pop_frame (gdbarch, v850_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, v850_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, v850_store_return_value); diff --git a/gdb/valops.c b/gdb/valops.c index ff24a9f4e7c..a7453e97cb8 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1079,8 +1079,8 @@ value_push (register CORE_ADDR sp, struct value *arg) } CORE_ADDR -default_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) +legacy_push_arguments (int nargs, struct value **args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) { /* ASSERT ( !struct_return); */ int i; @@ -1264,6 +1264,7 @@ hand_function_call (struct value *function, int nargs, struct value **args) static ULONGEST *dummy; int sizeof_dummy1; char *dummy1; + CORE_ADDR dummy_addr; CORE_ADDR old_sp; struct type *value_type; unsigned char struct_return; @@ -1428,21 +1429,25 @@ hand_function_call (struct value *function, int nargs, struct value **args) real_pc = start_sp; #endif - if (CALL_DUMMY_LOCATION == ON_STACK) + switch (CALL_DUMMY_LOCATION) { + case ON_STACK: + dummy_addr = start_sp; write_memory (start_sp, (char *) dummy1, sizeof_dummy1); if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) generic_save_call_dummy_addr (start_sp, start_sp + sizeof_dummy1); - } - - if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) - { + break; + case AT_ENTRY_POINT: real_pc = funaddr; + dummy_addr = CALL_DUMMY_ADDRESS (); if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) /* NOTE: cagney/2002-04-13: The entry point is going to be modified with a single breakpoint. */ generic_save_call_dummy_addr (CALL_DUMMY_ADDRESS (), CALL_DUMMY_ADDRESS () + 1); + break; + default: + internal_error (__FILE__, __LINE__, "bad switch"); } #ifdef lint @@ -1569,9 +1574,8 @@ You must use a pointer to function type variable. Command ignored.", arg_name); { int len = TYPE_LENGTH (value_type); if (STACK_ALIGN_P ()) - /* MVS 11/22/96: I think at least some of this stack_align - code is really broken. Better to let PUSH_ARGUMENTS adjust - the stack in a target-defined manner. */ + /* NOTE: cagney/2003-03-22: Should rely on frame align, rather + than stack align to force the alignment of the stack. */ len = STACK_ALIGN (len); if (INNER_THAN (1, 2)) { @@ -1605,7 +1609,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name); if (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED) { /* MVS 11/22/96: I think at least some of this stack_align code - is really broken. Better to let PUSH_ARGUMENTS adjust the + is really broken. Better to let push_dummy_call() adjust the stack in a target-defined manner. */ if (STACK_ALIGN_P () && INNER_THAN (1, 2)) { @@ -1620,7 +1624,22 @@ You must use a pointer to function type variable. Command ignored.", arg_name); } } - sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr); + /* Create the dummy stack frame. Pass in the call dummy address as, + presumably, the ABI code knows where, in the call dummy, the + return address should be pointed. */ + if (gdbarch_push_dummy_call_p (current_gdbarch)) + /* When there is no push_dummy_call method, should this code + simply error out. That would the implementation of this method + for all ABIs (which is probably a good thing). */ + sp = gdbarch_push_dummy_call (current_gdbarch, current_regcache, + dummy_addr, nargs, args, sp, struct_return, + struct_addr); + else if (DEPRECATED_PUSH_ARGUMENTS_P ()) + /* Keep old targets working. */ + sp = DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, + struct_addr); + else + sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr); if (PUSH_RETURN_ADDRESS_P ()) /* for targets that use no CALL_DUMMY */ @@ -1635,7 +1654,12 @@ You must use a pointer to function type variable. Command ignored.", arg_name); functionality a bit, so I'm making it explicit to do it here. */ sp = PUSH_RETURN_ADDRESS (real_pc, sp); - if (STACK_ALIGN_P () && !INNER_THAN (1, 2)) + /* NOTE: cagney/2003-03-23: Diable this code when there is a + push_dummy_call() method. Since that method will have already + handled any alignment issues, the code below is entirely + redundant. */ + if (!gdbarch_push_dummy_call_p (current_gdbarch) + && STACK_ALIGN_P () && !INNER_THAN (1, 2)) { /* If stack grows up, we must leave a hole at the bottom, note that sp already has been advanced for the arguments! */ @@ -1667,7 +1691,13 @@ You must use a pointer to function type variable. Command ignored.", arg_name); might fool with it. On SPARC, this write also stores the register window into the right place in the new stack frame, which otherwise wouldn't happen. (See store_inferior_registers in sparc-nat.c.) */ - write_sp (sp); + /* NOTE: cagney/2003-03-23: Disable this code when there is a + push_dummy_call() method. Since that method will have already + stored the stack pointer (as part of creating the fake call + frame), and none of the code following that code adjusts the + stack-pointer value, the below call is entirely redundant. */ + if (!gdbarch_push_dummy_call_p (current_gdbarch)) + write_sp (sp); if (SAVE_DUMMY_FRAME_TOS_P ()) SAVE_DUMMY_FRAME_TOS (sp); diff --git a/gdb/value.h b/gdb/value.h index 04be76ad7fb..b5b2b07ac29 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -560,9 +560,9 @@ extern struct value *find_function_in_inferior (const char *); extern struct value *value_allocate_space_in_inferior (int); -extern CORE_ADDR default_push_arguments (int nargs, struct value ** args, - CORE_ADDR sp, int struct_return, - CORE_ADDR struct_addr); +extern CORE_ADDR legacy_push_arguments (int nargs, struct value ** args, + CORE_ADDR sp, int struct_return, + CORE_ADDR struct_addr); extern struct value *value_of_local (const char *name, int complain); diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 321d9c3fec5..33049b2fa39 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -1013,7 +1013,7 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value); - set_gdbarch_push_arguments (gdbarch, x86_64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, x86_64_push_arguments); set_gdbarch_push_return_address (gdbarch, x86_64_push_return_address); set_gdbarch_deprecated_pop_frame (gdbarch, x86_64_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, x86_64_store_struct_return); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 5408a08adb2..32c8d5c820a 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1086,7 +1086,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) * These values and methods are used when gdb calls a target function. */ set_gdbarch_push_return_address (gdbarch, xstormy16_push_return_address); set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value); - set_gdbarch_push_arguments (gdbarch, xstormy16_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, xstormy16_push_arguments); set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value); -- 2.30.2