diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-01-25 11:46:45 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-01-25 11:46:45 +0000 |
commit | 566626fa4d304dee56adbefb82edc25d94c0dfa9 (patch) | |
tree | 5549d29a700619e690e30cd78dd2daea22bf2bd6 /gdb/sparcnbsd-tdep.c | |
parent | f0f207fd1d908a09ce535fe459234bbdcdb10ffd (diff) | |
download | gdb-566626fa4d304dee56adbefb82edc25d94c0dfa9.zip gdb-566626fa4d304dee56adbefb82edc25d94c0dfa9.tar.gz gdb-566626fa4d304dee56adbefb82edc25d94c0dfa9.tar.bz2 |
* sparc-tdep.h (sparc32nbsd_sigcontext_saved_regs): New prototype.
* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): New
function with code split out from
sparc32nbsd_sigcontext_frame_cache.
(sparc32nbsd_sigcontext_frame_cache): Use
sparc32nbsd_sigcontext_saved_regs.
(_initialize_sparc32nbsd_tdep): Don't register OS ABI handler for
OpenBSD.
* sparcobsd-tdep.c: New file.
* Makefile.in (ALLDEPFILES): Add sparcobsd-tdep.c.
(sparcobsd-tdep.o): New dependency.
* configure.tgt (sparc-*-openbsd*): Set gdb_target to obsd.
* config/sparc/obsd.mt: New file.
Diffstat (limited to 'gdb/sparcnbsd-tdep.c')
-rw-r--r-- | gdb/sparcnbsd-tdep.c | 100 |
1 files changed, 55 insertions, 45 deletions
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c index 631697c..21b3aca 100644 --- a/gdb/sparcnbsd-tdep.c +++ b/gdb/sparcnbsd-tdep.c @@ -90,92 +90,104 @@ sparc32nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) return nbsd_pc_in_sigtramp (pc, name); } -static struct sparc_frame_cache * -sparc32nbsd_sigcontext_frame_cache (struct frame_info *next_frame, - void **this_cache) +struct trad_frame_saved_reg * +sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame) { - struct sparc_frame_cache *cache; + struct trad_frame_saved_reg *saved_regs; CORE_ADDR addr, sigcontext_addr; - LONGEST psr; int regnum, delta; + ULONGEST psr; - if (*this_cache) - return *this_cache; + saved_regs = trad_frame_alloc_saved_regs (next_frame); - cache = sparc_frame_cache (next_frame, this_cache); - gdb_assert (cache == *this_cache); + /* We find the appropriate instance of `struct sigcontext' at a + fixed offset in the signal frame. */ + addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + sigcontext_addr = addr + 64 + 16; /* 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 = sparc32nbsd_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 + 64 + 16; - - cache->saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8; - cache->saved_regs[SPARC32_PC_REGNUM].addr = sigcontext_addr + 12; - cache->saved_regs[SPARC32_NPC_REGNUM].addr = sigcontext_addr + 16; - cache->saved_regs[SPARC32_PSR_REGNUM].addr = sigcontext_addr + 20; - cache->saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 24; - cache->saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 28; + saved_regs[SPARC_SP_REGNUM].addr = sigcontext_addr + 8; + saved_regs[SPARC32_PC_REGNUM].addr = sigcontext_addr + 12; + saved_regs[SPARC32_NPC_REGNUM].addr = sigcontext_addr + 16; + saved_regs[SPARC32_PSR_REGNUM].addr = sigcontext_addr + 20; + saved_regs[SPARC_G1_REGNUM].addr = sigcontext_addr + 24; + saved_regs[SPARC_O0_REGNUM].addr = sigcontext_addr + 28; /* 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[SPARC32_Y_REGNUM].realreg = SPARC_L1_REGNUM; + saved_regs[regnum].realreg = regnum + delta; + saved_regs[SPARC32_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; addr = get_frame_memory_unsigned (next_frame, addr, 4); for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++, addr += 4) - cache->saved_regs[regnum].addr = addr; + saved_regs[regnum].addr = addr; /* The floating-point registers are only saved if the EF bit in %prs has been set. */ #define PSR_EF 0x00001000 - addr = cache->saved_regs[SPARC32_PSR_REGNUM].addr; + addr = saved_regs[SPARC32_PSR_REGNUM].addr; psr = get_frame_memory_unsigned (next_frame, addr, 4); if (psr & PSR_EF) { CORE_ADDR sp; sp = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); - cache->saved_regs[SPARC32_FSR_REGNUM].addr = sp + 96; + saved_regs[SPARC32_FSR_REGNUM].addr = sp + 96; for (regnum = SPARC_F0_REGNUM, addr = sp + 96 + 8; regnum <= SPARC_F31_REGNUM; regnum++, addr += 4) - cache->saved_regs[regnum].addr = addr; + saved_regs[regnum].addr = addr; + } + + return saved_regs; +} + +static struct sparc_frame_cache * +sparc32nbsd_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 = sparc32nbsd_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 = sparc32nbsd_sigcontext_saved_regs (next_frame); + return cache; } @@ -325,6 +337,4 @@ _initialize_sparnbsd_tdep (void) sparc32nbsd_aout_init_abi); gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD_ELF, sparc32nbsd_elf_init_abi); - gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_OPENBSD_ELF, - sparc32nbsd_elf_init_abi); } |