From 49a45ecfd229b6ed70c9c816e143995e8d9e0bb2 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Fri, 1 Oct 2010 15:55:14 +0000 Subject: [PATCH] [sparc] inferior SEGV while calling Ada subprogram gdb/ChangeLog: * sparc-tdep.c (sparc32_frame_align): New function. (sparc32_gdbarch_init): Set the frame_align gdbarch method. * sparc64-tdep.c (sparc64_frame_align): New function. (sparc64_gdbarch_init): Set the frame_align gdbarch method. --- gdb/ChangeLog | 7 +++++++ gdb/sparc-tdep.c | 8 ++++++++ gdb/sparc64-tdep.c | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7e7ceb317da..316271747ef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2010-10-01 Joel Brobecker + + * sparc-tdep.c (sparc32_frame_align): New function. + (sparc32_gdbarch_init): Set the frame_align gdbarch method. + * sparc64-tdep.c (sparc64_frame_align): New function. + (sparc64_gdbarch_init): Set the frame_align gdbarch method. + 2010-09-30 H.J. Lu * defs.h (MAX_REGISTER_SIZE): Set to 64. diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 29a12cf5d65..fd7078366de 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -398,6 +398,13 @@ sparc32_pseudo_register_write (struct gdbarch *gdbarch, } +static CORE_ADDR +sparc32_frame_align (struct gdbarch *gdbarch, CORE_ADDR address) +{ + /* The ABI requires double-word alignment. */ + return address & ~0x7; +} + static CORE_ADDR sparc32_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funcaddr, @@ -1407,6 +1414,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_fp0_regnum (gdbarch, SPARC_F0_REGNUM); /* %f0 */ /* Call dummy code. */ + set_gdbarch_frame_align (gdbarch, sparc32_frame_align); set_gdbarch_call_dummy_location (gdbarch, ON_STACK); set_gdbarch_push_dummy_code (gdbarch, sparc32_push_dummy_code); set_gdbarch_push_dummy_call (gdbarch, sparc32_push_dummy_call); diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 3cd6109f90a..ca89b8c9fd3 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -937,6 +937,13 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, return sp; } +static CORE_ADDR +sparc64_frame_align (struct gdbarch *gdbarch, CORE_ADDR address) +{ + /* The ABI requires 16-byte alignment. */ + return address & ~0xf; +} + static CORE_ADDR sparc64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, @@ -1136,6 +1143,7 @@ sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_pc_regnum (gdbarch, SPARC64_PC_REGNUM); /* %pc */ /* Call dummy code. */ + set_gdbarch_frame_align (gdbarch, sparc64_frame_align); set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); set_gdbarch_push_dummy_code (gdbarch, NULL); set_gdbarch_push_dummy_call (gdbarch, sparc64_push_dummy_call); -- 2.30.2