diff options
Diffstat (limited to 'gdb/ppcnbsd-tdep.c')
-rw-r--r-- | gdb/ppcnbsd-tdep.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index adc2a4f1386..2d0b7f130c6 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -30,6 +30,8 @@ #include "ppc-tdep.h" #include "ppcnbsd-tdep.h" #include "nbsd-tdep.h" +#include "tramp-frame.h" +#include "trad-frame.h" #include "solib-svr4.h" @@ -228,6 +230,57 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct type *valtype, } static void +ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self, + struct frame_info *next_frame, + struct trad_frame_cache *this_cache, + CORE_ADDR func) +{ + CORE_ADDR offset; + int i; + struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + this_cache->this_base = frame_unwind_register_unsigned (next_frame, SP_REGNUM); + offset = this_cache->this_base + 0x18 + 2 * tdep->wordsize; + for (i = 0; i < 32; i++) + { + int regnum = i + tdep->ppc_gp0_regnum; + this_cache->prev_regs[regnum].addr = offset; + offset += tdep->wordsize; + } + this_cache->prev_regs[tdep->ppc_lr_regnum].addr = offset; + offset += tdep->wordsize; + this_cache->prev_regs[tdep->ppc_cr_regnum].addr = offset; + offset += tdep->wordsize; + this_cache->prev_regs[tdep->ppc_xer_regnum].addr = offset; + offset += tdep->wordsize; + this_cache->prev_regs[tdep->ppc_ctr_regnum].addr = offset; + offset += tdep->wordsize; + this_cache->prev_regs[PC_REGNUM].addr = offset; /* SRR0? */ + offset += tdep->wordsize; + + /* Construct the frame ID using the function start. */ + this_cache->this_id = frame_id_build (this_cache->this_base, func); +} + +/* Given the NEXTE frame, examine the instructions at and around this + frame's resume address (aka PC) to see of they look like a signal + trampoline. Return the address of the trampolines first + instruction, or zero if it isn't a signal trampoline. */ + +static const struct tramp_frame ppcnbsd_sigtramp = { + 4, /* insn size */ + { /* insn */ + 0x38610018, /* addi r3,r1,24 */ + 0x38000127, /* li r0,295 */ + 0x44000002, /* sc */ + 0x38000001, /* li r0,1 */ + 0x44000002, /* sc */ + }, + ppcnbsd_sigtramp_cache_init +}; + +static void ppcnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { @@ -237,6 +290,7 @@ ppcnbsd_init_abi (struct gdbarch_info info, set_gdbarch_return_value (gdbarch, ppcnbsd_return_value); set_solib_svr4_fetch_link_map_offsets (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets); + tramp_frame_append (gdbarch, &ppcnbsd_sigtramp); } void |