diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eb3faee3aa..88abf013cf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2005-03-28 Mark Kettenis + + * sparc-tdep.c (sparc_supply_rwindow, sparc_collect_rwindow): + Handle StackGhost in 64-bit code. + * sparc64-tdep.c (sparc64_frame_prev_register): Handle StackGhost. + 2005-03-27 Christopher Faylor * win32-nat.c (handle_exception): Treat win32 routines which check for diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index f9ded35d1d..dcae045588 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1272,6 +1272,16 @@ sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum) if (regnum == i || regnum == -1) { target_read_memory (sp + ((i - SPARC_L0_REGNUM) * 8), buf, 8); + + /* Handle StackGhost. */ + if (i == SPARC_I7_REGNUM) + { + ULONGEST wcookie = sparc_fetch_wcookie (); + ULONGEST i7 = extract_unsigned_integer (buf + offset, 8); + + store_unsigned_integer (buf + offset, 8, i7 ^ wcookie); + } + regcache_raw_supply (regcache, i, buf); } } @@ -1330,6 +1340,16 @@ sparc_collect_rwindow (const struct regcache *regcache, if (regnum == -1 || regnum == SPARC_SP_REGNUM || regnum == i) { regcache_raw_collect (regcache, i, buf); + + /* Handle StackGhost. */ + if (i == SPARC_I7_REGNUM) + { + ULONGEST wcookie = sparc_fetch_wcookie (); + ULONGEST i7 = extract_unsigned_integer (buf + offset, 8); + + store_unsigned_integer (buf, 8, i7 ^ wcookie); + } + target_write_memory (sp + ((i - SPARC_L0_REGNUM) * 8), buf, 8); } } diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index f8087b409b..6038ceb1b4 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -519,6 +519,29 @@ sparc64_frame_prev_register (struct frame_info *next_frame, void **this_cache, return; } + /* Handle StackGhost. */ + { + ULONGEST wcookie = sparc_fetch_wcookie (); + + if (wcookie != 0 && !cache->frameless_p && regnum == SPARC_I7_REGNUM) + { + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + if (valuep) + { + CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 8; + ULONGEST i7; + + /* Read the value in from memory. */ + i7 = get_frame_memory_unsigned (next_frame, addr, 8); + store_unsigned_integer (valuep, 8, i7 ^ wcookie); + } + return; + } + } + /* The previous frame's `local' and `in' registers have been saved in the register save area. */ if (!cache->frameless_p