This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfc/rfa-hp] #ifndef NO_EXTRA_ALIGNMENT_NEEDED multi-arch
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [rfc/rfa-hp] #ifndef NO_EXTRA_ALIGNMENT_NEEDED multi-arch
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Wed, 02 Aug 2000 21:31:37 +1000
Hello,
The attatched replaces:
#ifndef NO_EXTRA_ALIGNMENT_NEEDED
with the multi-arched:
if (EXTRA_STACK_ALIGNMENT_DEEDED)
The double negative in the original made my head hurt :-)
Both the d10v and HP/PA targets needed to be updated.
The HP tweek could do with an extra set of eyes.
Andrew
Wed Aug 2 21:15:26 2000 Andrew Cagney <cagney@b1.cygnus.com>
* d10v-tdep.c (d10v_gdbarch_init): Set extra_stack_alignment_needed to
0.
* config/d10v/tm-d10v.h (NO_EXTRA_ALIGNMENT_NEEDED): Delete.
* config/pa/tm-hppa.h (EXTRA_STACK_ALIGNMENT_NEEDED): Replace
NO_EXTRA_ALIGNMENT_NEEDED.
* valops.c (hand_function_call): Replace #ifndef
NO_EXTRA_ALIGNMENT_NEEDED with if EXTRA_STACK_ALIGNMENT_NEEDED.
* gdbarch.sh (EXTRA_STACK_ALIGNMENT_NEEDED): Add.
* gdbarch.h, gdbarch.c: Regenerate.
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.9
diff -p -r1.9 d10v-tdep.c
*** d10v-tdep.c 2000/08/02 11:05:50 1.9
--- d10v-tdep.c 2000/08/02 11:27:18
*************** d10v_gdbarch_init (struct gdbarch_info i
*** 1603,1608 ****
--- 1603,1609 ----
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);
return gdbarch;
}
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.29
diff -p -r1.29 gdbarch.h
*** gdbarch.h 2000/08/02 11:05:50 1.29
--- gdbarch.h 2000/08/02 11:27:24
*************** extern void set_gdbarch_stack_align (str
*** 1114,1119 ****
--- 1114,1132 ----
#endif
#endif
+ /* Default (value) for non- multi-arch platforms. */
+ #if (!GDB_MULTI_ARCH) && !defined (EXTRA_STACK_ALIGNMENT_NEEDED)
+ #define EXTRA_STACK_ALIGNMENT_NEEDED (1)
+ #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
+ #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))
+ #endif
+ #endif
+
#if defined (REG_STRUCT_HAS_ADDR)
/* Legacy for systems yet to multi-arch REG_STRUCT_HAS_ADDR */
#define REG_STRUCT_HAS_ADDR_P() (1)
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.35
diff -p -r1.35 gdbarch.sh
*** gdbarch.sh 2000/08/02 11:05:50 1.35
--- gdbarch.sh 2000/08/02 11:27:29
*************** f:2:SAVED_PC_AFTER_CALL:CORE_ADDR:saved_
*** 426,431 ****
--- 426,432 ----
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
+ v:1:EXTRA_STACK_ALIGNMENT_NEEDED:int:extra_stack_alignment_needed::::0:1::0:::
F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0
F:2:SAVE_DUMMY_FRAME_TOS:void:save_dummy_frame_tos:CORE_ADDR sp:sp::0:0
#
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.23
diff -p -r1.23 valops.c
*** valops.c 2000/07/30 01:48:27 1.23
--- valops.c 2000/08/02 11:27:38
*************** You must use a pointer to function type
*** 1581,1607 ****
}
}
! /* elz: on HPPA no need for this extra alignment, maybe it is needed
! 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 */
! #ifndef NO_EXTRA_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 stack in
! a target-defined manner. */
! if (STACK_ALIGN_P () && INNER_THAN (1, 2))
{
! /* If stack grows down, we must leave a hole at the top. */
! int len = 0;
! for (i = nargs - 1; i >= 0; i--)
! len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
! if (CALL_DUMMY_STACK_ADJUST_P)
! len += CALL_DUMMY_STACK_ADJUST;
! sp -= STACK_ALIGN (len) - len;
}
- #endif /* NO_EXTRA_ALIGNMENT_NEEDED */
sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr);
--- 1581,1607 ----
}
}
! /* elz: on HPPA no need for this extra alignment, maybe it is needed
! 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)
{
! /* 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. */
! if (STACK_ALIGN_P () && INNER_THAN (1, 2))
! {
! /* If stack grows down, we must leave a hole at the top. */
! int len = 0;
! for (i = nargs - 1; i >= 0; i--)
! len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
! if (CALL_DUMMY_STACK_ADJUST_P)
! len += CALL_DUMMY_STACK_ADJUST;
! sp -= STACK_ALIGN (len) - len;
! }
}
sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr);
Index: config/pa/tm-hppa.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/tm-hppa.h,v
retrieving revision 1.4
diff -p -r1.4 tm-hppa.h
*** tm-hppa.h 2000/05/28 01:12:37 1.4
--- tm-hppa.h 2000/08/02 11:27:42
*************** extern CORE_ADDR saved_pc_after_call (st
*** 106,112 ****
On hppa the sp must always be kept 64-bit aligned */
#define STACK_ALIGN(arg) ( ((arg)%8) ? (((arg)+7)&-8) : (arg))
! #define NO_EXTRA_ALIGNMENT_NEEDED 1
/* Sequence of bytes for breakpoint instruction. */
--- 106,112 ----
On hppa the sp must always be kept 64-bit aligned */
#define STACK_ALIGN(arg) ( ((arg)%8) ? (((arg)+7)&-8) : (arg))
! #define EXTRA_STACK_ALIGNMENT_NEEDED 0
/* Sequence of bytes for breakpoint instruction. */