/* Target-dependent code for NetBSD/sparc64.
- Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Based on code contributed by Wasabi Systems, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
#include "defs.h"
#include "frame.h"
#include "regcache.h"
#include "regset.h"
#include "symtab.h"
+#include "objfiles.h"
#include "solib-svr4.h"
#include "trad-frame.h"
struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
- sparc64_supply_gregset (regset->descr, regcache, regnum, gregs);
+ sparc64_supply_gregset (&sparc64nbsd_gregset, regcache, regnum, gregs);
}
static void
regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
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, 8);
+ trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie);
+ }
+ }
+
/* TODO: Handle the floating-point registers. */
return saved_regs;
initialized under the assumption that we're frameless. */
cache->frameless_p = 0;
addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
+ if (addr & 1)
+ addr += BIAS;
cache->base = addr;
}
/* We find the appropriate instance of `struct sigcontext' at a
fixed offset in the signal frame. */
- addr = cache->base + BIAS + 128 + 8;
+ addr = cache->base + 128 + 8;
cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame);
return cache;
int regnum, int *optimizedp,
enum lval_type *lvalp,
CORE_ADDR *addrp,
- int *realnump, void *valuep)
+ int *realnump, gdb_byte *valuep)
{
struct sparc_frame_cache *cache =
sparc64nbsd_sigcontext_frame_cache (next_frame, this_cache);
- trad_frame_prev_register (next_frame, cache->saved_regs, regnum,
- optimizedp, lvalp, addrp, realnump, valuep);
+ trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
+ optimizedp, lvalp, addrp, realnump, valuep);
}
static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- tdep->gregset = XMALLOC (struct regset);
- tdep->gregset->descr = &sparc64nbsd_gregset;
- tdep->gregset->supply_regset = sparc64nbsd_supply_gregset;
+ tdep->gregset = regset_alloc (gdbarch, sparc64nbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 160;
- tdep->fpregset = XMALLOC (struct regset);
- tdep->fpregset->supply_regset = sparc64nbsd_supply_fpregset;
+ tdep->fpregset = regset_alloc (gdbarch, sparc64nbsd_supply_fpregset, NULL);
tdep->sizeof_fpregset = 272;
- set_gdbarch_pc_in_sigtramp (gdbarch, sparc64nbsd_pc_in_sigtramp);
+ /* Make sure we can single-step "new" syscalls. */
+ tdep->step_trap = sparcnbsd_step_trap;
+
frame_unwind_append_sniffer (gdbarch, sparc64nbsd_sigtramp_frame_sniffer);
sparc64_init_abi (info, gdbarch);
+ /* NetBSD/sparc64 has SVR4-style shared libraries. */
+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_solib_svr4_fetch_link_map_offsets
- (gdbarch, nbsd_lp64_solib_svr4_fetch_link_map_offsets);
+ (gdbarch, svr4_lp64_fetch_link_map_offsets);
}
-
\f
+
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_sparc64nbsd_tdep (void);