diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-03-26 22:39:53 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-03-26 22:39:53 +0000 |
commit | e37a6d264dd4cc77b3a5d09fae13a214e0268317 (patch) | |
tree | 0812abe948e85ba24661fc83dcbd0d80a030a7f7 /gdb/valops.c | |
parent | 6a74b20a5f6fda03c0bbc8b5ae4185d786ff4110 (diff) | |
download | gdb-e37a6d264dd4cc77b3a5d09fae13a214e0268317.tar.gz |
2003-03-26 Andrew Cagney <cagney@redhat.com>
* 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 <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Replace
PUSH_ARGUMENTS with push_dummy_call, add gdbarch, regcache and
dummy_addr parameters.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 58 |
1 files changed, 44 insertions, 14 deletions
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); |