From f933a9c5851c1f824cdebb439a101e6f0ea1688e Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 25 Mar 2003 22:56:41 +0000 Subject: [PATCH] 2003-03-25 Andrew Cagney * gdbarch.sh (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Replace EXTRA_STACK_ALIGNMENT_NEEDED. Default to 0 not 1. * gdbarch.h, gdbarch.c: Re-generate. * config/sparc/tm-sparc.h (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Define. * sparc-tdep.c (sparc_gdbarch_init): Set deprecated_extra_stack_alignment_needed. * config/pa/tm-hppa.h (EXTRA_STACK_ALIGNMENT_NEEDED): Delete. * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not clear extra_stack_alignment_needed. * v850-tdep.c (v850_gdbarch_init): Ditto. * hppa-tdep.c (hppa_gdbarch_init): Ditto. * h8300-tdep.c (h8300_gdbarch_init): Ditto. * d10v-tdep.c (d10v_gdbarch_init): Ditto. * cris-tdep.c (cris_gdbarch_init): Ditto. * m68k-tdep.c (m68k_gdbarch_init): Ditto. * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/config/pa/tm-hppa.h | 4 ---- gdb/config/sparc/tm-sparc.h | 1 + gdb/cris-tdep.c | 3 --- gdb/d10v-tdep.c | 1 - gdb/gdbarch.c | 35 +++++++++++++++++------------------ gdb/gdbarch.h | 18 ++++++++++-------- gdb/gdbarch.sh | 3 ++- gdb/h8300-tdep.c | 1 - gdb/hppa-tdep.c | 1 - gdb/m68hc11-tdep.c | 1 + gdb/m68k-tdep.c | 2 +- gdb/sparc-tdep.c | 2 ++ gdb/v850-tdep.c | 2 -- gdb/valops.c | 5 ++++- gdb/xstormy16-tdep.c | 1 - 16 files changed, 58 insertions(+), 42 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 81f4ed76917..cb09e2188b1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2003-03-25 Andrew Cagney + + * gdbarch.sh (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Replace + EXTRA_STACK_ALIGNMENT_NEEDED. Default to 0 not 1. + * gdbarch.h, gdbarch.c: Re-generate. + * config/sparc/tm-sparc.h + (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Define. + * sparc-tdep.c (sparc_gdbarch_init): Set + deprecated_extra_stack_alignment_needed. + * config/pa/tm-hppa.h (EXTRA_STACK_ALIGNMENT_NEEDED): Delete. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not clear + extra_stack_alignment_needed. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * hppa-tdep.c (hppa_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * m68k-tdep.c (m68k_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + 2003-03-25 Andrew Cagney * gdbarch.sh (DEPRECATED_STORE_STRUCT_RETURN): Replace diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 2c21903f828..64a4fe1362f 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -116,10 +116,6 @@ extern CORE_ADDR hppa_stack_align (CORE_ADDR sp); #define STACK_ALIGN(sp) hppa_stack_align (sp) #endif -#if !GDB_MULTI_ARCH -#define EXTRA_STACK_ALIGNMENT_NEEDED 0 -#endif - /* Sequence of bytes for breakpoint instruction. */ #define BREAKPOINT {0x00, 0x01, 0x00, 0x04} diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index e3c08b581c9..7b11c4fbd58 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -756,3 +756,4 @@ extern int deferred_stores; #define TM_PRINT_INSN_MACH bfd_mach_sparc +#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED 1 diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index f075050653e..8bf06466b7e 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -4320,9 +4320,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - /* No extra stack alignment needed. Set to 1 by default. */ - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); - /* Helpful for backtracing and returning in a call dummy. */ set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 583f8b11115..d9c95c78d31 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1715,7 +1715,6 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_stack_align (gdbarch, d10v_stack_align); set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_print_registers_info (gdbarch, d10v_print_registers_info); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index ba7fdb52a23..c45a70f054f 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -248,7 +248,7 @@ struct gdbarch gdbarch_frame_num_args_ftype *frame_num_args; gdbarch_stack_align_ftype *stack_align; gdbarch_frame_align_ftype *frame_align; - int extra_stack_alignment_needed; + int deprecated_extra_stack_alignment_needed; gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr; gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos; gdbarch_unwind_dummy_id_ftype *unwind_dummy_id; @@ -559,7 +559,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not; current_gdbarch->frame_args_address = get_frame_base; current_gdbarch->frame_locals_address = get_frame_base; - current_gdbarch->extra_stack_alignment_needed = 1; current_gdbarch->convert_from_func_ptr_addr = core_addr_identity; current_gdbarch->addr_bits_remove = core_addr_identity; current_gdbarch->smash_text_address = core_addr_identity; @@ -762,7 +761,7 @@ verify_gdbarch (struct gdbarch *gdbarch) fprintf_unfiltered (log, "\n\tframe_num_args"); /* Skip verify of stack_align, has predicate */ /* Skip verify of frame_align, has predicate */ - /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */ + /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */ /* Skip verify of reg_struct_has_addr, has predicate */ /* Skip verify of save_dummy_frame_tos, has predicate */ /* Skip verify of unwind_dummy_id, has predicate */ @@ -1160,6 +1159,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_extract_struct_value_address /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/); #endif +#ifdef DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED # %s\n", + XSTRING (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED = %d\n", + DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED); +#endif #ifdef DEPRECATED_FRAME_CHAIN_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1578,14 +1585,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->extract_struct_value_address /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/); #endif -#ifdef EXTRA_STACK_ALIGNMENT_NEEDED - fprintf_unfiltered (file, - "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED # %s\n", - XSTRING (EXTRA_STACK_ALIGNMENT_NEEDED)); - fprintf_unfiltered (file, - "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED = %d\n", - EXTRA_STACK_ALIGNMENT_NEEDED); -#endif #ifdef FIX_CALL_DUMMY #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -5002,20 +5001,20 @@ set_gdbarch_frame_align (struct gdbarch *gdbarch, } int -gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch) +gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */ + /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */ if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_extra_stack_alignment_needed called\n"); - return gdbarch->extra_stack_alignment_needed; + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extra_stack_alignment_needed called\n"); + return gdbarch->deprecated_extra_stack_alignment_needed; } void -set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch, - int extra_stack_alignment_needed) +set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch, + int deprecated_extra_stack_alignment_needed) { - gdbarch->extra_stack_alignment_needed = extra_stack_alignment_needed; + gdbarch->deprecated_extra_stack_alignment_needed = deprecated_extra_stack_alignment_needed; } int diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 422ea157025..dd66773a8ac 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2417,19 +2417,21 @@ typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADD extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address); extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align); +/* NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS. */ + /* Default (value) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (EXTRA_STACK_ALIGNMENT_NEEDED) -#define EXTRA_STACK_ALIGNMENT_NEEDED (1) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED) +#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (0) #endif -extern int gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch); -extern void set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch, int extra_stack_alignment_needed); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRA_STACK_ALIGNMENT_NEEDED) -#error "Non multi-arch definition of EXTRA_STACK_ALIGNMENT_NEEDED" +extern int gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch, int deprecated_extra_stack_alignment_needed); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED) +#error "Non multi-arch definition of DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRA_STACK_ALIGNMENT_NEEDED) -#define EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_extra_stack_alignment_needed (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED) +#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_deprecated_extra_stack_alignment_needed (current_gdbarch)) #endif #endif diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 84eaf573ee2..a1122e17ea9 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -602,7 +602,8 @@ f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0 # F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0 M:::CORE_ADDR:frame_align:CORE_ADDR address:address -v:2:EXTRA_STACK_ALIGNMENT_NEEDED:int:extra_stack_alignment_needed::::0:1::0::: +# NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS. +v:2:DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED:int:deprecated_extra_stack_alignment_needed::::0:0::0::: F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0 # FIXME: kettenis/2003-03-08: This should be replaced by a function # parametrized with (at least) the regcache. diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index dde14f9694f..e78bc0f3813 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1173,7 +1173,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT); /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */ - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_believe_pcc_promotion (gdbarch, 1); return gdbarch; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 1ad9a5b8790..2f5412e2bb6 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -4967,7 +4967,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call); set_gdbarch_inner_than (gdbarch, hppa_inner_than); set_gdbarch_stack_align (gdbarch, hppa_stack_align); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_register_size (gdbarch, 4); set_gdbarch_num_regs (gdbarch, hppa_num_regs); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 436b3b32314..02ba5c0b096 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1424,6 +1424,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc); set_gdbarch_stack_align (gdbarch, m68hc11_stack_align); + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11); m68hc11_add_reggroups (gdbarch); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 2e359fb23ba..a72ea534671 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -1000,7 +1000,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Stack grows down. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_stack_align (gdbarch, m68k_stack_align); - + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_decr_pc_after_break (gdbarch, 2); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 476616bc217..e9daad8de60 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -3275,6 +3275,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); #endif set_gdbarch_stack_align (gdbarch, sparc32_stack_align); + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); set_gdbarch_deprecated_store_struct_return (gdbarch, sparc32_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention); @@ -3332,6 +3333,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); #endif set_gdbarch_stack_align (gdbarch, sparc64_stack_align); + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); set_gdbarch_deprecated_store_struct_return (gdbarch, sparc64_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, sparc64_use_struct_convention); diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index f7d34c8d032..9bae316adcd 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1292,8 +1292,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); - return gdbarch; } diff --git a/gdb/valops.c b/gdb/valops.c index f6c83ac17e3..ff24a9f4e7c 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1599,7 +1599,10 @@ You must use a pointer to function type variable. Command ignored.", arg_name); on other architectures. This is because all the alignment is taken care of in the above code (ifdef REG_STRUCT_HAS_ADDR) and in hppa_push_arguments */ - if (EXTRA_STACK_ALIGNMENT_NEEDED) + /* NOTE: cagney/2003-03-24: The below code is very broken. Given an + odd sized parameter the below will mis-align the stack. As was + suggested back in '96, better to let PUSH_ARGUMENTS handle it. */ + 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 diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 5cce01936c9..5408a08adb2 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1114,7 +1114,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address); set_gdbarch_stack_align (gdbarch, xstormy16_stack_align); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos); -- 2.30.2