struct m88k_frame_cache * m88k_frame_cache (struct frame_info *next_frame, void **this_cache) { 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 (next_frame); cache->fp_offset = -1; cache->pc = frame_func_unwind (next_frame); if (cache->pc != 0) { CORE_ADDR addr_in_block = frame_unwind_address_in_block (next_frame); m88k_analyze_prologue (cache->pc, addr_in_block, cache); } /* Calculate the stack pointer used in the prologue. */ if (cache->fp_offset != -1) { CORE_ADDR fp; fp = frame_unwind_register_unsigned (next_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 = frame_unwind_register_unsigned (next_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 m88k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) { struct symtab_and_line sal; CORE_ADDR func_start, func_end; /* This is the preferred method, find the end of the prologue by using the debugging information. */ if (find_pc_partial_function (pc, NULL, &func_start, &func_end)) { sal = find_pc_line (func_start, 0); if (sal.end < func_end && pc <= sal.end) return sal.end; } return m88k_analyze_prologue (pc, pc + m88k_max_prologue_size, NULL); }