This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Arm frame alignment


The patch below makes the Arm target code use the frame_align callback instead 
of aligning the stack in arm_push_dummy_call.

Tested with cross to arm-none-eabi.
Ok?

Paul

2006-03-07  Paul Brook  <paul@codesourcery.com>

	* arm-tdep.c (arm_push_dummy_call): Remove stack alignment.
	(arm_frame_align): New function.
	(arm_gdbarch_init): Use it.

Index: gdb/arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.205
diff -u -p -r1.205 arm-tdep.c
--- gdb/arm-tdep.c	15 Feb 2006 17:36:11 -0000	1.205
+++ gdb/arm-tdep.c	7 Mar 2006 19:33:02 -0000
@@ -1173,11 +1173,6 @@ arm_push_dummy_call (struct gdbarch *gdb
   argreg = ARM_A1_REGNUM;
   nstack = 0;
 
-  /* Some platforms require a double-word aligned stack.  Make sure sp
-     is correctly aligned before we start.  We always do this even if
-     it isn't really needed -- it can never hurt things.  */
-  sp &= ~(CORE_ADDR)(2 * DEPRECATED_REGISTER_SIZE - 1);
-
   /* The struct_return pointer occupies the first parameter
      passing register.  */
   if (struct_return)
@@ -1299,6 +1294,17 @@ arm_push_dummy_call (struct gdbarch *gdb
   return sp;
 }
 
+
+/* Always align the frame to an 8-byte boundary.  This is required on
+   some platforms and harmless on the rest.  */
+
+static CORE_ADDR
+arm_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
+{
+  /* Align the stack to eight bytes.  */
+  return sp & ~ (CORE_ADDR) 7;
+}
+
 static void
 print_fpu_flags (int flags)
 {
@@ -2738,6 +2744,7 @@ arm_gdbarch_init (struct gdbarch_info in
   tdep->jb_pc = -1;	/* Longjump support not enabled by default.  */
 
   set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call);
+  set_gdbarch_frame_align (gdbarch, arm_frame_align);
 
   set_gdbarch_write_pc (gdbarch, arm_write_pc);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]