static CORE_ADDR alpha_linux_sigcontext_addr (struct frame_info *this_frame) { struct gdbarch *gdbarch = get_frame_arch (this_frame); CORE_ADDR pc; ULONGEST sp; long off; pc = get_frame_pc (this_frame); sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM); off = alpha_linux_sigtramp_offset (gdbarch, pc); gdb_assert (off >= 0); /* __NR_rt_sigreturn has a couple of structures on the stack. This is: struct rt_sigframe { struct siginfo info; struct ucontext uc; }; offsetof (struct rt_sigframe, uc.uc_mcontext); */ if (alpha_read_insn (gdbarch, pc - off + 4) == 0x201f015f) return sp + 176; /* __NR_sigreturn has the sigcontext structure at the top of the stack. */ return sp; }
static CORE_ADDR alpha_linux_sigcontext_addr (struct frame_info *next_frame) { CORE_ADDR pc; ULONGEST sp; long off; pc = frame_pc_unwind (next_frame); frame_unwind_unsigned_register (next_frame, ALPHA_SP_REGNUM, &sp); off = alpha_linux_sigtramp_offset (pc); gdb_assert (off >= 0); /* __NR_rt_sigreturn has a couple of structures on the stack. This is: struct rt_sigframe { struct siginfo info; struct ucontext uc; }; offsetof (struct rt_sigframe, uc.uc_mcontext); */ if (alpha_read_insn (pc - off + 4) == 0x201f015f) return sp + 176; /* __NR_sigreturn has the sigcontext structure at the top of the stack. */ return sp; }
static int alphaobsd_pc_in_sigtramp (CORE_ADDR pc, char *name) { CORE_ADDR start_pc = (pc & ~(alphaobsd_page_size - 1)); unsigned insn; if (name) return 0; /* Check for "". */ insn = alpha_read_insn (start_pc + 5 * ALPHA_INSN_SIZE); if (insn != 0x201f0067) return 0; /* Check for "". */ insn = alpha_read_insn (start_pc + 6 * ALPHA_INSN_SIZE); if (insn != 0x00000083) return 0; return 1; }
static long alpha_linux_sigtramp_offset_1 (struct gdbarch *gdbarch, CORE_ADDR pc) { switch (alpha_read_insn (gdbarch, pc)) { case 0x47de0410: /* bis $30,$30,$16 */ case 0x47fe0410: /* bis $31,$30,$16 */ return 0; case 0x43ecf400: /* addq $31,103,$0 */ case 0x201f0067: /* lda $0,103($31) */ case 0x201f015f: /* lda $0,351($31) */ return 4; case 0x00000083: /* call_pal callsys */ return 8; default: return -1; } }