From 80f9e3aafedebe1e99fab2f000eedcdcd7c60c34 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 5 Apr 2006 19:19:12 +0000 Subject: [PATCH] * sparc-linux-tdep.c (sparc32_linux_sigframe_init): Pull register window out of the correct stack frame. * sparc64-linux-tdep.c (sparc64_linux_sigframe_init): Likewise. --- gdb/ChangeLog | 3 +++ gdb/sparc-linux-tdep.c | 7 +++++-- gdb/sparc64-linux-tdep.c | 10 +++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4f944abd108..88119f61fd2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -3,6 +3,9 @@ * sparc-tdep.c (sparc32_dwarf2_frame_init_reg): New. (sparc32_gdbarch_init): Pass it to dwarf2_frame_set_init_reg. * Makefile.in (sparc-tdep.o): Update dependencies. + * sparc-linux-tdep.c (sparc32_linux_sigframe_init): Pull register + window out of the correct stack frame. + * sparc64-linux-tdep.c (sparc64_linux_sigframe_init): Likewise. 2006-04-04 David S. Miller diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c index 300db9aa7dd..328889b4c8e 100644 --- a/gdb/sparc-linux-tdep.c +++ b/gdb/sparc-linux-tdep.c @@ -91,7 +91,7 @@ sparc32_linux_sigframe_init (const struct tramp_frame *self, struct trad_frame_cache *this_cache, CORE_ADDR func) { - CORE_ADDR base, addr; + CORE_ADDR base, addr, sp_addr; int regnum; base = frame_unwind_register_unsigned (next_frame, SPARC_O1_REGNUM); @@ -107,13 +107,16 @@ sparc32_linux_sigframe_init (const struct tramp_frame *self, /* Since %g0 is always zero, keep the identity encoding. */ addr = base + 20; + sp_addr = base + 16 + ((SPARC_SP_REGNUM - SPARC_G0_REGNUM) * 4); for (regnum = SPARC_G1_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); addr += 4; } - base = addr = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + base = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + addr = get_frame_memory_unsigned (next_frame, sp_addr, 4); + for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c index 9c64ca6800d..ce1c6cbcf88 100644 --- a/gdb/sparc64-linux-tdep.c +++ b/gdb/sparc64-linux-tdep.c @@ -59,7 +59,7 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self, struct trad_frame_cache *this_cache, CORE_ADDR func) { - CORE_ADDR base, addr; + CORE_ADDR base, addr, sp_addr; int regnum; base = frame_unwind_register_unsigned (next_frame, SPARC_O1_REGNUM); @@ -69,6 +69,7 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self, /* Since %g0 is always zero, keep the identity encoding. */ addr = base + 8; + sp_addr = base + ((SPARC_SP_REGNUM - SPARC_G0_REGNUM) * 8); for (regnum = SPARC_G1_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); @@ -81,11 +82,14 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self, trad_frame_set_reg_addr (this_cache, SPARC64_Y_REGNUM, addr + 24); trad_frame_set_reg_addr (this_cache, SPARC64_FPRS_REGNUM, addr + 28); - addr = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + base = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + if (base & 1) + base += BIAS; + + addr = get_frame_memory_unsigned (next_frame, sp_addr, 8); if (addr & 1) addr += BIAS; - base = addr; for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); -- 2.30.2