From 1c80067325ac5c90f84154900ac057780b7869af Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 7 Feb 2004 20:45:40 +0000 Subject: [PATCH] * sparc-tdep.h (sparc_fetch_wcookie): New prototype. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Handle StackGhost. --- gdb/ChangeLog | 4 ++++ gdb/sparc-tdep.h | 3 +++ gdb/sparcnbsd-tdep.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 17f3bdeb677..edf959accc7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2004-02-07 Mark Kettenis + * sparc-tdep.h (sparc_fetch_wcookie): New prototype. + * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Handle + StackGhost. + * sparc-tdep.c (sparc32_frame_prev_register): Rename local variable `i6' to `i7'. (sparc_supply_rwindow, sparc_collect_rwindow): Likewise. diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h index 00c41360df0..bbfbb422d9c 100644 --- a/gdb/sparc-tdep.h +++ b/gdb/sparc-tdep.h @@ -147,6 +147,9 @@ struct sparc_frame_cache /* Fetch the instruction at PC. */ extern unsigned long sparc_fetch_instruction (CORE_ADDR pc); +/* Fetch StackGhost Per-Process XOR cookie. */ +extern ULONGEST sparc_fetch_wcookie (void); + extern CORE_ADDR sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, struct sparc_frame_cache *cache); diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c index 7a23ff3134c..b1be7eb5b12 100644 --- a/gdb/sparcnbsd-tdep.c +++ b/gdb/sparcnbsd-tdep.c @@ -141,6 +141,20 @@ sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame) regnum <= SPARC_I7_REGNUM; regnum++, addr += 4) saved_regs[regnum].addr = addr; + /* Handle StackGhost. */ + { + ULONGEST wcookie = sparc_fetch_wcookie (); + + if (wcookie != 0) + { + ULONGEST i7; + + addr = saved_regs[SPARC_I7_REGNUM].addr; + i7 = get_frame_memory_unsigned (next_frame, addr, 4); + trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie); + } + } + /* The floating-point registers are only saved if the EF bit in %prs has been set. */ -- 2.30.2