From b16774e12f1ff298f36c71c2f2b82af477017076 Mon Sep 17 00:00:00 2001 From: kettenis Date: Fri, 2 Sep 2005 19:02:44 +0000 Subject: [PATCH] * infcall.c (call_function_by_hand): Remove code handling deprecated_push_arguments. Bail out early if push_dummy_call isn't available. * gdbarch.sh (deprecated_push_arguments): Delete. Adjust a few comments accordingly. * gdbarch.h, gdbarch.c: Regenerate. --- gdb/gdbarch.c | 45 --------------------------------------------- gdb/gdbarch.h | 32 ++------------------------------ gdb/gdbarch.sh | 7 ++----- gdb/infcall.c | 19 ++++++------------- 4 files changed, 10 insertions(+), 93 deletions(-) diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index c4e390eaa2..527fe177d3 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -167,7 +167,6 @@ struct gdbarch gdbarch_unwind_dummy_id_ftype *unwind_dummy_id; int deprecated_fp_regnum; gdbarch_push_dummy_call_ftype *push_dummy_call; - gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments; int deprecated_register_size; int call_dummy_location; gdbarch_push_dummy_code_ftype *push_dummy_code; @@ -294,7 +293,6 @@ struct gdbarch startup_gdbarch = 0, /* unwind_dummy_id */ -1, /* deprecated_fp_regnum */ 0, /* push_dummy_call */ - 0, /* deprecated_push_arguments */ 0, /* deprecated_register_size */ 0, /* call_dummy_location */ 0, /* push_dummy_code */ @@ -552,7 +550,6 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of unwind_dummy_id, has predicate */ /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */ /* Skip verify of push_dummy_call, has predicate */ - /* Skip verify of deprecated_push_arguments, has predicate */ /* Skip verify of call_dummy_location, invalid_p == 0 */ /* Skip verify of push_dummy_code, has predicate */ /* Skip verify of print_registers_info, invalid_p == 0 */ @@ -880,24 +877,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: deprecated_function_start_offset = 0x%s\n", paddr_nz (current_gdbarch->deprecated_function_start_offset)); -#ifdef DEPRECATED_PUSH_ARGUMENTS_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "DEPRECATED_PUSH_ARGUMENTS_P()", - XSTRING (DEPRECATED_PUSH_ARGUMENTS_P ())); -#endif - fprintf_unfiltered (file, - "gdbarch_dump: gdbarch_deprecated_push_arguments_p() = %d\n", - gdbarch_deprecated_push_arguments_p (current_gdbarch)); -#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))); -#endif - fprintf_unfiltered (file, - "gdbarch_dump: deprecated_push_arguments = <0x%lx>\n", - (long) current_gdbarch->deprecated_push_arguments); #ifdef DEPRECATED_REG_STRUCT_HAS_ADDR_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2376,30 +2355,6 @@ set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, } int -gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - return gdbarch->deprecated_push_arguments != NULL; -} - -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); - gdb_assert (gdbarch->deprecated_push_arguments != NULL); - 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_deprecated_register_size (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 22d74b717a..434966f0b3 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -525,8 +525,7 @@ extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int depre #define DEPRECATED_FP_REGNUM (gdbarch_deprecated_fp_regnum (current_gdbarch)) #endif -/* See gdbint.texinfo. See infcall.c. New, all singing all dancing, - replacement for DEPRECATED_PUSH_ARGUMENTS. */ +/* See gdbint.texinfo. See infcall.c. */ extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch); @@ -534,33 +533,6 @@ typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, stru extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_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); -/* PUSH_DUMMY_CALL is a direct replacement for DEPRECATED_PUSH_ARGUMENTS. */ - -#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 - -extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch); -#if !defined (GDB_TM_FILE) && defined (DEPRECATED_PUSH_ARGUMENTS_P) -#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" -#endif -#if !defined (DEPRECATED_PUSH_ARGUMENTS_P) -#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch)) -#endif - -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 !defined (GDB_TM_FILE) && defined (DEPRECATED_PUSH_ARGUMENTS) -#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" -#endif -#if !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 - /* DEPRECATED_REGISTER_SIZE can be deleted. */ extern int gdbarch_deprecated_register_size (struct gdbarch *gdbarch); @@ -753,7 +725,7 @@ typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct gdbarch *gdbarch, s extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf); extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype *integer_to_address); -/* NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. */ +/* NOTE: kettenis/2005-09-01: Replaced by PUSH_DUMMY_CALL. */ #if defined (DEPRECATED_STORE_STRUCT_RETURN) /* Legacy for systems yet to multi-arch DEPRECATED_STORE_STRUCT_RETURN */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index a0a6a41433..fdbc70b297 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -469,11 +469,8 @@ M::struct frame_id:unwind_dummy_id:struct frame_info *info:info # DEPRECATED_FP_REGNUM. v:=:int:deprecated_fp_regnum:::-1:-1::0 -# See gdbint.texinfo. See infcall.c. New, all singing all dancing, -# replacement for DEPRECATED_PUSH_ARGUMENTS. +# See gdbint.texinfo. See infcall.c. M::CORE_ADDR:push_dummy_call:struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr -# PUSH_DUMMY_CALL is a direct replacement for DEPRECATED_PUSH_ARGUMENTS. -F:=: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 # DEPRECATED_REGISTER_SIZE can be deleted. v:=:int:deprecated_register_size v:=:int:call_dummy_location::::AT_ENTRY_POINT::0 @@ -501,7 +498,7 @@ f:=:CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, bu f:=:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0 M::CORE_ADDR:integer_to_address:struct type *type, const gdb_byte *buf:type, buf # -# NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. +# NOTE: kettenis/2005-09-01: Replaced by PUSH_DUMMY_CALL. F:=:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp # It has been suggested that this, well actually its predecessor, diff --git a/gdb/infcall.c b/gdb/infcall.c index 54d40d0c40..9c104ad0fc 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -333,6 +333,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) if (!target_has_execution) noprocess (); + if (!gdbarch_push_dummy_call_p (current_gdbarch)) + error (_("This target does not support function calls")); + /* Create a cleanup chain that contains the retbuf (buffer containing the register values). This chain is create BEFORE the inf_status chain so that the inferior status can cleaned up @@ -653,19 +656,9 @@ You must use a pointer to function type variable. Command ignored."), arg_name); /* 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, function, current_regcache, - bp_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 - error (_("This target does not support function calls")); + sp = gdbarch_push_dummy_call (current_gdbarch, function, current_regcache, + bp_addr, nargs, args, sp, struct_return, + struct_addr); /* Set up a frame ID for the dummy frame so we can pass it to set_momentary_breakpoint. We need to give the breakpoint a frame -- 2.11.0