diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 17f3bdeb67..edf959accc 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 00c41360df..bbfbb422d9 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 7a23ff3134..b1be7eb5b1 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. */