From 28c5b1a3fada9298d14d2137df64f7035c1282a2 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 28 Jun 2008 17:29:04 +0000 Subject: * alphafbsd-tdep.c: Update for unwinder changes. * alpha-linux-tdep.c: Likewise. * alphanbsd-tdep.c: Likewise. * alphaobsd-tdep.c: Likewise. * avr-tdep.c: Likewise. * cris-tdep.c: Likewise. * frv-linux-tdep.c: Likewise. * frv-tdep.c: Likewise. * h8300-tdep.c: Likewise. * hppa-linux-tdep.c: Likewise. * iq2000-tdep.c: Likewise. * m32c-tdep.c: Likewise. * m32r-linux-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m68hc11-tdep.c: Likewise. * mep-tdep.c: Likewise. * mn10300-tdep.c: Likewise. * mt-tdep.c: Likewise. * score-tdep.c: Likewise. * sh64-tdep.c: Likewise. * sh-tdep.c: Likewise. * sparc64fbsd-tdep.c: Likewise. * sparc64nbsd-tdep.c: Likewise. * sparc64obsd-tdep.c: Likewise. * v850-tdep.c: Likewise. * vaxobsd-tdep.c: Likewise. * vax-tdep.c: Likewise. * xstormy16-tdep.c: Likewise. --- gdb/mep-tdep.c | 123 +++++++++++++++++++++++++-------------------------------- 1 file changed, 53 insertions(+), 70 deletions(-) (limited to 'gdb/mep-tdep.c') diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 60792365437..83a41c7ac0e 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1926,7 +1926,7 @@ mep_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR * pcptr, int *lenptr) static struct mep_prologue * -mep_analyze_frame_prologue (struct frame_info *next_frame, +mep_analyze_frame_prologue (struct frame_info *this_frame, void **this_prologue_cache) { if (! *this_prologue_cache) @@ -1936,8 +1936,8 @@ mep_analyze_frame_prologue (struct frame_info *next_frame, *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct mep_prologue); - func_start = frame_func_unwind (next_frame, NORMAL_FRAME); - stop_addr = frame_pc_unwind (next_frame); + func_start = get_frame_func (this_frame); + stop_addr = get_frame_pc (this_frame); /* If we couldn't find any function containing the PC, then just initialize the prologue cache, but don't do anything. */ @@ -1954,11 +1954,11 @@ mep_analyze_frame_prologue (struct frame_info *next_frame, /* Given the next frame and a prologue cache, return this frame's base. */ static CORE_ADDR -mep_frame_base (struct frame_info *next_frame, +mep_frame_base (struct frame_info *this_frame, void **this_prologue_cache) { struct mep_prologue *p - = mep_analyze_frame_prologue (next_frame, this_prologue_cache); + = mep_analyze_frame_prologue (this_frame, this_prologue_cache); /* In functions that use alloca, the distance between the stack pointer and the frame base varies dynamically, so we can't use @@ -1969,37 +1969,34 @@ mep_frame_base (struct frame_info *next_frame, if (p->has_frame_ptr) { CORE_ADDR fp - = frame_unwind_register_unsigned (next_frame, MEP_FP_REGNUM); + = get_frame_register_unsigned (this_frame, MEP_FP_REGNUM); return fp - p->frame_ptr_offset; } else { CORE_ADDR sp - = frame_unwind_register_unsigned (next_frame, MEP_SP_REGNUM); + = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM); return sp - p->frame_size; } } static void -mep_frame_this_id (struct frame_info *next_frame, +mep_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { - *this_id = frame_id_build (mep_frame_base (next_frame, this_prologue_cache), - frame_func_unwind (next_frame, NORMAL_FRAME)); + *this_id = frame_id_build (mep_frame_base (this_frame, this_prologue_cache), + get_frame_func (this_frame)); } -static void -mep_frame_prev_register (struct frame_info *next_frame, - void **this_prologue_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *bufferp) +static struct value * +mep_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { struct mep_prologue *p - = mep_analyze_frame_prologue (next_frame, this_prologue_cache); + = mep_analyze_frame_prologue (this_frame, this_prologue_cache); /* There are a number of complications in unwinding registers on the MeP, having to do with core functions calling VLIW functions and @@ -2021,68 +2018,59 @@ mep_frame_prev_register (struct frame_info *next_frame, do this. */ if (regnum == MEP_PC_REGNUM) { - mep_frame_prev_register (next_frame, this_prologue_cache, MEP_LP_REGNUM, - optimizedp, lvalp, addrp, realnump, bufferp); - store_unsigned_integer (bufferp, MEP_LP_SIZE, - (extract_unsigned_integer (bufferp, MEP_LP_SIZE) - & ~1)); - *lvalp = not_lval; + struct value *value; + CORE_ADDR lp; + value = mep_frame_prev_register (this_frame, this_prologue_cache, + MEP_LP_REGNUM); + lp = value_as_long (value); + release_value (value); + value_free (value); + + return frame_unwind_got_constant (this_frame, regnum, lp & ~1); } else { - CORE_ADDR frame_base = mep_frame_base (next_frame, this_prologue_cache); - int reg_size = register_size (get_frame_arch (next_frame), regnum); + CORE_ADDR frame_base = mep_frame_base (this_frame, this_prologue_cache); + struct value *value; /* Our caller's SP is our frame base. */ if (regnum == MEP_SP_REGNUM) - { - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (bufferp) - store_unsigned_integer (bufferp, reg_size, frame_base); - } + return frame_unwind_got_constant (this_frame, regnum, frame_base); /* If prologue analysis says we saved this register somewhere, return a description of the stack slot holding it. */ - else if (p->reg_offset[regnum] != 1) - { - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = frame_base + p->reg_offset[regnum]; - *realnump = -1; - if (bufferp) - get_frame_memory (next_frame, *addrp, bufferp, reg_size); - } + if (p->reg_offset[regnum] != 1) + value = frame_unwind_got_memory (this_frame, regnum, + frame_base + p->reg_offset[regnum]); /* Otherwise, presume we haven't changed the value of this register, and get it from the next frame. */ else - frame_register_unwind (next_frame, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + value = frame_unwind_got_register (this_frame, regnum, regnum); /* If we need to toggle the operating mode, do so. */ if (regnum == MEP_PSW_REGNUM) { - int lp_optimized; - enum lval_type lp_lval; - CORE_ADDR lp_addr; - int lp_realnum; - char lp_buffer[MEP_LP_SIZE]; + CORE_ADDR psw, lp; + + psw = value_as_long (value); + release_value (value); + value_free (value); /* Get the LP's value, too. */ - frame_register_unwind (next_frame, MEP_LP_REGNUM, - &lp_optimized, &lp_lval, &lp_addr, - &lp_realnum, lp_buffer); + value = get_frame_register_value (this_frame, MEP_LP_REGNUM); + lp = value_as_long (value); + release_value (value); + value_free (value); /* If LP.LTOM is set, then toggle PSW.OM. */ - if (extract_unsigned_integer (lp_buffer, MEP_LP_SIZE) & 0x1) - store_unsigned_integer - (bufferp, MEP_PSW_SIZE, - (extract_unsigned_integer (bufferp, MEP_PSW_SIZE) ^ 0x1000)); - *lvalp = not_lval; + if (lp & 0x1) + psw ^= 0x1000; + + return frame_unwind_got_constant (this_frame, regnum, psw); } + + return value; } } @@ -2090,17 +2078,12 @@ mep_frame_prev_register (struct frame_info *next_frame, static const struct frame_unwind mep_frame_unwind = { NORMAL_FRAME, mep_frame_this_id, - mep_frame_prev_register + mep_frame_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -mep_frame_sniffer (struct frame_info *next_frame) -{ - return &mep_frame_unwind; -} - - /* Our general unwinding function can handle unwinding the PC. */ static CORE_ADDR mep_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) @@ -2379,10 +2362,10 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function, static struct frame_id -mep_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +mep_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (mep_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM); + return frame_id_build (sp, get_frame_pc (this_frame)); } @@ -2500,7 +2483,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, mep_skip_prologue); /* Frames and frame unwinding. */ - frame_unwind_append_sniffer (gdbarch, mep_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind); set_gdbarch_unwind_pc (gdbarch, mep_unwind_pc); set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); @@ -2512,7 +2495,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Inferior function calls. */ set_gdbarch_frame_align (gdbarch, mep_frame_align); set_gdbarch_push_dummy_call (gdbarch, mep_push_dummy_call); - set_gdbarch_unwind_dummy_id (gdbarch, mep_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, mep_dummy_id); return gdbarch; } -- cgit v1.2.1