summaryrefslogtreecommitdiff
path: root/gdb/sparc64nbsd-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-01-24 22:18:22 +0000
committerMark Kettenis <kettenis@gnu.org>2004-01-24 22:18:22 +0000
commitc424f339ff4bcfe53092bddfd371ef6c7a6906c0 (patch)
treef2c45440979784452398a03ff6d8ff1f732bb87a /gdb/sparc64nbsd-tdep.c
parentef5abf5fe921dbee3f6c53d74373e6495ab9bab0 (diff)
downloadgdb-c424f339ff4bcfe53092bddfd371ef6c7a6906c0.tar.gz
* sparc64-tdep.h (stryct_frame_info, struct trad_frame_saved_reg):
Add opaque declarations. (sparc64nbsd_sigcontext_saved_regs): New prototype. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): New function with code split out from sparc64nbsd_sigcontext_frame_cache. (sparc64nbsd_sigcontext_frame_cache): Use sparc64nbsd_sigcontext_saved_regs. (_initialize_sparc64nbsd_tdep): Don't register OS ABI handler for OpenBSD. * sparc64obsd-tdep.c: New file. * Makefile.in (ALLDEPFILES): Add sparc64obsd-tdep.c. (sparc64obsd-tdep.o): New dependency. * configure.tgt (sparc64-*-openbsd*): Set gdb_target to obsd64 and gdb_osabi to GDB_OSABI_OPENBSD_ELF. * config/sparc/obsd64.mt: New file.
Diffstat (limited to 'gdb/sparc64nbsd-tdep.c')
-rw-r--r--gdb/sparc64nbsd-tdep.c96
1 files changed, 52 insertions, 44 deletions
diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c
index dccb3a1810d..8e7987008e7 100644
--- a/gdb/sparc64nbsd-tdep.c
+++ b/gdb/sparc64nbsd-tdep.c
@@ -88,76 +88,86 @@ sparc64nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
return nbsd_pc_in_sigtramp (pc, name);
}
-static struct sparc_frame_cache *
-sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame,
- void **this_cache)
+struct trad_frame_saved_reg *
+sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
+ struct frame_info *next_frame)
{
- struct sparc_frame_cache *cache;
- CORE_ADDR addr, sigcontext_addr, sp;
- LONGEST fprs;
+ struct trad_frame_saved_reg *saved_regs;
+ CORE_ADDR addr, sp;
int regnum, delta;
- if (*this_cache)
- return *this_cache;
-
- cache = sparc_frame_cache (next_frame, this_cache);
- gdb_assert (cache == *this_cache);
+ saved_regs = trad_frame_alloc_saved_regs (next_frame);
/* The registers are saved in bits and pieces scattered all over the
place. The code below records their location on the assumption
that the part of the signal trampoline that saves the state has
been executed. */
- /* If we couldn't find the frame's function, we're probably dealing
- with an on-stack signal trampoline. */
- if (cache->pc == 0)
- {
- cache->pc = sparc64nbsd_sigtramp_start;
-
- /* Since we couldn't find the frame's function, the cache was
- initialized under the assumption that we're frameless. */
- cache->frameless_p = 0;
- addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
- cache->base = addr;
- }
-
- cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-
- /* We find the appropriate instance of `struct sigcontext' at a
- fixed offset in the signal frame. */
- sigcontext_addr = cache->base + BIAS + 128 + 8;
-
- cache->saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8;
- cache->saved_regs[SPARC64_PC_REGNUM].addr = sigcontext_addr + 16;
- cache->saved_regs[SPARC64_NPC_REGNUM].addr = sigcontext_addr + 24;
- cache->saved_regs[SPARC64_STATE_REGNUM].addr = sigcontext_addr + 32;
- cache->saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 40;
- cache->saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 48;
+ saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8;
+ saved_regs[SPARC64_PC_REGNUM].addr = sigcontext_addr + 16;
+ saved_regs[SPARC64_NPC_REGNUM].addr = sigcontext_addr + 24;
+ saved_regs[SPARC64_STATE_REGNUM].addr = sigcontext_addr + 32;
+ saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 40;
+ saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 48;
/* The remaining `global' registers and %y are saved in the `local'
registers. */
delta = SPARC_L0_REGNUM - SPARC_G0_REGNUM;
for (regnum = SPARC_G2_REGNUM; regnum <= SPARC_G7_REGNUM; regnum++)
- cache->saved_regs[regnum].realreg = regnum + delta;
- cache->saved_regs[SPARC64_Y_REGNUM].realreg = SPARC_L1_REGNUM;
+ saved_regs[regnum].realreg = regnum + delta;
+ saved_regs[SPARC64_Y_REGNUM].realreg = SPARC_L1_REGNUM;
/* The remaining `out' registers can be found in the current frame's
`in' registers. */
delta = SPARC_I0_REGNUM - SPARC_O0_REGNUM;
for (regnum = SPARC_O1_REGNUM; regnum <= SPARC_O5_REGNUM; regnum++)
- cache->saved_regs[regnum].realreg = regnum + delta;
- cache->saved_regs[SPARC_O7_REGNUM].realreg = SPARC_I7_REGNUM;
+ saved_regs[regnum].realreg = regnum + delta;
+ saved_regs[SPARC_O7_REGNUM].realreg = SPARC_I7_REGNUM;
/* The `local' and `in' registers have been saved in the register
save area. */
- addr = cache->saved_regs[SPARC_SP_REGNUM].addr;
+ addr = saved_regs[SPARC_SP_REGNUM].addr;
sp = get_frame_memory_unsigned (next_frame, addr, 8);
for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
- cache->saved_regs[regnum].addr = addr;
+ saved_regs[regnum].addr = addr;
/* TODO: Handle the floating-point registers. */
+ return saved_regs;
+}
+
+static struct sparc_frame_cache *
+sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame,
+ void **this_cache)
+{
+ struct sparc_frame_cache *cache;
+ CORE_ADDR addr;
+
+ if (*this_cache)
+ return *this_cache;
+
+ cache = sparc_frame_cache (next_frame, this_cache);
+ gdb_assert (cache == *this_cache);
+
+ /* If we couldn't find the frame's function, we're probably dealing
+ with an on-stack signal trampoline. */
+ if (cache->pc == 0)
+ {
+ cache->pc = sparc64nbsd_sigtramp_start;
+
+ /* Since we couldn't find the frame's function, the cache was
+ initialized under the assumption that we're frameless. */
+ cache->frameless_p = 0;
+ addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
+ 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;
+ cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame);
+
return cache;
}
@@ -243,6 +253,4 @@ _initialize_sparc64nbsd_tdep (void)
{
gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
GDB_OSABI_NETBSD_ELF, sparc64nbsd_init_abi);
- gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
- GDB_OSABI_OPENBSD_ELF, sparc64nbsd_init_abi);
}