diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-02-04 21:49:58 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-02-04 21:49:58 +0000 |
commit | baf92889ebd77dceec279733db08e537eefbff49 (patch) | |
tree | 46f836a0e5e0b0fe877ce37226f1c6ac3bb60282 /gdb/sparc-tdep.c | |
parent | 6e4c6c91defcde7bd46625742b7df8108e8d597f (diff) | |
download | gdb-baf92889ebd77dceec279733db08e537eefbff49.zip gdb-baf92889ebd77dceec279733db08e537eefbff49.tar.gz gdb-baf92889ebd77dceec279733db08e537eefbff49.tar.bz2 |
* target.h (target_object): Add TARGET_OBJECT_WCOOKIE.
* inftarg.c: Update copyright year.
(child_xfer_partial): Add support for TARGET_OBJECT_WCOOKIE.
* sparc-nat.c: Include "target.h" and "gdb_assert.h".
(sparc_xfer_wcookie): New function.
* sparc-tdep.c (sparc_fetch_wcookie): New function.
* Makefile.in (sparc-nat.o): Update dependencies.
* config/sparc/nm-nbsd.h: Include "target.h".
(NATIVE_XFER_WCOOKIE): New define.
(sparc_xfer_wcookie): New prototype.
Diffstat (limited to 'gdb/sparc-tdep.c')
-rw-r--r-- | gdb/sparc-tdep.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 1719109..bbe5665 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -141,13 +141,21 @@ sparc_fetch_instruction (CORE_ADDR pc) ULONGEST sparc_fetch_wcookie (void) { - /* FIXME: kettenis/20040131: We should fetch the cookie from the - target. For now, return zero, which is right for targets without - StackGhost. */ - return 0; -} + struct target_ops *ops = ¤t_target; + char buf[8]; + int len; + + len = target_read_partial (ops, TARGET_OBJECT_WCOOKIE, NULL, buf, 0, 8); + if (len == -1) + return 0; + + /* We should have either an 32-bit or an 64-bit cookie. */ + gdb_assert (len == 4 || len == 8); + return extract_unsigned_integer (buf, len); +} + /* Return the contents if register REGNUM as an address. */ static CORE_ADDR |