static CORE_ADDR sparc64_linux_step_trap (struct frame_info *frame, unsigned long insn) { /* __NR_rt_sigreturn is 101 */ if ((insn == 0x91d0206d) && (get_frame_register_unsigned (frame, SPARC_G1_REGNUM) == 101)) { struct gdbarch *gdbarch = get_frame_arch (frame); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); ULONGEST sp = get_frame_register_unsigned (frame, SPARC_SP_REGNUM); if (sp & 1) sp += BIAS; /* The kernel puts the sigreturn registers on the stack, and this is where the signal unwinding state is take from when returning from a signal. A siginfo_t sits 192 bytes from the base of the stack. This siginfo_t is 128 bytes, and is followed by the sigreturn register save area. The saved PC sits at a 136 byte offset into there. */ return read_memory_unsigned_integer (sp + 192 + 128 + 136, 8, byte_order); } return 0; }
static void tilegx_linux_sigframe_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { CORE_ADDR pc = get_frame_register_unsigned (this_frame, 64); CORE_ADDR sp = get_frame_register_unsigned (this_frame, 54); /* Base address of register save area. */ CORE_ADDR base = sp + 16 /* Skip ABI_SAVE_AREA. */ + 128 /* Skip SIGINFO. */ + 40; /* Skip UCONTEXT. */ /* Address of saved LR register (R56) which holds previous PC. */ CORE_ADDR prev_pc = base + 56 * 8; int i; for (i = 0; i < 56; i++) trad_frame_set_reg_addr (this_cache, i, base + i * 8); trad_frame_set_reg_value (this_cache, 64, get_frame_memory_unsigned (this_frame, prev_pc, 8)); /* Save a frame ID. */ trad_frame_set_id (this_cache, frame_id_build (base, func)); }
static void m68kobsd_sigtramp_cache_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { CORE_ADDR addr, base, pc; int regnum; base = get_frame_register_unsigned (this_frame, M68K_SP_REGNUM); /* The 'addql #4,%sp' instruction at offset 8 adjusts the stack pointer. Adjust the frame base accordingly. */ pc = get_frame_register_unsigned (this_frame, M68K_PC_REGNUM); if ((pc - func) > 8) base -= 4; /* Get frame pointer, stack pointer, program counter and processor state from `struct sigcontext'. */ addr = get_frame_memory_unsigned (this_frame, base + 8, 4); trad_frame_set_reg_addr (this_cache, M68K_FP_REGNUM, addr + 8); trad_frame_set_reg_addr (this_cache, M68K_SP_REGNUM, addr + 12); trad_frame_set_reg_addr (this_cache, M68K_PC_REGNUM, addr + 20); trad_frame_set_reg_addr (this_cache, M68K_PS_REGNUM, addr + 24); /* The sc_ap member of `struct sigcontext' points to additional hardware state. Here we find the missing registers. */ addr = get_frame_memory_unsigned (this_frame, addr + 16, 4) + 4; for (regnum = M68K_D0_REGNUM; regnum < M68K_FP_REGNUM; regnum++, addr += 4) trad_frame_set_reg_addr (this_cache, regnum, addr); /* Construct the frame ID using the function start. */ trad_frame_set_id (this_cache, frame_id_build (base, func)); }
static struct sparc_frame_cache * sparc64fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR fp, sp, trapframe_addr; int regnum; if (*this_cache) return (struct sparc_frame_cache *)*this_cache; cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); fp = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM); trapframe_addr = fp + BIAS - TRAPFRAME_SIZE; sp = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM); cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); cache->saved_regs[SPARC_SP_REGNUM].addr = trapframe_addr + OFF_TF_SP; #ifdef notyet cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr + OFF_TF_TSTATE; #endif cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + OFF_TF_TPC; cache->saved_regs[SPARC64_NPC_REGNUM].addr = trapframe_addr + OFF_TF_TNPC; for (regnum = SPARC_O0_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) cache->saved_regs[regnum].addr = trapframe_addr + OFF_TF_OUT + (regnum - SPARC_O0_REGNUM) * 8; for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) cache->saved_regs[regnum].addr = sp + BIAS + (regnum - SPARC_L0_REGNUM) * 8; return cache; }
static struct m88k_frame_cache * m88k_frame_cache (struct frame_info *this_frame, void **this_cache) { struct gdbarch *gdbarch = get_frame_arch (this_frame); struct m88k_frame_cache *cache; CORE_ADDR frame_sp; if (*this_cache) return *this_cache; cache = FRAME_OBSTACK_ZALLOC (struct m88k_frame_cache); cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); cache->fp_offset = -1; cache->pc = get_frame_func (this_frame); if (cache->pc != 0) m88k_analyze_prologue (gdbarch, cache->pc, get_frame_pc (this_frame), cache); /* Calculate the stack pointer used in the prologue. */ if (cache->fp_offset != -1) { CORE_ADDR fp; fp = get_frame_register_unsigned (this_frame, M88K_R30_REGNUM); frame_sp = fp - cache->fp_offset; } else { /* If we know where the return address is saved, we can take a solid guess at what the frame pointer should be. */ if (cache->saved_regs[M88K_R1_REGNUM].addr != -1) cache->fp_offset = cache->saved_regs[M88K_R1_REGNUM].addr - 4; frame_sp = get_frame_register_unsigned (this_frame, M88K_R31_REGNUM); } /* Now that we know the stack pointer, adjust the location of the saved registers. */ { int regnum; for (regnum = M88K_R0_REGNUM; regnum < M88K_R31_REGNUM; regnum ++) if (cache->saved_regs[regnum].addr != -1) cache->saved_regs[regnum].addr += frame_sp; } /* Calculate the frame's base. */ cache->base = frame_sp - cache->sp_offset; trad_frame_set_value (cache->saved_regs, M88K_R31_REGNUM, cache->base); /* Identify SXIP with the return address in R1. */ cache->saved_regs[M88K_SXIP_REGNUM] = cache->saved_regs[M88K_R1_REGNUM]; *this_cache = cache; return cache; }
static CORE_ADDR ppc_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { unsigned int insnbuf[POWERPC32_PLT_STUB_LEN]; struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR target = 0; if (ppc_insns_match_pattern (frame, pc, powerpc32_plt_stub, insnbuf)) { /* Insn pattern is lis r11, xxxx lwz r11, xxxx(r11) Branch target is in r11. */ target = (ppc_insn_d_field (insnbuf[0]) << 16) | ppc_insn_d_field (insnbuf[1]); target = read_memory_unsigned_integer (target, 4, byte_order); } if (ppc_insns_match_pattern (frame, pc, powerpc32_plt_stub_so, insnbuf)) { /* Insn pattern is lwz r11, xxxx(r30) Branch target is in r11. */ target = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 30) + ppc_insn_d_field (insnbuf[0]); target = read_memory_unsigned_integer (target, 4, byte_order); } return target; }
static struct trad_frame_cache * vaxobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) { struct trad_frame_cache *cache; CORE_ADDR addr, base, func; if (*this_cache) return *this_cache; cache = trad_frame_cache_zalloc (this_frame); *this_cache = cache; func = get_frame_pc (this_frame); func &= ~(vaxobsd_page_size - 1); base = get_frame_register_unsigned (this_frame, VAX_SP_REGNUM); addr = get_frame_memory_unsigned (this_frame, base - 4, 4); trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8); trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12); trad_frame_set_reg_addr (cache, VAX_AP_REGNUM, addr + 16); trad_frame_set_reg_addr (cache, VAX_PC_REGNUM, addr + 20); trad_frame_set_reg_addr (cache, VAX_PS_REGNUM, addr + 24); /* Construct the frame ID using the function start. */ trad_frame_set_id (cache, frame_id_build (base, func)); return cache; }
static struct moxie_frame_cache * moxie_frame_cache (struct frame_info *this_frame, void **this_cache) { struct moxie_frame_cache *cache; CORE_ADDR current_pc; int i; if (*this_cache) return *this_cache; cache = moxie_alloc_frame_cache (); *this_cache = cache; cache->base = get_frame_register_unsigned (this_frame, MOXIE_FP_REGNUM); if (cache->base == 0) return cache; cache->pc = get_frame_func (this_frame); current_pc = get_frame_pc (this_frame); if (cache->pc) moxie_analyze_prologue (cache->pc, current_pc, cache, this_frame); cache->saved_sp = cache->base - cache->framesize; for (i = 0; i < MOXIE_NUM_REGS; ++i) if (cache->saved_regs[i] != REG_UNAVAIL) cache->saved_regs[i] = cache->base - cache->saved_regs[i]; return cache; }
static void aarch64_linux_sigframe_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { struct gdbarch *gdbarch = get_frame_arch (this_frame); CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM); CORE_ADDR sigcontext_addr = sp + AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET + AARCH64_UCONTEXT_SIGCONTEXT_OFFSET; int i; for (i = 0; i < 31; i++) { trad_frame_set_reg_addr (this_cache, AARCH64_X0_REGNUM + i, sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET + i * AARCH64_SIGCONTEXT_REG_SIZE); } trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM, sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET + 31 * AARCH64_SIGCONTEXT_REG_SIZE); trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET + 32 * AARCH64_SIGCONTEXT_REG_SIZE); trad_frame_set_id (this_cache, frame_id_build (sp, func)); }
static void hppanbsd_sigtramp_cache_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); CORE_ADDR sp = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM); CORE_ADDR base; int *reg_offset; int num_regs; int i; reg_offset = hppanbsd_mc_reg_offset; num_regs = ARRAY_SIZE (hppanbsd_mc_reg_offset); /* frame pointer */ base = sp - 0x280; /* offsetof(struct sigframe_siginfo, sf_uc) = 128 */ base += 128; /* offsetof(ucontext_t, uc_mcontext) == 40 */ base += 40; for (i = 0; i < num_regs; i++) if (reg_offset[i] != -1) trad_frame_set_reg_addr (this_cache, i, base + reg_offset[i]); /* Construct the frame ID using the function start. */ trad_frame_set_id (this_cache, frame_id_build (sp, func)); }
static void sh_linux_sigtramp_cache (struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func, int regs_offset) { int i; struct gdbarch *gdbarch = get_frame_arch (this_frame); CORE_ADDR base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch)); CORE_ADDR regs = base + regs_offset; for (i = 0; i < 18; i++) trad_frame_set_reg_addr (this_cache, i, regs + i * 4); trad_frame_set_reg_addr (this_cache, SR_REGNUM, regs + 18 * 4); trad_frame_set_reg_addr (this_cache, GBR_REGNUM, regs + 19 * 4); trad_frame_set_reg_addr (this_cache, MACH_REGNUM, regs + 20 * 4); trad_frame_set_reg_addr (this_cache, MACL_REGNUM, regs + 21 * 4); /* Restore FP state if we have an FPU. */ if (gdbarch_fp0_regnum (gdbarch) != -1) { CORE_ADDR fpregs = regs + 22 * 4; for (i = FR0_REGNUM; i <= FP_LAST_REGNUM; i++) trad_frame_set_reg_addr (this_cache, i, fpregs + i * 4); trad_frame_set_reg_addr (this_cache, FPSCR_REGNUM, fpregs + 32 * 4); trad_frame_set_reg_addr (this_cache, FPUL_REGNUM, fpregs + 33 * 4); } /* Save a frame ID. */ trad_frame_set_id (this_cache, frame_id_build (base, func)); }
static struct tilegx_frame_cache * tilegx_frame_cache (struct frame_info *this_frame, void **this_cache) { struct gdbarch *gdbarch = get_frame_arch (this_frame); struct tilegx_frame_cache *cache; CORE_ADDR current_pc; if (*this_cache) return (struct tilegx_frame_cache *) *this_cache; cache = FRAME_OBSTACK_ZALLOC (struct tilegx_frame_cache); *this_cache = cache; cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); cache->base = 0; cache->start_pc = get_frame_func (this_frame); current_pc = get_frame_pc (this_frame); cache->base = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM); trad_frame_set_value (cache->saved_regs, TILEGX_SP_REGNUM, cache->base); if (cache->start_pc) tilegx_analyze_prologue (gdbarch, cache->start_pc, current_pc, cache, this_frame); cache->saved_regs[TILEGX_PC_REGNUM] = cache->saved_regs[TILEGX_LR_REGNUM]; return cache; }
static int i386nbsd_trapframe_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache) { ULONGEST cs; const char *name; /* Check Current Privilege Level and bail out if we're not executing in kernel space. */ cs = get_frame_register_unsigned (this_frame, I386_CS_REGNUM); if ((cs & I386_SEL_RPL) == I386_SEL_UPL) return 0; find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL); return (name && ((strcmp (name, "alltraps") == 0) || (strcmp (name, "calltrap") == 0) || (strncmp (name, "Xtrap", 5) == 0) || (strcmp (name, "syscall1") == 0) || (strcmp (name, "Xsyscall") == 0) || (strncmp (name, "Xintr", 5) == 0) || (strncmp (name, "Xresume", 7) == 0) || (strncmp (name, "Xstray", 6) == 0) || (strncmp (name, "Xrecurse", 8) == 0) || (strncmp (name, "Xsoft", 5) == 0) || (strncmp (name, "Xdoreti", 5) == 0))); }
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 struct sparc_frame_cache * sparc32nbsd_sigcontext_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR addr; if (*this_cache) return *this_cache; cache = sparc_frame_cache (this_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. */ sparc_record_save_insn (cache); addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM); cache->base = addr; } cache->saved_regs = sparc32nbsd_sigcontext_saved_regs (this_frame); return cache; }
static void alphanbsd_sigtramp_cache_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); CORE_ADDR addr, sp; int i; sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM); if (self == &alphanbsd_sigtramp_sc1) { addr = sp; } else { addr = sp + 128 + 56; } for (i = 0; i < 32; i++, addr += ALPHA_REGISTER_SIZE) { trad_frame_set_reg_addr (this_cache, i, addr); } trad_frame_set_reg_addr (this_cache, ALPHA_PC_REGNUM, addr); /* Construct the frame ID using the function start. */ trad_frame_set_id (this_cache, frame_id_build (sp, func)); }
static struct frame_id lm32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { CORE_ADDR sp = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM); return frame_id_build (sp, get_frame_pc (this_frame)); }
static struct sparc_frame_cache * sparc64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR sp, trapframe_addr; int regnum; if (*this_cache) return (struct sparc_frame_cache *) *this_cache; cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); sp = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM); trapframe_addr = sp + BIAS + 176; cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr; cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + 8; cache->saved_regs[SPARC64_NPC_REGNUM].addr = trapframe_addr + 16; for (regnum = SPARC_G0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) cache->saved_regs[regnum].addr = trapframe_addr + 48 + (regnum - SPARC_G0_REGNUM) * 8; return cache; }
static struct sparc_frame_cache * sparc64obsd_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR addr; if (*this_cache) return (struct sparc_frame_cache *) *this_cache; cache = sparc_frame_cache (this_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 = get_frame_pc (this_frame); cache->pc &= ~(sparc64obsd_page_size - 1); /* Since we couldn't find the frame's function, the cache was initialized under the assumption that we're frameless. */ sparc_record_save_insn (cache); addr = get_frame_register_unsigned (this_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 + 128 + 16; cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame); return cache; }
static void csky_linux_rt_sigreturn_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { int i; CORE_ADDR sp = get_frame_register_unsigned (this_frame, 14); CORE_ADDR base = sp + CSKY_SIGINFO_OFFSET + CSKY_SIGINFO_SIZE + CSKY_UCONTEXT_SIGCONTEXT + CSKY_SIGCONTEXT_SC_USP + CSKY_SIGCONTEXT_SC_A0; /* Set addrs of R0 ~ R13. */ for (i = 0; i < 14; i++) trad_frame_set_reg_addr (this_cache, i, base + i * 4); /* Set addrs of SP(R14) and R15. */ trad_frame_set_reg_addr (this_cache, 14, base - 4); trad_frame_set_reg_addr (this_cache, 15, base + 4 * 14); /* Set addrs of R16 ~ R31. */ for (i = 15; i < 31; i++) trad_frame_set_reg_addr (this_cache, i, base + i * 4); /* Set addrs of PSR and PC. */ trad_frame_set_reg_addr (this_cache, 89, base + 4 * 33); trad_frame_set_reg_addr (this_cache, 72, base + 4 * 34); trad_frame_set_id (this_cache, frame_id_build (sp, func)); }
CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame, unsigned long insn) { if ((X_I (insn) == 0 && X_RS1 (insn) == 0 && X_RS2 (insn) == 0) || (X_I (insn) == 1 && X_RS1 (insn) == 0 && (insn & 0x7f) == 0)) { /* "New" system call. */ ULONGEST number = get_frame_register_unsigned (frame, SPARC_G1_REGNUM); if (number & 0x400) return get_frame_register_unsigned (frame, SPARC_G2_REGNUM); if (number & 0x800) return get_frame_register_unsigned (frame, SPARC_G7_REGNUM); } return 0; }
static struct frame_id m88k_dummy_id (struct gdbarch *arch, struct frame_info *this_frame) { CORE_ADDR sp; sp = get_frame_register_unsigned (this_frame, M88K_R31_REGNUM); return frame_id_build (sp, get_frame_pc (this_frame)); }
static struct frame_id vax_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { CORE_ADDR fp; fp = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM); return frame_id_build (fp, get_frame_pc (this_frame)); }
static struct frame_id tilegx_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { CORE_ADDR sp; sp = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM); return frame_id_build (sp, get_frame_pc (this_frame)); }
static void sparc64_linux_sigframe_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { CORE_ADDR base, addr, sp_addr; int regnum; base = get_frame_register_unsigned (this_frame, SPARC_O1_REGNUM); base += 128; /* Offsets from <bits/sigcontext.h>. */ /* Since %g0 is always zero, keep the identity encoding. */ addr = base + 8; sp_addr = base + ((SPARC_SP_REGNUM - SPARC_G0_REGNUM) * 8); for (regnum = SPARC_G1_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); addr += 8; } trad_frame_set_reg_addr (this_cache, SPARC64_STATE_REGNUM, addr + 0); trad_frame_set_reg_addr (this_cache, SPARC64_PC_REGNUM, addr + 8); trad_frame_set_reg_addr (this_cache, SPARC64_NPC_REGNUM, addr + 16); trad_frame_set_reg_addr (this_cache, SPARC64_Y_REGNUM, addr + 24); trad_frame_set_reg_addr (this_cache, SPARC64_FPRS_REGNUM, addr + 28); base = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM); if (base & 1) base += BIAS; addr = get_frame_memory_unsigned (this_frame, sp_addr, 8); if (addr & 1) addr += BIAS; for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); addr += 8; } trad_frame_set_id (this_cache, frame_id_build (base, func)); }
/* Get the ith function argument for the current function. */ CORE_ADDR arm_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { CORE_ADDR addr; addr = get_frame_register_unsigned (frame, argi); return addr; }
static CORE_ADDR i386_sol2_mcontext_addr (struct frame_info *this_frame) { CORE_ADDR sp, ucontext_addr; sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM); ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 4); return ucontext_addr + 36; }
static CORE_ADDR amd64_sol2_mcontext_addr (struct frame_info *this_frame) { CORE_ADDR sp, ucontext_addr; sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM); ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 8); return ucontext_addr + 72; }
static struct trad_frame_cache * aix_sighandle_frame_cache (struct frame_info *this_frame, void **this_cache) { LONGEST backchain; CORE_ADDR base, base_orig, func; struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); struct trad_frame_cache *this_trad_cache; if ((*this_cache) != NULL) return (struct trad_frame_cache *) (*this_cache); this_trad_cache = trad_frame_cache_zalloc (this_frame); (*this_cache) = this_trad_cache; base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch)); base_orig = base; if (tdep->wordsize == 4) { func = read_memory_unsigned_integer (base_orig + SIG_FRAME_PC_OFFSET + 8, tdep->wordsize, byte_order); safe_read_memory_integer (base_orig + SIG_FRAME_FP_OFFSET + 8, tdep->wordsize, byte_order, &backchain); base = (CORE_ADDR)backchain; } else { func = read_memory_unsigned_integer (base_orig + SIG_FRAME_LR_OFFSET64, tdep->wordsize, byte_order); safe_read_memory_integer (base_orig + SIG_FRAME_FP_OFFSET64, tdep->wordsize, byte_order, &backchain); base = (CORE_ADDR)backchain; } trad_frame_set_reg_value (this_trad_cache, gdbarch_pc_regnum (gdbarch), func); trad_frame_set_reg_value (this_trad_cache, gdbarch_sp_regnum (gdbarch), base); if (tdep->wordsize == 4) trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum, base_orig + 0x38 + 52 + 8); else trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum, base_orig + 0x70 + 320); trad_frame_set_id (this_trad_cache, frame_id_build (base, func)); trad_frame_set_this_base (this_trad_cache, base); return this_trad_cache; }
static void tic6x_linux_rt_sigreturn_init (const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func) { struct gdbarch *gdbarch = get_frame_arch (this_frame); CORE_ADDR sp = get_frame_register_unsigned (this_frame, TIC6X_SP_REGNUM); /* The base of struct sigcontext is computed by examining the definition of struct rt_sigframe in linux kernel source arch/c6x/kernel/signal.c. */ CORE_ADDR base = (sp + TIC6X_SP_RT_SIGFRAME /* Pointer type *pinfo and *puc in struct rt_sigframe. */ + 4 + 4 + TIC6X_SIGINFO_SIZE + 4 + 4 /* uc_flags and *uc_link in struct ucontext. */ + TIC6X_STACK_T_SIZE); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); unsigned int reg_offset; unsigned int i; for (i = 0; i < 10; i++) /* A0 - A9 */ { reg_offset = tic6x_register_sigcontext_offset (i, gdbarch); gdb_assert (reg_offset != 0); trad_frame_set_reg_addr (this_cache, i, base + reg_offset); } for (i = TIC6X_B0_REGNUM; i < TIC6X_B0_REGNUM + 10; i++) /* B0 - B9 */ { reg_offset = tic6x_register_sigcontext_offset (i, gdbarch); gdb_assert (reg_offset != 0); trad_frame_set_reg_addr (this_cache, i, base + reg_offset); } if (tdep->has_gp) for (i = 34; i < 34 + 32; i++) /* A16 - A31, B16 - B31 */ { reg_offset = tic6x_register_sigcontext_offset (i, gdbarch); gdb_assert (reg_offset != 0); trad_frame_set_reg_addr (this_cache, i, base + reg_offset); } trad_frame_set_reg_addr (this_cache, TIC6X_PC_REGNUM, base + tic6x_register_sigcontext_offset (TIC6X_PC_REGNUM, gdbarch)); trad_frame_set_reg_addr (this_cache, TIC6X_SP_REGNUM, base + tic6x_register_sigcontext_offset (TIC6X_SP_REGNUM, gdbarch)); /* Save a frame ID. */ trad_frame_set_id (this_cache, frame_id_build (sp, func)); }