diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2008-06-28 17:29:04 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2008-06-28 17:29:04 +0000 |
commit | 94afd7a6d348a66ea3fb35fdb8234b050ec8c779 (patch) | |
tree | dbf3f5264799c070696da08515f2d6260ce9df42 /gdb | |
parent | e111d6c9206464acdff70102b29d82b4b48d1fc1 (diff) | |
download | gdb-94afd7a6d348a66ea3fb35fdb8234b050ec8c779.zip gdb-94afd7a6d348a66ea3fb35fdb8234b050ec8c779.tar.gz gdb-94afd7a6d348a66ea3fb35fdb8234b050ec8c779.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 31 | ||||
-rw-r--r-- | gdb/alpha-linux-tdep.c | 6 | ||||
-rw-r--r-- | gdb/alphafbsd-tdep.c | 8 | ||||
-rw-r--r-- | gdb/alphanbsd-tdep.c | 4 | ||||
-rw-r--r-- | gdb/alphaobsd-tdep.c | 12 | ||||
-rw-r--r-- | gdb/avr-tdep.c | 141 | ||||
-rw-r--r-- | gdb/cris-tdep.c | 193 | ||||
-rw-r--r-- | gdb/frv-linux-tdep.c | 65 | ||||
-rw-r--r-- | gdb/frv-tdep.c | 72 | ||||
-rw-r--r-- | gdb/h8300-tdep.c | 82 | ||||
-rw-r--r-- | gdb/hppa-linux-tdep.c | 59 | ||||
-rw-r--r-- | gdb/iq2000-tdep.c | 80 | ||||
-rw-r--r-- | gdb/m32c-tdep.c | 97 | ||||
-rw-r--r-- | gdb/m32r-linux-tdep.c | 85 | ||||
-rw-r--r-- | gdb/m32r-tdep.c | 71 | ||||
-rw-r--r-- | gdb/m68hc11-tdep.c | 107 | ||||
-rw-r--r-- | gdb/mep-tdep.c | 123 | ||||
-rw-r--r-- | gdb/mn10300-tdep.c | 62 | ||||
-rw-r--r-- | gdb/mt-tdep.c | 73 | ||||
-rw-r--r-- | gdb/score-tdep.c | 68 | ||||
-rw-r--r-- | gdb/sh-tdep.c | 94 | ||||
-rw-r--r-- | gdb/sh64-tdep.c | 103 | ||||
-rw-r--r-- | gdb/sparc64fbsd-tdep.c | 61 | ||||
-rw-r--r-- | gdb/sparc64nbsd-tdep.c | 65 | ||||
-rw-r--r-- | gdb/sparc64obsd-tdep.c | 118 | ||||
-rw-r--r-- | gdb/v850-tdep.c | 62 | ||||
-rw-r--r-- | gdb/vax-tdep.c | 58 | ||||
-rw-r--r-- | gdb/vaxobsd-tdep.c | 51 | ||||
-rw-r--r-- | gdb/xstormy16-tdep.c | 91 |
29 files changed, 934 insertions, 1208 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3aa4733..6fa8497 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,34 @@ +2008-06-28 Ulrich Weigand <uweigand@de.ibm.com> + + * 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. + 2008-06-28 Vladimir Prus <vladimir@codesourcery.com> * mi/mi-main.c (enum captured_mi_execute_command_actions) diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c index 3749a2c..507db07 100644 --- a/gdb/alpha-linux-tdep.c +++ b/gdb/alpha-linux-tdep.c @@ -98,14 +98,14 @@ alpha_linux_pc_in_sigtramp (CORE_ADDR pc, char *func_name) } static CORE_ADDR -alpha_linux_sigcontext_addr (struct frame_info *next_frame) +alpha_linux_sigcontext_addr (struct frame_info *this_frame) { CORE_ADDR pc; ULONGEST sp; long off; - pc = frame_pc_unwind (next_frame); - sp = frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM); + pc = get_frame_pc (this_frame); + sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM); off = alpha_linux_sigtramp_offset (pc); gdb_assert (off >= 0); diff --git a/gdb/alphafbsd-tdep.c b/gdb/alphafbsd-tdep.c index 54df027..349d0a9 100644 --- a/gdb/alphafbsd-tdep.c +++ b/gdb/alphafbsd-tdep.c @@ -76,13 +76,13 @@ alphafbsd_sigtramp_offset (CORE_ADDR pc) return pc - alphafbsd_sigtramp_start; } -/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp - routine, return the address of the associated sigcontext structure. */ +/* Assuming THIS_FRAME is the frame of a BSD sigtramp routine, + return the address of the associated sigcontext structure. */ static CORE_ADDR -alphafbsd_sigcontext_addr (struct frame_info *next_frame) +alphafbsd_sigcontext_addr (struct frame_info *this_frame) { - return frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM) + 24; + return get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM) + 24; } /* FreeBSD 5.0-RELEASE or later. */ diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c index c85753b..b5e161a 100644 --- a/gdb/alphanbsd-tdep.c +++ b/gdb/alphanbsd-tdep.c @@ -253,7 +253,9 @@ alphanbsd_sigcontext_addr (struct frame_info *frame) /* FIXME: This is not correct for all versions of NetBSD/alpha. We will probably need to disassemble the trampoline to figure out which trampoline frame type we have. */ - return get_frame_base (frame); + if (!get_next_frame (frame)) + return 0; + return get_frame_base (get_next_frame (frame)); } diff --git a/gdb/alphaobsd-tdep.c b/gdb/alphaobsd-tdep.c index 8a1da45..8c951d4 100644 --- a/gdb/alphaobsd-tdep.c +++ b/gdb/alphaobsd-tdep.c @@ -68,26 +68,26 @@ alphaobsd_pc_in_sigtramp (CORE_ADDR pc, char *name) } static CORE_ADDR -alphaobsd_sigcontext_addr (struct frame_info *next_frame) +alphaobsd_sigcontext_addr (struct frame_info *this_frame) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); if (alphaobsd_sigtramp_offset (pc) < 3 * ALPHA_INSN_SIZE) { /* On entry, a pointer the `struct sigcontext' is passed in %a2. */ - return frame_unwind_register_unsigned (next_frame, ALPHA_A0_REGNUM + 2); + return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM + 2); } else if (alphaobsd_sigtramp_offset (pc) < 4 * ALPHA_INSN_SIZE) { /* It is stored on the stack Before calling the signal handler. */ CORE_ADDR sp; - sp = frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM); - return get_frame_memory_unsigned (next_frame, sp, 8); + sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM); + return get_frame_memory_unsigned (this_frame, sp, 8); } else { /* It is reloaded into %a0 for the sigreturn(2) call. */ - return frame_unwind_register_unsigned (next_frame, ALPHA_A0_REGNUM); + return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM); } } diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index f2a69f4..85f3c0a 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -872,7 +872,7 @@ avr_return_value (struct gdbarch *gdbarch, struct type *func_type, for it IS the sp for the next frame. */ struct avr_unwind_cache * -avr_frame_unwind_cache (struct frame_info *next_frame, +avr_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { CORE_ADDR pc; @@ -886,14 +886,14 @@ avr_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache); (*this_prologue_cache) = info; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); info->size = 0; info->prologue_type = AVR_PROLOGUE_NONE; - pc = frame_func_unwind (next_frame, NORMAL_FRAME); + pc = get_frame_func (this_frame); - if ((pc > 0) && (pc < frame_pc_unwind (next_frame))) + if ((pc > 0) && (pc < get_frame_pc (this_frame))) avr_scan_prologue (pc, info); if ((info->prologue_type != AVR_PROLOGUE_NONE) @@ -904,8 +904,8 @@ avr_frame_unwind_cache (struct frame_info *next_frame, /* The SP was moved to the FP. This indicates that a new frame was created. Get THIS frame's FP value by unwinding it from the next frame. */ - this_base = frame_unwind_register_unsigned (next_frame, AVR_FP_REGNUM); - high_base = frame_unwind_register_unsigned (next_frame, AVR_FP_REGNUM+1); + this_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM); + high_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM+1); this_base += (high_base << 8); /* The FP points at the last saved register. Adjust the FP back @@ -916,7 +916,7 @@ avr_frame_unwind_cache (struct frame_info *next_frame, { /* Assume that the FP is this frame's SP but with that pushed stack space added back. */ - this_base = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM); + this_base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM); prev_sp = this_base + info->size; } @@ -928,7 +928,7 @@ avr_frame_unwind_cache (struct frame_info *next_frame, /* Adjust all the saved registers so that they contain addresses and not offsets. */ - for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)) - 1; i++) + for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++) if (info->saved_regs[i].addr) { info->saved_regs[i].addr = (info->prev_sp - info->saved_regs[i].addr); @@ -973,18 +973,18 @@ avr_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) frame. This will be used to create a new GDB frame struct. */ static void -avr_frame_this_id (struct frame_info *next_frame, +avr_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct avr_unwind_cache *info - = avr_frame_unwind_cache (next_frame, this_prologue_cache); + = avr_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; struct frame_id id; /* The FUNC is easy. */ - func = frame_func_unwind (next_frame, NORMAL_FRAME); + func = get_frame_func (this_frame); /* Hopefully the prologue analysis either correctly determined the frame's base (which is the SP from the previous frame), or set @@ -997,83 +997,69 @@ avr_frame_this_id (struct frame_info *next_frame, (*this_id) = id; } -static void -avr_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 * +avr_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { struct avr_unwind_cache *info - = avr_frame_unwind_cache (next_frame, this_prologue_cache); + = avr_frame_unwind_cache (this_frame, this_prologue_cache); if (regnum == AVR_PC_REGNUM) { if (trad_frame_addr_p (info->saved_regs, regnum)) { - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = info->saved_regs[regnum].addr; - *realnump = -1; - if (bufferp != NULL) - { - /* Reading the return PC from the PC register is slightly - abnormal. register_size(AVR_PC_REGNUM) says it is 4 bytes, - but in reality, only two bytes (3 in upcoming mega256) are - stored on the stack. - - Also, note that the value on the stack is an addr to a word - not a byte, so we will need to multiply it by two at some - point. - - And to confuse matters even more, the return address stored - on the stack is in big endian byte order, even though most - everything else about the avr is little endian. Ick! */ - - /* FIXME: number of bytes read here will need updated for the - mega256 when it is available. */ - - ULONGEST pc; - unsigned char tmp; - unsigned char buf[2]; - - read_memory (info->saved_regs[regnum].addr, buf, 2); - - /* Convert the PC read from memory as a big-endian to - little-endian order. */ - tmp = buf[0]; - buf[0] = buf[1]; - buf[1] = tmp; - - pc = (extract_unsigned_integer (buf, 2) * 2); - store_unsigned_integer - (bufferp, register_size (get_frame_arch (next_frame), regnum), - pc); - } + /* Reading the return PC from the PC register is slightly + abnormal. register_size(AVR_PC_REGNUM) says it is 4 bytes, + but in reality, only two bytes (3 in upcoming mega256) are + stored on the stack. + + Also, note that the value on the stack is an addr to a word + not a byte, so we will need to multiply it by two at some + point. + + And to confuse matters even more, the return address stored + on the stack is in big endian byte order, even though most + everything else about the avr is little endian. Ick! */ + + /* FIXME: number of bytes read here will need updated for the + mega256 when it is available. */ + + ULONGEST pc; + unsigned char tmp; + unsigned char buf[2]; + + read_memory (info->saved_regs[regnum].addr, buf, 2); + + /* Convert the PC read from memory as a big-endian to + little-endian order. */ + tmp = buf[0]; + buf[0] = buf[1]; + buf[1] = tmp; + + pc = (extract_unsigned_integer (buf, 2) * 2); + + return frame_unwind_got_constant (this_frame, regnum, pc); } + + return frame_unwind_got_optimized (this_frame, regnum); } - else - trad_frame_get_prev_register (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + + return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); } static const struct frame_unwind avr_frame_unwind = { NORMAL_FRAME, avr_frame_this_id, - avr_frame_prev_register + avr_frame_prev_register, + NULL, + default_frame_sniffer }; -const struct frame_unwind * -avr_frame_sniffer (struct frame_info *next_frame) -{ - return &avr_frame_unwind; -} - static CORE_ADDR -avr_frame_base_address (struct frame_info *next_frame, void **this_cache) +avr_frame_base_address (struct frame_info *this_frame, void **this_cache) { struct avr_unwind_cache *info - = avr_frame_unwind_cache (next_frame, this_cache); + = avr_frame_unwind_cache (this_frame, this_cache); return info->base; } @@ -1085,18 +1071,17 @@ static const struct frame_base avr_frame_base = { avr_frame_base_address }; -/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that - dummy frame. The frame ID's base needs to match the TOS value - saved by save_dummy_frame_tos(), and the PC match the dummy frame's - breakpoint. */ +/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy + frame. The frame ID's base needs to match the TOS value saved by + save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */ static struct frame_id -avr_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { ULONGEST base; - base = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM); - return frame_id_build (avr_make_saddr (base), frame_pc_unwind (next_frame)); + base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM); + return frame_id_build (avr_make_saddr (base), get_frame_pc (this_frame)); } /* When arguments must be pushed onto the stack, they go on in reverse @@ -1322,10 +1307,10 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc); - frame_unwind_append_sniffer (gdbarch, avr_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &avr_frame_unwind); frame_base_set_default (gdbarch, &avr_frame_base); - set_gdbarch_unwind_dummy_id (gdbarch, avr_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, avr_dummy_id); set_gdbarch_unwind_pc (gdbarch, avr_unwind_pc); set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 44f94dd..12ef149 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -215,12 +215,12 @@ static const unsigned short rt_sigtramp_code[] = the routine. Otherwise, return 0. */ static CORE_ADDR -cris_sigtramp_start (struct frame_info *next_frame) +cris_sigtramp_start (struct frame_info *this_frame) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); gdb_byte buf[SIGTRAMP_LEN]; - if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN)) + if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN)) return 0; if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0) @@ -229,7 +229,7 @@ cris_sigtramp_start (struct frame_info *next_frame) return 0; pc -= SIGTRAMP_OFFSET1; - if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN)) + if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN)) return 0; } @@ -243,12 +243,12 @@ cris_sigtramp_start (struct frame_info *next_frame) the routine. Otherwise, return 0. */ static CORE_ADDR -cris_rt_sigtramp_start (struct frame_info *next_frame) +cris_rt_sigtramp_start (struct frame_info *this_frame) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); gdb_byte buf[SIGTRAMP_LEN]; - if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN)) + if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN)) return 0; if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0) @@ -257,7 +257,7 @@ cris_rt_sigtramp_start (struct frame_info *next_frame) return 0; pc -= SIGTRAMP_OFFSET1; - if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN)) + if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN)) return 0; } @@ -267,22 +267,22 @@ cris_rt_sigtramp_start (struct frame_info *next_frame) return pc; } -/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp - routine, return the address of the associated sigcontext structure. */ +/* Assuming THIS_FRAME is a frame for a GNU/Linux sigtramp routine, + return the address of the associated sigcontext structure. */ static CORE_ADDR -cris_sigcontext_addr (struct frame_info *next_frame) +cris_sigcontext_addr (struct frame_info *this_frame) { CORE_ADDR pc; CORE_ADDR sp; char buf[4]; - frame_unwind_register (next_frame, - gdbarch_sp_regnum (get_frame_arch (next_frame)), buf); + get_frame_register (this_frame, + gdbarch_sp_regnum (get_frame_arch (this_frame)), buf); sp = extract_unsigned_integer (buf, 4); /* Look for normal sigtramp frame first. */ - pc = cris_sigtramp_start (next_frame); + pc = cris_sigtramp_start (this_frame); if (pc) { /* struct signal_frame (arch/cris/kernel/signal.c) contains @@ -291,7 +291,7 @@ cris_sigcontext_addr (struct frame_info *next_frame) return sp; } - pc = cris_rt_sigtramp_start (next_frame); + pc = cris_rt_sigtramp_start (this_frame); if (pc) { /* struct rt_signal_frame (arch/cris/kernel/signal.c) contains @@ -330,10 +330,10 @@ struct cris_unwind_cache }; static struct cris_unwind_cache * -cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame, +cris_sigtramp_frame_unwind_cache (struct frame_info *this_frame, void **this_cache) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct cris_unwind_cache *info; CORE_ADDR pc; @@ -347,7 +347,7 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache); (*this_cache) = info; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* Zero all fields. */ info->prev_sp = 0; @@ -359,10 +359,10 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame, info->return_pc = 0; info->leaf_function = 0; - frame_unwind_register (next_frame, gdbarch_sp_regnum (gdbarch), buf); + get_frame_register (this_frame, gdbarch_sp_regnum (gdbarch), buf); info->base = extract_unsigned_integer (buf, 4); - addr = cris_sigcontext_addr (next_frame); + addr = cris_sigcontext_addr (this_frame); /* Layout of the sigcontext struct: struct sigcontext { @@ -425,51 +425,48 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame, } static void -cris_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache, +cris_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct cris_unwind_cache *cache = - cris_sigtramp_frame_unwind_cache (next_frame, this_cache); - (*this_id) = frame_id_build (cache->base, frame_pc_unwind (next_frame)); + cris_sigtramp_frame_unwind_cache (this_frame, this_cache); + (*this_id) = frame_id_build (cache->base, get_frame_pc (this_frame)); } /* Forward declaration. */ -static void cris_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 void -cris_sigtramp_frame_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value *cris_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum); +static struct value * +cris_sigtramp_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { /* Make sure we've initialized the cache. */ - cris_sigtramp_frame_unwind_cache (next_frame, this_cache); - cris_frame_prev_register (next_frame, this_cache, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + cris_sigtramp_frame_unwind_cache (this_frame, this_cache); + return cris_frame_prev_register (this_frame, this_cache, regnum); +} + +static int +cris_sigtramp_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) +{ + if (cris_sigtramp_start (this_frame) + || cris_rt_sigtramp_start (this_frame)) + return 1; + + return 0; } static const struct frame_unwind cris_sigtramp_frame_unwind = { SIGTRAMP_FRAME, cris_sigtramp_frame_this_id, - cris_sigtramp_frame_prev_register + cris_sigtramp_frame_prev_register, + NULL, + cris_sigtramp_frame_sniffer }; -static const struct frame_unwind * -cris_sigtramp_frame_sniffer (struct frame_info *next_frame) -{ - if (cris_sigtramp_start (next_frame) - || cris_rt_sigtramp_start (next_frame)) - return &cris_sigtramp_frame_unwind; - - return NULL; -} - int crisv32_single_step_through_delay (struct gdbarch *gdbarch, struct frame_info *this_frame) @@ -717,11 +714,11 @@ static void set_cris_dwarf2_cfi (char *ignore_args, int from_tty, struct cmd_list_element *c); static CORE_ADDR cris_scan_prologue (CORE_ADDR pc, - struct frame_info *next_frame, + struct frame_info *this_frame, struct cris_unwind_cache *info); static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc, - struct frame_info *next_frame, + struct frame_info *this_frame, struct cris_unwind_cache *info); static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch, @@ -770,7 +767,7 @@ pop_stack_item (struct stack_item *si) for it IS the sp for the next frame. */ struct cris_unwind_cache * -cris_frame_unwind_cache (struct frame_info *next_frame, +cris_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { CORE_ADDR pc; @@ -782,7 +779,7 @@ cris_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache); (*this_prologue_cache) = info; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* Zero all fields. */ info->prev_sp = 0; @@ -796,11 +793,9 @@ cris_frame_unwind_cache (struct frame_info *next_frame, /* Prologue analysis does the rest... */ if (cris_version () == 32) - crisv32_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME), - next_frame, info); + crisv32_scan_prologue (get_frame_func (this_frame), this_frame, info); else - cris_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME), - next_frame, info); + cris_scan_prologue (get_frame_func (this_frame), this_frame, info); return info; } @@ -809,18 +804,18 @@ cris_frame_unwind_cache (struct frame_info *next_frame, frame. This will be used to create a new GDB frame struct. */ static void -cris_frame_this_id (struct frame_info *next_frame, +cris_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct cris_unwind_cache *info - = cris_frame_unwind_cache (next_frame, this_prologue_cache); + = cris_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; struct frame_id id; /* The FUNC is easy. */ - func = frame_func_unwind (next_frame, NORMAL_FRAME); + func = get_frame_func (this_frame); /* Hopefully the prologue analysis either correctly determined the frame's base (which is the SP from the previous frame), or set @@ -834,29 +829,25 @@ cris_frame_this_id (struct frame_info *next_frame, (*this_id) = id; } -static void -cris_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 * +cris_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { struct cris_unwind_cache *info - = cris_frame_unwind_cache (next_frame, this_prologue_cache); - trad_frame_get_prev_register (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + = cris_frame_unwind_cache (this_frame, this_prologue_cache); + return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); } -/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that - dummy frame. The frame ID's base needs to match the TOS value - saved by save_dummy_frame_tos(), and the PC match the dummy frame's - breakpoint. */ +/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy + frame. The frame ID's base needs to match the TOS value saved by + save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */ static struct frame_id -cris_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +cris_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (cris_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp; + sp = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch)); + return frame_id_build (sp, get_frame_pc (this_frame)); } static CORE_ADDR @@ -1011,20 +1002,16 @@ static const struct frame_unwind cris_frame_unwind = { NORMAL_FRAME, cris_frame_this_id, - cris_frame_prev_register + cris_frame_prev_register, + NULL, + default_frame_sniffer }; -const struct frame_unwind * -cris_frame_sniffer (struct frame_info *next_frame) -{ - return &cris_frame_unwind; -} - static CORE_ADDR -cris_frame_base_address (struct frame_info *next_frame, void **this_cache) +cris_frame_base_address (struct frame_info *this_frame, void **this_cache) { struct cris_unwind_cache *info - = cris_frame_unwind_cache (next_frame, this_cache); + = cris_frame_unwind_cache (this_frame, this_cache); return info->base; } @@ -1113,10 +1100,10 @@ static const struct frame_base cris_frame_base = determine that it is a prologue (1). */ static CORE_ADDR -cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, +cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame, struct cris_unwind_cache *info) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); /* Present instruction. */ unsigned short insn; @@ -1149,11 +1136,11 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, val = 0; regsave = -1; - /* If we were called without a next_frame, that means we were called + /* If we were called without a this_frame, that means we were called from cris_skip_prologue which already tried to find the end of the prologue through the symbol information. 64 instructions past current pc is arbitrarily chosen, but at least it means we'll stop eventually. */ - limit = next_frame ? frame_pc_unwind (next_frame) : pc + 64; + limit = this_frame ? get_frame_pc (this_frame) : pc + 64; /* Find the prologue instructions. */ while (pc > 0 && pc < limit) @@ -1322,9 +1309,9 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, } } - /* We only want to know the end of the prologue when next_frame and info + /* We only want to know the end of the prologue when this_frame and info are NULL (called from cris_skip_prologue i.e.). */ - if (next_frame == NULL && info == NULL) + if (this_frame == NULL && info == NULL) { return pc; } @@ -1339,7 +1326,7 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, /* The SP was moved to the FP. This indicates that a new frame was created. Get THIS frame's FP value by unwinding it from the next frame. */ - this_base = frame_unwind_register_unsigned (next_frame, CRIS_FP_REGNUM); + this_base = get_frame_register_unsigned (this_frame, CRIS_FP_REGNUM); info->base = this_base; info->saved_regs[CRIS_FP_REGNUM].addr = info->base; @@ -1352,8 +1339,8 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, ULONGEST this_base; /* Assume that the FP is this frame's SP but with that pushed stack space added back. */ - this_base = frame_unwind_register_unsigned (next_frame, - gdbarch_sp_regnum (gdbarch)); + this_base = get_frame_register_unsigned (this_frame, + gdbarch_sp_regnum (gdbarch)); info->base = this_base; info->prev_sp = info->base + info->size; } @@ -1398,10 +1385,10 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, } static CORE_ADDR -crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, +crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame, struct cris_unwind_cache *info) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); ULONGEST this_base; /* Unlike the CRISv10 prologue scanner (cris_scan_prologue), this is not @@ -1416,16 +1403,16 @@ crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame, the stack pointer is not adjusted, and (as a consequence) the return address is not pushed onto the stack. */ - /* We only want to know the end of the prologue when next_frame and info + /* We only want to know the end of the prologue when this_frame and info are NULL (called from cris_skip_prologue i.e.). */ - if (next_frame == NULL && info == NULL) + if (this_frame == NULL && info == NULL) { return pc; } /* The SP is assumed to be unaltered. */ - this_base = frame_unwind_register_unsigned (next_frame, - gdbarch_sp_regnum (gdbarch)); + this_base = get_frame_register_unsigned (this_frame, + gdbarch_sp_regnum (gdbarch)); info->base = this_base; info->prev_sp = this_base; @@ -4207,22 +4194,22 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc); set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp); - set_gdbarch_unwind_dummy_id (gdbarch, cris_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, cris_dummy_id); if (tdep->cris_dwarf2_cfi == 1) { /* Hook in the Dwarf-2 frame sniffer. */ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, cris_dwarf2_reg_to_regnum); dwarf2_frame_set_init_reg (gdbarch, cris_dwarf2_frame_init_reg); - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); + dwarf2_append_unwinders (gdbarch); } if (tdep->cris_mode != cris_mode_guru) { - frame_unwind_append_sniffer (gdbarch, cris_sigtramp_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &cris_sigtramp_frame_unwind); } - frame_unwind_append_sniffer (gdbarch, cris_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &cris_frame_unwind); frame_base_set_default (gdbarch, &cris_frame_base); set_solib_svr4_fetch_link_map_offsets diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c index d2a5977..015ac53 100644 --- a/gdb/frv-linux-tdep.c +++ b/gdb/frv-linux-tdep.c @@ -165,7 +165,7 @@ frv_linux_pc_in_sigtramp (CORE_ADDR pc, char *name) } __attribute__((aligned(8))); */ static LONGEST -frv_linux_sigcontext_reg_addr (struct frame_info *next_frame, int regno, +frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno, CORE_ADDR *sc_addr_cache_ptr) { CORE_ADDR sc_addr; @@ -180,10 +180,10 @@ frv_linux_sigcontext_reg_addr (struct frame_info *next_frame, int regno, char buf[4]; int tramp_type; - pc = frame_pc_unwind (next_frame); + pc = get_frame_pc (this_frame); tramp_type = frv_linux_pc_in_sigtramp (pc, 0); - frame_unwind_register (next_frame, sp_regnum, buf); + get_frame_register (this_frame, sp_regnum, buf); sp = extract_unsigned_integer (buf, sizeof buf); if (tramp_type == NORMAL_SIGTRAMP) @@ -253,10 +253,10 @@ frv_linux_sigcontext_reg_addr (struct frame_info *next_frame, int regno, /* Signal trampolines. */ static struct trad_frame_cache * -frv_linux_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) +frv_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) { struct trad_frame_cache *cache; - struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame)); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); CORE_ADDR addr; char buf[4]; int regnum; @@ -266,20 +266,20 @@ frv_linux_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache if (*this_cache) return *this_cache; - cache = trad_frame_cache_zalloc (next_frame); + cache = trad_frame_cache_zalloc (this_frame); /* FIXME: cagney/2004-05-01: This is is long standing broken code. The frame ID's code address should be the start-address of the signal trampoline and not the current PC within that trampoline. */ - frame_unwind_register (next_frame, sp_regnum, buf); + get_frame_register (this_frame, sp_regnum, buf); this_id = frame_id_build (extract_unsigned_integer (buf, sizeof buf), - frame_pc_unwind (next_frame)); + get_frame_pc (this_frame)); trad_frame_set_id (cache, this_id); for (regnum = 0; regnum < frv_num_regs; regnum++) { - LONGEST reg_addr = frv_linux_sigcontext_reg_addr (next_frame, regnum, + LONGEST reg_addr = frv_linux_sigcontext_reg_addr (this_frame, regnum, &sc_addr_cache_val); if (reg_addr != -1) trad_frame_set_reg_addr (cache, regnum, reg_addr); @@ -290,48 +290,47 @@ frv_linux_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache } static void -frv_linux_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache, +frv_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct trad_frame_cache *cache = - frv_linux_sigtramp_frame_cache (next_frame, this_cache); + frv_linux_sigtramp_frame_cache (this_frame, this_cache); trad_frame_get_id (cache, this_id); } -static void -frv_linux_sigtramp_frame_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +frv_linux_sigtramp_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { /* Make sure we've initialized the cache. */ struct trad_frame_cache *cache = - frv_linux_sigtramp_frame_cache (next_frame, this_cache); - trad_frame_get_register (cache, next_frame, regnum, optimizedp, lvalp, - addrp, realnump, valuep); + frv_linux_sigtramp_frame_cache (this_frame, this_cache); + return trad_frame_get_register (cache, this_frame, regnum); } -static const struct frame_unwind frv_linux_sigtramp_frame_unwind = -{ - SIGTRAMP_FRAME, - frv_linux_sigtramp_frame_this_id, - frv_linux_sigtramp_frame_prev_register -}; - -static const struct frame_unwind * -frv_linux_sigtramp_frame_sniffer (struct frame_info *next_frame) +static int +frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); char *name; find_pc_partial_function (pc, &name, NULL, NULL); if (frv_linux_pc_in_sigtramp (pc, name)) - return &frv_linux_sigtramp_frame_unwind; + return 1; - return NULL; + return 0; } +static const struct frame_unwind frv_linux_sigtramp_frame_unwind = +{ + SIGTRAMP_FRAME, + frv_linux_sigtramp_frame_this_id, + frv_linux_sigtramp_frame_prev_register, + NULL, + frv_linux_sigtramp_frame_sniffer +}; /* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include the loadmap addresses in the register set. (See below for more info.) */ @@ -485,7 +484,7 @@ static void frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { /* Set the sigtramp frame sniffer. */ - frame_unwind_append_sniffer (gdbarch, frv_linux_sigtramp_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind); set_gdbarch_regset_from_core_section (gdbarch, frv_linux_regset_from_core_section); } diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index a6bbf03..7c79420 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -510,7 +510,7 @@ is_argument_reg (int reg) arguments in any frame but the top, you'll need to do this serious prologue analysis. */ static CORE_ADDR -frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, +frv_analyze_prologue (CORE_ADDR pc, struct frame_info *this_frame, struct frv_unwind_cache *info) { /* When writing out instruction bitpatterns, we use the following @@ -579,9 +579,9 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, /* If we have a frame, we don't want to scan past the frame's pc. This will catch those cases where the pc is in the prologue. */ - if (next_frame) + if (this_frame) { - CORE_ADDR frame_pc = frame_pc_unwind (next_frame); + CORE_ADDR frame_pc = get_frame_pc (this_frame); if (frame_pc < lim_pc) lim_pc = frame_pc; } @@ -927,7 +927,7 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, pc = next_pc; } - if (next_frame && info) + if (this_frame && info) { int i; ULONGEST this_base; @@ -938,9 +938,9 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame, because instructions may save relative to the SP, but we need their addresses relative to the FP. */ if (fp_set) - this_base = frame_unwind_register_unsigned (next_frame, fp_regnum); + this_base = get_frame_register_unsigned (this_frame, fp_regnum); else - this_base = frame_unwind_register_unsigned (next_frame, sp_regnum); + this_base = get_frame_register_unsigned (this_frame, sp_regnum); for (i = 0; i < 64; i++) if (gr_saved[i]) @@ -1000,10 +1000,10 @@ frv_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) static struct frv_unwind_cache * -frv_frame_unwind_cache (struct frame_info *next_frame, +frv_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); CORE_ADDR pc; ULONGEST this_base; struct frv_unwind_cache *info; @@ -1013,11 +1013,10 @@ frv_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct frv_unwind_cache); (*this_prologue_cache) = info; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* Prologue analysis does the rest... */ - frv_analyze_prologue (frame_func_unwind (next_frame, NORMAL_FRAME), - next_frame, info); + frv_analyze_prologue (get_frame_func (this_frame), this_frame, info); return info; } @@ -1350,18 +1349,18 @@ frv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) frame. This will be used to create a new GDB frame struct. */ static void -frv_frame_this_id (struct frame_info *next_frame, +frv_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct frv_unwind_cache *info - = frv_frame_unwind_cache (next_frame, this_prologue_cache); + = frv_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; struct minimal_symbol *msym_stack; struct frame_id id; /* The FUNC is easy. */ - func = frame_func_unwind (next_frame, NORMAL_FRAME); + func = get_frame_func (this_frame); /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); @@ -1379,36 +1378,28 @@ frv_frame_this_id (struct frame_info *next_frame, (*this_id) = id; } -static void -frv_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 * +frv_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { struct frv_unwind_cache *info - = frv_frame_unwind_cache (next_frame, this_prologue_cache); - trad_frame_get_prev_register (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + = frv_frame_unwind_cache (this_frame, this_prologue_cache); + return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); } static const struct frame_unwind frv_frame_unwind = { NORMAL_FRAME, frv_frame_this_id, - frv_frame_prev_register + frv_frame_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -frv_frame_sniffer (struct frame_info *next_frame) -{ - return &frv_frame_unwind; -} - static CORE_ADDR -frv_frame_base_address (struct frame_info *next_frame, void **this_cache) +frv_frame_base_address (struct frame_info *this_frame, void **this_cache) { struct frv_unwind_cache *info - = frv_frame_unwind_cache (next_frame, this_cache); + = frv_frame_unwind_cache (this_frame, this_cache); return info->base; } @@ -1426,16 +1417,15 @@ frv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) } -/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that - dummy frame. The frame ID's base needs to match the TOS value - saved by save_dummy_frame_tos(), and the PC match the dummy frame's - breakpoint. */ +/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy + frame. The frame ID's base needs to match the TOS value saved by + save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */ static struct frame_id -frv_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +frv_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (frv_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, sp_regnum); + return frame_id_build (sp, get_frame_pc (this_frame)); } static struct gdbarch * @@ -1527,7 +1517,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Settings for calling functions in the inferior. */ set_gdbarch_push_dummy_call (gdbarch, frv_push_dummy_call); - set_gdbarch_unwind_dummy_id (gdbarch, frv_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, frv_dummy_id); /* Settings that should be unnecessary. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); @@ -1569,7 +1559,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) gdbarch_init_osabi (info, gdbarch); /* Set the fallback (prologue based) frame sniffer. */ - frame_unwind_append_sniffer (gdbarch, frv_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &frv_frame_unwind); /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 4b78d8d..1d52553 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -107,10 +107,10 @@ h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) } static struct frame_id -h8300_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +h8300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (h8300_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM); + return frame_id_build (sp, get_frame_pc (this_frame)); } /* Normal frames. */ @@ -420,9 +420,9 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, } static struct h8300_frame_cache * -h8300_frame_cache (struct frame_info *next_frame, void **this_cache) +h8300_frame_cache (struct frame_info *this_frame, void **this_cache) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct h8300_frame_cache *cache; char buf[4]; int i; @@ -441,14 +441,14 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache) optional. For these "frameless" functions the frame pointer is actually the frame pointer of the calling frame. */ - cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM); if (cache->base == 0) return cache; cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch); - cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME); - current_pc = frame_pc_unwind (next_frame); + cache->pc = get_frame_func (this_frame); + current_pc = get_frame_pc (this_frame); if (cache->pc != 0) h8300_analyze_prologue (cache->pc, current_pc, cache); @@ -462,7 +462,7 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache) frame by looking at the stack pointer. For truly "frameless" functions this might work too. */ - cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM) + cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM) + cache->sp_offset; cache->saved_sp = cache->base + BINWORD (gdbarch); cache->saved_regs[E_PC_REGNUM] = 0; @@ -483,11 +483,11 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache) } static void -h8300_frame_this_id (struct frame_info *next_frame, void **this_cache, +h8300_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct h8300_frame_cache *cache = - h8300_frame_cache (next_frame, this_cache); + h8300_frame_cache (this_frame, this_cache); /* This marks the outermost frame. */ if (cache->base == 0) @@ -496,65 +496,39 @@ h8300_frame_this_id (struct frame_info *next_frame, void **this_cache, *this_id = frame_id_build (cache->saved_sp, cache->pc); } -static void -h8300_frame_prev_register (struct frame_info *next_frame, void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +h8300_frame_prev_register (struct frame_info *this_frame, void **this_cache, + int regnum) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct h8300_frame_cache *cache = - h8300_frame_cache (next_frame, this_cache); + h8300_frame_cache (this_frame, this_cache); gdb_assert (regnum >= 0); if (regnum == E_SP_REGNUM && cache->saved_sp) - { - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (valuep) - store_unsigned_integer (valuep, BINWORD (gdbarch), cache->saved_sp); - return; - } + return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp); if (regnum < gdbarch_num_regs (gdbarch) && cache->saved_regs[regnum] != -1) - { - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = cache->saved_regs[regnum]; - *realnump = -1; - if (valuep) - read_memory (*addrp, valuep, register_size (gdbarch, regnum)); - return; - } + return frame_unwind_got_memory (this_frame, regnum, + cache->saved_regs[regnum]); - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realnump = regnum; - if (valuep) - frame_unwind_register (next_frame, *realnump, valuep); + return frame_unwind_got_register (this_frame, regnum, regnum); } static const struct frame_unwind h8300_frame_unwind = { NORMAL_FRAME, h8300_frame_this_id, - h8300_frame_prev_register + h8300_frame_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -h8300_frame_sniffer (struct frame_info *next_frame) -{ - return &h8300_frame_unwind; -} - static CORE_ADDR -h8300_frame_base_address (struct frame_info *next_frame, void **this_cache) +h8300_frame_base_address (struct frame_info *this_frame, void **this_cache) { - struct h8300_frame_cache *cache = h8300_frame_cache (next_frame, this_cache); + struct h8300_frame_cache *cache = h8300_frame_cache (this_frame, this_cache); return cache->base; } @@ -1337,7 +1311,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Frame unwinder. */ set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc); set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp); - set_gdbarch_unwind_dummy_id (gdbarch, h8300_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, h8300_dummy_id); frame_base_set_default (gdbarch, &h8300_frame_base); /* @@ -1359,8 +1333,8 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_believe_pcc_promotion (gdbarch, 1); /* Hook in the DWARF CFI frame unwinder. */ - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, h8300_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &h8300_frame_unwind); return gdbarch; diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c index 71bea33..ef6b65f 100644 --- a/gdb/hppa-linux-tdep.c +++ b/gdb/hppa-linux-tdep.c @@ -196,10 +196,10 @@ struct hppa_linux_sigtramp_unwind_cache }; static struct hppa_linux_sigtramp_unwind_cache * -hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *next_frame, +hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *this_frame, void **this_cache) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct hppa_linux_sigtramp_unwind_cache *info; CORE_ADDR pc, scptr; int i; @@ -209,9 +209,9 @@ hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct hppa_linux_sigtramp_unwind_cache); *this_cache = info; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); - pc = frame_pc_unwind (next_frame); + pc = get_frame_pc (this_frame); scptr = hppa_linux_sigtramp_find_sigcontext (pc); /* structure of struct sigcontext: @@ -262,58 +262,59 @@ hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *next_frame, info->saved_regs[HPPA_PCOQ_TAIL_REGNUM].addr = scptr; scptr += 4; - info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM); + info->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM); return info; } static void -hppa_linux_sigtramp_frame_this_id (struct frame_info *next_frame, +hppa_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct hppa_linux_sigtramp_unwind_cache *info - = hppa_linux_sigtramp_frame_unwind_cache (next_frame, this_prologue_cache); - *this_id = frame_id_build (info->base, frame_pc_unwind (next_frame)); + = hppa_linux_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache); + *this_id = frame_id_build (info->base, get_frame_pc (this_frame)); } -static void -hppa_linux_sigtramp_frame_prev_register (struct frame_info *next_frame, +static struct value * +hppa_linux_sigtramp_frame_prev_register (struct frame_info *this_frame, void **this_prologue_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, - CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) + int regnum) { struct hppa_linux_sigtramp_unwind_cache *info - = hppa_linux_sigtramp_frame_unwind_cache (next_frame, this_prologue_cache); - hppa_frame_prev_register_helper (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + = hppa_linux_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache); + return hppa_frame_prev_register_helper (this_frame, + info->saved_regs, regnum); } -static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = { - SIGTRAMP_FRAME, - hppa_linux_sigtramp_frame_this_id, - hppa_linux_sigtramp_frame_prev_register -}; - /* hppa-linux always uses "new-style" rt-signals. The signal handler's return address should point to a signal trampoline on the stack. The signal trampoline is embedded in a rt_sigframe structure that is aligned on the stack. We take advantage of the fact that sp must be 64-byte aligned, and the trampoline is small, so by rounding down the trampoline address we can find the beginning of the struct rt_sigframe. */ -static const struct frame_unwind * -hppa_linux_sigtramp_unwind_sniffer (struct frame_info *next_frame) +static int +hppa_linux_sigtramp_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_prologue_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); if (hppa_linux_sigtramp_find_sigcontext (pc)) - return &hppa_linux_sigtramp_frame_unwind; + return 1; - return NULL; + return 0; } +static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = { + SIGTRAMP_FRAME, + hppa_linux_sigtramp_frame_this_id, + hppa_linux_sigtramp_frame_prev_register, + NULL, + hppa_linux_sigtramp_frame_sniffer +}; + /* Attempt to find (and return) the global pointer for the given function. @@ -522,7 +523,7 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_write_pc (gdbarch, hppa_linux_target_write_pc); - frame_unwind_append_sniffer (gdbarch, hppa_linux_sigtramp_unwind_sniffer); + frame_unwind_append_unwinder (gdbarch, &hppa_linux_sigtramp_frame_unwind); /* GNU/Linux uses SVR4-style shared libraries. */ set_solib_svr4_fetch_link_map_offsets diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index d938fe7..4843ff1 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -356,7 +356,7 @@ iq2000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) } static struct iq2000_frame_cache * -iq2000_frame_cache (struct frame_info *next_frame, void **this_cache) +iq2000_frame_cache (struct frame_info *this_frame, void **this_cache) { struct iq2000_frame_cache *cache; CORE_ADDR current_pc; @@ -369,16 +369,16 @@ iq2000_frame_cache (struct frame_info *next_frame, void **this_cache) iq2000_init_frame_cache (cache); *this_cache = cache; - cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM); //if (cache->base == 0) //return cache; - current_pc = frame_pc_unwind (next_frame); + current_pc = get_frame_pc (this_frame); find_pc_partial_function (current_pc, NULL, &cache->pc, NULL); if (cache->pc != 0) - iq2000_scan_prologue (cache->pc, current_pc, next_frame, cache); + iq2000_scan_prologue (cache->pc, current_pc, this_frame, cache); if (!cache->using_fp) - cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM); cache->saved_sp = cache->base + cache->framesize; @@ -389,52 +389,30 @@ iq2000_frame_cache (struct frame_info *next_frame, void **this_cache) return cache; } -static void -iq2000_frame_prev_register (struct frame_info *next_frame, void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +iq2000_frame_prev_register (struct frame_info *this_frame, void **this_cache, + int regnum) { - struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache); + struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache); + if (regnum == E_SP_REGNUM && cache->saved_sp) - { - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (valuep) - store_unsigned_integer (valuep, 4, cache->saved_sp); - return; - } + return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp); if (regnum == E_PC_REGNUM) regnum = E_LR_REGNUM; if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != -1) - { - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = cache->saved_regs[regnum]; - *realnump = -1; - if (valuep) - read_memory (*addrp, valuep, - register_size (get_frame_arch (next_frame), regnum)); - return; - } + return frame_unwind_got_memory (this_frame, regnum, + cache->saved_regs[regnum]); - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realnump = regnum; - if (valuep) - frame_unwind_register (next_frame, (*realnump), valuep); + return frame_unwind_got_register (this_frame, regnum, regnum); } static void -iq2000_frame_this_id (struct frame_info *next_frame, void **this_cache, +iq2000_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache); + struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache); /* This marks the outermost frame. */ if (cache->base == 0) @@ -446,15 +424,11 @@ iq2000_frame_this_id (struct frame_info *next_frame, void **this_cache, static const struct frame_unwind iq2000_frame_unwind = { NORMAL_FRAME, iq2000_frame_this_id, - iq2000_frame_prev_register + iq2000_frame_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -iq2000_frame_sniffer (struct frame_info *next_frame) -{ - return &iq2000_frame_unwind; -} - static CORE_ADDR iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { @@ -468,16 +442,16 @@ iq2000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) } static struct frame_id -iq2000_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (iq2000_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM); + return frame_id_build (sp, get_frame_pc (this_frame)); } static CORE_ADDR -iq2000_frame_base_address (struct frame_info *next_frame, void **this_cache) +iq2000_frame_base_address (struct frame_info *this_frame, void **this_cache) { - struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache); + struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache); return cache->base; } @@ -851,14 +825,14 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_align (gdbarch, iq2000_frame_align); set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp); set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc); - set_gdbarch_unwind_dummy_id (gdbarch, iq2000_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id); frame_base_set_default (gdbarch, &iq2000_frame_base); set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call); gdbarch_init_osabi (info, gdbarch); - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, iq2000_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &iq2000_frame_unwind); return gdbarch; } diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 513da03..b8cd167 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -1828,13 +1828,13 @@ m32c_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip) /* Stack unwinding. */ static struct m32c_prologue * -m32c_analyze_frame_prologue (struct frame_info *next_frame, +m32c_analyze_frame_prologue (struct frame_info *this_frame, void **this_prologue_cache) { if (! *this_prologue_cache) { - CORE_ADDR func_start = frame_func_unwind (next_frame, NORMAL_FRAME); - CORE_ADDR stop_addr = frame_pc_unwind (next_frame); + CORE_ADDR func_start = get_frame_func (this_frame); + CORE_ADDR 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. */ @@ -1842,7 +1842,7 @@ m32c_analyze_frame_prologue (struct frame_info *next_frame, stop_addr = func_start; *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue); - m32c_analyze_prologue (get_frame_arch (next_frame), + m32c_analyze_prologue (get_frame_arch (this_frame), func_start, stop_addr, *this_prologue_cache); } @@ -1851,12 +1851,12 @@ m32c_analyze_frame_prologue (struct frame_info *next_frame, static CORE_ADDR -m32c_frame_base (struct frame_info *next_frame, +m32c_frame_base (struct frame_info *this_frame, void **this_prologue_cache) { struct m32c_prologue *p - = m32c_analyze_frame_prologue (next_frame, this_prologue_cache); - struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame)); + = m32c_analyze_frame_prologue (this_frame, this_prologue_cache); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); /* In functions that use alloca, the distance between the stack pointer and the frame base varies dynamically, so we can't use @@ -1869,14 +1869,14 @@ m32c_frame_base (struct frame_info *next_frame, case prologue_with_frame_ptr: { CORE_ADDR fb - = frame_unwind_register_unsigned (next_frame, tdep->fb->num); + = get_frame_register_unsigned (this_frame, tdep->fb->num); return fb - p->frame_ptr_offset; } case prologue_sans_frame_ptr: { CORE_ADDR sp - = frame_unwind_register_unsigned (next_frame, tdep->sp->num); + = get_frame_register_unsigned (this_frame, tdep->sp->num); return sp - p->frame_size; } @@ -1890,82 +1890,52 @@ m32c_frame_base (struct frame_info *next_frame, static void -m32c_this_id (struct frame_info *next_frame, +m32c_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { - CORE_ADDR base = m32c_frame_base (next_frame, this_prologue_cache); + CORE_ADDR base = m32c_frame_base (this_frame, this_prologue_cache); if (base) - *this_id = frame_id_build (base, - frame_func_unwind (next_frame, NORMAL_FRAME)); + *this_id = frame_id_build (base, get_frame_func (this_frame)); /* Otherwise, leave it unset, and that will terminate the backtrace. */ } -static void -m32c_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 * +m32c_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { - struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame)); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); struct m32c_prologue *p - = m32c_analyze_frame_prologue (next_frame, this_prologue_cache); - CORE_ADDR frame_base = m32c_frame_base (next_frame, this_prologue_cache); - int reg_size = register_size (get_frame_arch (next_frame), regnum); + = m32c_analyze_frame_prologue (this_frame, this_prologue_cache); + CORE_ADDR frame_base = m32c_frame_base (this_frame, this_prologue_cache); + int reg_size = register_size (get_frame_arch (this_frame), regnum); if (regnum == tdep->sp->num) - { - *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) + return 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 - { - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realnump = regnum; - if (bufferp) - frame_unwind_register (next_frame, *realnump, bufferp); - } + return frame_unwind_got_register (this_frame, regnum, regnum); } static const struct frame_unwind m32c_unwind = { NORMAL_FRAME, m32c_this_id, - m32c_prev_register + m32c_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -m32c_frame_sniffer (struct frame_info *next_frame) -{ - return &m32c_unwind; -} - - static CORE_ADDR m32c_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame) { @@ -2146,7 +2116,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function, static struct frame_id -m32c_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +m32c_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { /* This needs to return a frame ID whose PC is the return address passed to m32c_push_dummy_call, and whose stack_addr is the SP @@ -2154,8 +2124,9 @@ m32c_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) m32c_unwind_sp gives us the CFA, which is the value the SP had before the return address was pushed. */ - return frame_id_build (m32c_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, tdep->sp->num); + return frame_id_build (sp, get_frame_pc (this_frame)); } @@ -2611,14 +2582,14 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) know which, but I do know that the prologue analyzer works better. MVS 04/13/06 */ - frame_unwind_append_sniffer (arch, dwarf2_frame_sniffer); + dwarf2_append_sniffers (arch); #endif - frame_unwind_append_sniffer (arch, m32c_frame_sniffer); + frame_unwind_append_unwinder (arch, &m32c_unwind); /* Inferior calls. */ set_gdbarch_push_dummy_call (arch, m32c_push_dummy_call); set_gdbarch_return_value (arch, m32c_return_value); - set_gdbarch_unwind_dummy_id (arch, m32c_unwind_dummy_id); + set_gdbarch_dummy_id (arch, m32c_dummy_id); /* Trampolines. */ set_gdbarch_skip_trampoline_code (arch, m32c_skip_trampoline_code); diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c index e22a952..5caf79b 100644 --- a/gdb/m32r-linux-tdep.c +++ b/gdb/m32r-linux-tdep.c @@ -84,7 +84,7 @@ static const gdb_byte linux_sigtramp_code[] = { the routine. Otherwise, return 0. */ static CORE_ADDR -m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame) +m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *this_frame) { gdb_byte buf[4]; @@ -98,7 +98,7 @@ m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame) if (pc % 2 != 0) { - if (!safe_frame_unwind_memory (next_frame, pc, buf, 2)) + if (!safe_frame_unwind_memory (this_frame, pc, buf, 2)) return 0; if (memcmp (buf, linux_sigtramp_code, 2) == 0) @@ -107,7 +107,7 @@ m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame) return 0; } - if (!safe_frame_unwind_memory (next_frame, pc, buf, 4)) + if (!safe_frame_unwind_memory (this_frame, pc, buf, 4)) return 0; if (memcmp (buf, linux_sigtramp_code, 4) != 0) @@ -132,7 +132,7 @@ static const gdb_byte linux_rt_sigtramp_code[] = { of the routine. Otherwise, return 0. */ static CORE_ADDR -m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame) +m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *this_frame) { gdb_byte buf[4]; @@ -147,12 +147,12 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame) if (pc % 2 != 0) return 0; - if (!safe_frame_unwind_memory (next_frame, pc, buf, 4)) + if (!safe_frame_unwind_memory (this_frame, pc, buf, 4)) return 0; if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0) { - if (!safe_frame_unwind_memory (next_frame, pc + 4, buf, 4)) + if (!safe_frame_unwind_memory (this_frame, pc + 4, buf, 4)) return 0; if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0) @@ -160,7 +160,7 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame) } else if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0) { - if (!safe_frame_unwind_memory (next_frame, pc - 4, buf, 4)) + if (!safe_frame_unwind_memory (this_frame, pc - 4, buf, 4)) return 0; if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0) @@ -172,7 +172,7 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame) static int m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name, - struct frame_info *next_frame) + struct frame_info *this_frame) { /* If we have NAME, we can optimize the search. The trampolines are named __restore and __restore_rt. However, they aren't dynamically @@ -180,8 +180,8 @@ m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name, be part of the preceding function. This should always be sigaction, __sigaction, or __libc_sigaction (all aliases to the same function). */ if (name == NULL || strstr (name, "sigaction") != NULL) - return (m32r_linux_sigtramp_start (pc, next_frame) != 0 - || m32r_linux_rt_sigtramp_start (pc, next_frame) != 0); + return (m32r_linux_sigtramp_start (pc, this_frame) != 0 + || m32r_linux_rt_sigtramp_start (pc, this_frame) != 0); return (strcmp ("__restore", name) == 0 || strcmp ("__restore_rt", name) == 0); @@ -222,7 +222,7 @@ struct m32r_frame_cache }; static struct m32r_frame_cache * -m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame, +m32r_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) { struct m32r_frame_cache *cache; @@ -233,26 +233,26 @@ m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame, return (*this_cache); cache = FRAME_OBSTACK_ZALLOC (struct m32r_frame_cache); (*this_cache) = cache; - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); - cache->base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM); sigcontext_addr = cache->base + 4; - cache->pc = frame_pc_unwind (next_frame); - addr = m32r_linux_sigtramp_start (cache->pc, next_frame); + cache->pc = get_frame_pc (this_frame); + addr = m32r_linux_sigtramp_start (cache->pc, this_frame); if (addr == 0) { /* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR accordingly. */ - addr = m32r_linux_rt_sigtramp_start (cache->pc, next_frame); + addr = m32r_linux_rt_sigtramp_start (cache->pc, this_frame); if (addr) sigcontext_addr += 128; else - addr = frame_func_unwind (next_frame, NORMAL_FRAME); + addr = get_frame_func (this_frame); } cache->pc = addr; - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); for (regnum = 0; regnum < sizeof (m32r_linux_sc_reg_offset) / 4; regnum++) { @@ -265,50 +265,49 @@ m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame, } static void -m32r_linux_sigtramp_frame_this_id (struct frame_info *next_frame, +m32r_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct m32r_frame_cache *cache = - m32r_linux_sigtramp_frame_cache (next_frame, this_cache); + m32r_linux_sigtramp_frame_cache (this_frame, this_cache); (*this_id) = frame_id_build (cache->base, cache->pc); } -static void -m32r_linux_sigtramp_frame_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, - CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +m32r_linux_sigtramp_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { struct m32r_frame_cache *cache = - m32r_linux_sigtramp_frame_cache (next_frame, this_cache); + m32r_linux_sigtramp_frame_cache (this_frame, this_cache); - trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); } -static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = { - SIGTRAMP_FRAME, - m32r_linux_sigtramp_frame_this_id, - m32r_linux_sigtramp_frame_prev_register -}; - -static const struct frame_unwind * -m32r_linux_sigtramp_frame_sniffer (struct frame_info *next_frame) +static int +m32r_linux_sigtramp_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); char *name; find_pc_partial_function (pc, &name, NULL, NULL); - if (m32r_linux_pc_in_sigtramp (pc, name, next_frame)) - return &m32r_linux_sigtramp_frame_unwind; + if (m32r_linux_pc_in_sigtramp (pc, name, this_frame)) + return 1; - return NULL; + return 0; } +static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = { + SIGTRAMP_FRAME, + m32r_linux_sigtramp_frame_this_id, + m32r_linux_sigtramp_frame_prev_register, + NULL, + m32r_linux_sigtramp_frame_sniffer +}; + /* Mapping between the registers in `struct pt_regs' format and GDB's register array layout. */ @@ -409,7 +408,7 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) the number of registers. */ set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS - 1); - frame_unwind_append_sniffer (gdbarch, m32r_linux_sigtramp_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &m32r_linux_sigtramp_frame_unwind); /* GNU/Linux uses SVR4-style shared libraries. */ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 964ae38..53f0d20 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -513,7 +513,7 @@ struct m32r_unwind_cache for it IS the sp for the next frame. */ static struct m32r_unwind_cache * -m32r_frame_unwind_cache (struct frame_info *next_frame, +m32r_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { CORE_ADDR pc, scan_limit; @@ -529,19 +529,19 @@ m32r_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct m32r_unwind_cache); (*this_prologue_cache) = info; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); info->size = 0; info->sp_offset = 0; info->uses_frame = 0; - scan_limit = frame_pc_unwind (next_frame); - for (pc = frame_func_unwind (next_frame, NORMAL_FRAME); + scan_limit = get_frame_pc (this_frame); + for (pc = get_frame_func (this_frame); pc > 0 && pc < scan_limit; pc += 2) { if ((pc & 2) == 0) { - op = get_frame_memory_unsigned (next_frame, pc, 4); + op = get_frame_memory_unsigned (this_frame, pc, 4); if ((op & 0x80000000) == 0x80000000) { /* 32-bit instruction */ @@ -552,7 +552,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame, info->sp_offset += n; } else if (((op >> 8) == 0xe4) - && get_frame_memory_unsigned (next_frame, pc + 2, + && get_frame_memory_unsigned (this_frame, pc + 2, 2) == 0x0f24) { /* ld24 r4, xxxxxx; sub sp, r4 */ @@ -569,7 +569,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame, } /* 16-bit instructions */ - op = get_frame_memory_unsigned (next_frame, pc, 2) & 0x7fff; + op = get_frame_memory_unsigned (this_frame, pc, 2) & 0x7fff; if ((op & 0xf0ff) == 0x207f) { /* st rn, @-sp */ @@ -606,7 +606,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame, /* The SP was moved to the FP. This indicates that a new frame was created. Get THIS frame's FP value by unwinding it from the next frame. */ - this_base = frame_unwind_register_unsigned (next_frame, M32R_FP_REGNUM); + this_base = get_frame_register_unsigned (this_frame, M32R_FP_REGNUM); /* The FP points at the last saved register. Adjust the FP back to before the first saved register giving the SP. */ prev_sp = this_base + info->size; @@ -615,7 +615,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame, { /* Assume that the FP is this frame's SP but with that pushed stack space added back. */ - this_base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM); + this_base = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM); prev_sp = this_base + info->size; } @@ -625,7 +625,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame, /* Adjust all the saved registers so that they contain addresses and not offsets. */ - for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)) - 1; i++) + for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++) if (trad_frame_addr_p (info->saved_regs, i)) info->saved_regs[i].addr = (info->prev_sp + info->saved_regs[i].addr); @@ -814,18 +814,18 @@ m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) frame. This will be used to create a new GDB frame struct. */ static void -m32r_frame_this_id (struct frame_info *next_frame, +m32r_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct m32r_unwind_cache *info - = m32r_frame_unwind_cache (next_frame, this_prologue_cache); + = m32r_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; struct minimal_symbol *msym_stack; struct frame_id id; /* The FUNC is easy. */ - func = frame_func_unwind (next_frame, NORMAL_FRAME); + func = get_frame_func (this_frame); /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); @@ -843,36 +843,28 @@ m32r_frame_this_id (struct frame_info *next_frame, (*this_id) = id; } -static void -m32r_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 * +m32r_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { struct m32r_unwind_cache *info - = m32r_frame_unwind_cache (next_frame, this_prologue_cache); - trad_frame_get_prev_register (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + = m32r_frame_unwind_cache (this_frame, this_prologue_cache); + return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); } static const struct frame_unwind m32r_frame_unwind = { NORMAL_FRAME, m32r_frame_this_id, - m32r_frame_prev_register + m32r_frame_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -m32r_frame_sniffer (struct frame_info *next_frame) -{ - return &m32r_frame_unwind; -} - static CORE_ADDR -m32r_frame_base_address (struct frame_info *next_frame, void **this_cache) +m32r_frame_base_address (struct frame_info *this_frame, void **this_cache) { struct m32r_unwind_cache *info - = m32r_frame_unwind_cache (next_frame, this_cache); + = m32r_frame_unwind_cache (this_frame, this_cache); return info->base; } @@ -883,16 +875,15 @@ static const struct frame_base m32r_frame_base = { m32r_frame_base_address }; -/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that - dummy frame. The frame ID's base needs to match the TOS value - saved by save_dummy_frame_tos(), and the PC match the dummy frame's - breakpoint. */ +/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy + frame. The frame ID's base needs to match the TOS value saved by + save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */ static struct frame_id -m32r_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +m32r_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (m32r_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM); + return frame_id_build (sp, get_frame_pc (this_frame)); } @@ -940,7 +931,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Methods for saving / extracting a dummy frame's ID. The ID's stack address must match the SP value returned by PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */ - set_gdbarch_unwind_dummy_id (gdbarch, m32r_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, m32r_dummy_id); /* Return the unwound PC value. */ set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc); @@ -951,7 +942,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) gdbarch_init_osabi (info, gdbarch); /* Hook in the default unwinders. */ - frame_unwind_append_sniffer (gdbarch, m32r_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &m32r_frame_unwind); /* Support simple overlay manager. */ set_gdbarch_overlay_update (gdbarch, simple_overlay_update); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index f765d44..16bb243 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -774,10 +774,10 @@ m68hc11_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) for it IS the sp for the next frame. */ struct m68hc11_unwind_cache * -m68hc11_frame_unwind_cache (struct frame_info *next_frame, +m68hc11_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); ULONGEST prev_sp; ULONGEST this_base; struct m68hc11_unwind_cache *info; @@ -789,9 +789,9 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct m68hc11_unwind_cache); (*this_prologue_cache) = info; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); - info->pc = frame_func_unwind (next_frame, NORMAL_FRAME); + info->pc = get_frame_func (this_frame); info->size = 0; info->return_kind = m68hc11_get_return_insn (info->pc); @@ -799,14 +799,14 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame, /* The SP was moved to the FP. This indicates that a new frame was created. Get THIS frame's FP value by unwinding it from the next frame. */ - this_base = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM); + this_base = get_frame_register_unsigned (this_frame, SOFT_FP_REGNUM); if (this_base == 0) { info->base = 0; return info; } - current_pc = frame_pc_unwind (next_frame); + current_pc = get_frame_pc (this_frame); if (info->pc != 0) m68hc11_scan_prologue (gdbarch, info->pc, current_pc, info); @@ -815,7 +815,7 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame, if (info->sp_offset != (CORE_ADDR) -1) { info->saved_regs[HARD_PC_REGNUM].addr = info->sp_offset; - this_base = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM); + this_base = get_frame_register_unsigned (this_frame, HARD_SP_REGNUM); prev_sp = this_base + info->sp_offset + 2; this_base += STACK_CORRECTION (gdbarch); } @@ -874,18 +874,18 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame, frame. This will be used to create a new GDB frame struct. */ static void -m68hc11_frame_this_id (struct frame_info *next_frame, +m68hc11_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct m68hc11_unwind_cache *info - = m68hc11_frame_unwind_cache (next_frame, this_prologue_cache); + = m68hc11_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; struct frame_id id; /* The FUNC is easy. */ - func = frame_func_unwind (next_frame, NORMAL_FRAME); + func = get_frame_func (this_frame); /* Hopefully the prologue analysis either correctly determined the frame's base (which is the SP from the previous frame), or set @@ -898,67 +898,69 @@ m68hc11_frame_this_id (struct frame_info *next_frame, (*this_id) = id; } -static void -m68hc11_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 * +m68hc11_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { + struct value *value; struct m68hc11_unwind_cache *info - = m68hc11_frame_unwind_cache (next_frame, this_prologue_cache); + = m68hc11_frame_unwind_cache (this_frame, this_prologue_cache); - trad_frame_get_prev_register (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + value = trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); - if (regnum == HARD_PC_REGNUM) + /* Take into account the 68HC12 specific call (PC + page). */ + if (regnum == HARD_PC_REGNUM + && info->return_kind == RETURN_RTC + && USE_PAGE_REGISTER (get_frame_arch (this_frame))) { - /* Take into account the 68HC12 specific call (PC + page). */ - if (info->return_kind == RETURN_RTC - && *addrp >= 0x08000 && *addrp < 0x0c000 - && USE_PAGE_REGISTER (get_frame_arch (next_frame))) + CORE_ADDR pc = value_as_long (value); + if (pc >= 0x08000 && pc < 0x0c000) { - int page_optimized; - CORE_ADDR page; - trad_frame_get_prev_register (next_frame, info->saved_regs, - HARD_PAGE_REGNUM, &page_optimized, - 0, &page, 0, 0); - *addrp -= 0x08000; - *addrp += ((page & 0x0ff) << 14); - *addrp += 0x1000000; + release_value (value); + value_free (value); + + value = trad_frame_get_prev_register (this_frame, info->saved_regs, + HARD_PAGE_REGNUM); + page = value_as_long (value); + release_value (value); + value_free (value); + + pc -= 0x08000; + pc += ((page & 0x0ff) << 14); + pc += 0x1000000; + + return frame_unwind_got_constant (this_frame, regnum, pc); } } + + return value; } static const struct frame_unwind m68hc11_frame_unwind = { NORMAL_FRAME, m68hc11_frame_this_id, - m68hc11_frame_prev_register + m68hc11_frame_prev_register, + NULL, + default_frame_sniffer }; -const struct frame_unwind * -m68hc11_frame_sniffer (struct frame_info *next_frame) -{ - return &m68hc11_frame_unwind; -} - static CORE_ADDR -m68hc11_frame_base_address (struct frame_info *next_frame, void **this_cache) +m68hc11_frame_base_address (struct frame_info *this_frame, void **this_cache) { struct m68hc11_unwind_cache *info - = m68hc11_frame_unwind_cache (next_frame, this_cache); + = m68hc11_frame_unwind_cache (this_frame, this_cache); return info->base; } static CORE_ADDR -m68hc11_frame_args_address (struct frame_info *next_frame, void **this_cache) +m68hc11_frame_args_address (struct frame_info *this_frame, void **this_cache) { CORE_ADDR addr; struct m68hc11_unwind_cache *info - = m68hc11_frame_unwind_cache (next_frame, this_cache); + = m68hc11_frame_unwind_cache (this_frame, this_cache); addr = info->base + info->size; if (info->return_kind == RETURN_RTC) @@ -984,18 +986,17 @@ m68hc11_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) return sp; } -/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that - dummy frame. The frame ID's base needs to match the TOS value - saved by save_dummy_frame_tos(), and the PC match the dummy frame's - breakpoint. */ +/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy + frame. The frame ID's base needs to match the TOS value saved by + save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */ static struct frame_id -m68hc11_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +m68hc11_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { ULONGEST tos; - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); - tos = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM); + tos = get_frame_register_unsigned (this_frame, SOFT_FP_REGNUM); tos += 2; return frame_id_build (tos, pc); } @@ -1520,15 +1521,15 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_print_registers_info (gdbarch, m68hc11_print_registers_info); /* Hook in the DWARF CFI frame unwinder. */ - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); + dwarf2_append_unwinders (gdbarch); - frame_unwind_append_sniffer (gdbarch, m68hc11_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &m68hc11_frame_unwind); frame_base_set_default (gdbarch, &m68hc11_frame_base); /* Methods for saving / extracting a dummy frame's ID. The ID's stack address must match the SP value returned by PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */ - set_gdbarch_unwind_dummy_id (gdbarch, m68hc11_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, m68hc11_dummy_id); /* Return the unwound PC value. */ set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc); diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 6079236..83a41c7 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; } diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index db35b5c..37d0b84 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -844,7 +844,7 @@ mn10300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Simple frame_unwind_cache. This finds the "extra info" for the frame. */ struct trad_frame_cache * -mn10300_frame_unwind_cache (struct frame_info *next_frame, +mn10300_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { struct gdbarch *gdbarch; @@ -855,10 +855,10 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame, if (*this_prologue_cache) return (*this_prologue_cache); - gdbarch = get_frame_arch (next_frame); - cache_p = trad_frame_cache_zalloc (next_frame); - pc = gdbarch_unwind_pc (gdbarch, next_frame); - mn10300_analyze_prologue (gdbarch, next_frame, &cache_p, pc); + gdbarch = get_frame_arch (this_frame); + cache_p = trad_frame_cache_zalloc (this_frame); + pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM); + mn10300_analyze_prologue (gdbarch, this_frame, &cache_p, pc); cache = cache_p; if (find_pc_partial_function (pc, NULL, &start, &end)) @@ -867,7 +867,7 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame, start)); else { - start = frame_func_unwind (next_frame, NORMAL_FRAME); + start = get_frame_func (this_frame); trad_frame_set_id (cache, frame_id_build (trad_frame_get_this_base (cache), start)); @@ -879,65 +879,53 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame, /* Here is a dummy implementation. */ static struct frame_id -mn10300_unwind_dummy_id (struct gdbarch *gdbarch, - struct frame_info *next_frame) +mn10300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (frame_sp_unwind (next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM); + CORE_ADDR pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM); + return frame_id_build (sp, pc); } /* Trad frame implementation. */ static void -mn10300_frame_this_id (struct frame_info *next_frame, +mn10300_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct trad_frame_cache *cache = - mn10300_frame_unwind_cache (next_frame, this_prologue_cache); + mn10300_frame_unwind_cache (this_frame, this_prologue_cache); trad_frame_get_id (cache, this_id); } -static void -mn10300_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 * +mn10300_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { struct trad_frame_cache *cache = - mn10300_frame_unwind_cache (next_frame, this_prologue_cache); + mn10300_frame_unwind_cache (this_frame, this_prologue_cache); - trad_frame_get_register (cache, next_frame, regnum, optimizedp, - lvalp, addrp, realnump, bufferp); - /* Or... - trad_frame_get_prev_register (next_frame, cache->prev_regs, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); - */ + return trad_frame_get_register (cache, this_frame, regnum); } static const struct frame_unwind mn10300_frame_unwind = { NORMAL_FRAME, mn10300_frame_this_id, - mn10300_frame_prev_register + mn10300_frame_prev_register, + NULL, + default_frame_sniffer }; static CORE_ADDR -mn10300_frame_base_address (struct frame_info *next_frame, +mn10300_frame_base_address (struct frame_info *this_frame, void **this_prologue_cache) { struct trad_frame_cache *cache = - mn10300_frame_unwind_cache (next_frame, this_prologue_cache); + mn10300_frame_unwind_cache (this_frame, this_prologue_cache); return trad_frame_get_this_base (cache); } -static const struct frame_unwind * -mn10300_frame_sniffer (struct frame_info *next_frame) -{ - return &mn10300_frame_unwind; -} - static const struct frame_base mn10300_frame_base = { &mn10300_frame_unwind, mn10300_frame_base_address, @@ -966,10 +954,10 @@ mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) static void mn10300_frame_unwind_init (struct gdbarch *gdbarch) { - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, mn10300_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind); frame_base_set_default (gdbarch, &mn10300_frame_base); - set_gdbarch_unwind_dummy_id (gdbarch, mn10300_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id); set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc); set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp); } diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index 47246fb..da6e99c 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -872,7 +872,7 @@ struct mt_unwind_cache the frame. */ static struct mt_unwind_cache * -mt_frame_unwind_cache (struct frame_info *next_frame, +mt_frame_unwind_cache (struct frame_info *this_frame, void **this_prologue_cache) { struct gdbarch *gdbarch; @@ -885,7 +885,7 @@ mt_frame_unwind_cache (struct frame_info *next_frame, if ((*this_prologue_cache)) return (*this_prologue_cache); - gdbarch = get_frame_arch (next_frame); + gdbarch = get_frame_arch (this_frame); info = FRAME_OBSTACK_ZALLOC (struct mt_unwind_cache); (*this_prologue_cache) = info; @@ -893,26 +893,26 @@ mt_frame_unwind_cache (struct frame_info *next_frame, info->framesize = 0; info->frame_base = 0; info->frameless_p = 1; - info->saved_regs = trad_frame_alloc_saved_regs (next_frame); + info->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* Grab the frame-relative values of SP and FP, needed below. The frame_saved_register function will find them on the stack or in the registers as appropriate. */ - sp = frame_unwind_register_unsigned (next_frame, MT_SP_REGNUM); - fp = frame_unwind_register_unsigned (next_frame, MT_FP_REGNUM); + sp = get_frame_register_unsigned (this_frame, MT_SP_REGNUM); + fp = get_frame_register_unsigned (this_frame, MT_FP_REGNUM); - start_addr = frame_func_unwind (next_frame, NORMAL_FRAME); + start_addr = get_frame_func (this_frame); /* Return early if GDB couldn't find the function. */ if (start_addr == 0) return info; - end_addr = frame_pc_unwind (next_frame); + end_addr = get_frame_pc (this_frame); prologue_end_addr = skip_prologue_using_sal (start_addr); if (end_addr == 0) for (next_addr = start_addr; next_addr < end_addr; next_addr += 4) { - instr = get_frame_memory_unsigned (next_frame, next_addr, 4); + instr = get_frame_memory_unsigned (this_frame, next_addr, 4); if (delayed_store) /* previous instr was a push */ { upper_half = delayed_store >> 16; @@ -1028,55 +1028,49 @@ mt_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) return sp; } -/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that - dummy frame. The frame ID's base needs to match the TOS value - saved by save_dummy_frame_tos(), and the PC match the dummy frame's - breakpoint. */ +/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy + frame. The frame ID's base needs to match the TOS value saved by + save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */ static struct frame_id -mt_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +mt_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (mt_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, MT_SP_REGNUM); + return frame_id_build (sp, get_frame_pc (this_frame)); } /* Given a GDB frame, determine the address of the calling function's frame. This will be used to create a new GDB frame struct. */ static void -mt_frame_this_id (struct frame_info *next_frame, +mt_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct mt_unwind_cache *info = - mt_frame_unwind_cache (next_frame, this_prologue_cache); + mt_frame_unwind_cache (this_frame, this_prologue_cache); if (!(info == NULL || info->prev_sp == 0)) - (*this_id) = frame_id_build (info->prev_sp, - frame_func_unwind (next_frame, NORMAL_FRAME)); + (*this_id) = frame_id_build (info->prev_sp, get_frame_func (this_frame)); return; } -static void -mt_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 * +mt_frame_prev_register (struct frame_info *this_frame, + void **this_prologue_cache, int regnum) { struct mt_unwind_cache *info = - mt_frame_unwind_cache (next_frame, this_prologue_cache); + mt_frame_unwind_cache (this_frame, this_prologue_cache); - trad_frame_get_prev_register (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); } static CORE_ADDR -mt_frame_base_address (struct frame_info *next_frame, +mt_frame_base_address (struct frame_info *this_frame, void **this_prologue_cache) { struct mt_unwind_cache *info = - mt_frame_unwind_cache (next_frame, this_prologue_cache); + mt_frame_unwind_cache (this_frame, this_prologue_cache); return info->frame_base; } @@ -1090,18 +1084,11 @@ mt_frame_base_address (struct frame_info *next_frame, static const struct frame_unwind mt_frame_unwind = { NORMAL_FRAME, mt_frame_this_id, - mt_frame_prev_register + mt_frame_prev_register, + NULL, + default_frame_sniffer }; -/* The sniffer is a registered function that identifies our family of - frame unwind functions (this_id and prev_register). */ - -static const struct frame_unwind * -mt_frame_sniffer (struct frame_info *next_frame) -{ - return &mt_frame_unwind; -} - /* Another shared interface: the 'frame_base' object specifies how to unwind a frame and secure the base addresses for frame objects (locals, args). */ @@ -1168,8 +1155,8 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Register the DWARF 2 sniffer first, and then the traditional prologue based sniffer. */ - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, mt_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &mt_frame_unwind); frame_base_set_default (gdbarch, &mt_frame_base); /* Register the 'unwind_pc' method. */ @@ -1179,7 +1166,7 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Methods for saving / extracting a dummy frame's ID. The ID's stack address must match the SP value returned by PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */ - set_gdbarch_unwind_dummy_id (gdbarch, mt_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, mt_dummy_id); return gdbarch; } diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index 79be120..6f6ec9b 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -100,7 +100,7 @@ score_compare_pdr_entries (const void *a, const void *b) static void score_analyze_pdr_section (CORE_ADDR startaddr, CORE_ADDR pc, - struct frame_info *next_frame, + struct frame_info *this_frame, struct score_frame_cache *this_cache) { struct symbol *sym; @@ -442,12 +442,11 @@ score_return_value (struct gdbarch *gdbarch, struct type *func_type, } static struct frame_id -score_unwind_dummy_id (struct gdbarch *gdbarch, - struct frame_info *next_frame) +score_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { return frame_id_build ( - frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM), - frame_pc_unwind (next_frame)); + get_frame_register_unsigned (this_frame, SCORE_SP_REGNUM), + get_frame_pc (this_frame)); } static int @@ -754,10 +753,10 @@ score_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc) static void score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc, - struct frame_info *next_frame, + struct frame_info *this_frame, struct score_frame_cache *this_cache) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct gdbarch *gdbarch = get_frame_arch (this_frame); CORE_ADDR sp; CORE_ADDR fp; CORE_ADDR cur_pc = startaddr; @@ -777,8 +776,8 @@ score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc, memblock_ptr = memblock = score_malloc_and_get_memblock (startaddr, pc - startaddr); - sp = frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM); - fp = frame_unwind_register_unsigned (next_frame, SCORE_FP_REGNUM); + sp = get_frame_register_unsigned (this_frame, SCORE_SP_REGNUM); + fp = get_frame_register_unsigned (this_frame, SCORE_FP_REGNUM); for (; cur_pc < pc; prev_pc = cur_pc, cur_pc += inst_len) { @@ -938,7 +937,7 @@ score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc, } static struct score_frame_cache * -score_make_prologue_cache (struct frame_info *next_frame, void **this_cache) +score_make_prologue_cache (struct frame_info *this_frame, void **this_cache) { struct score_frame_cache *cache; @@ -947,17 +946,17 @@ score_make_prologue_cache (struct frame_info *next_frame, void **this_cache) cache = FRAME_OBSTACK_ZALLOC (struct score_frame_cache); (*this_cache) = cache; - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* Analyze the prologue. */ { - const CORE_ADDR pc = frame_pc_unwind (next_frame); + const CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR start_addr; find_pc_partial_function (pc, NULL, &start_addr, NULL); if (start_addr == 0) return cache; - score_analyze_prologue (start_addr, pc, next_frame, *this_cache); + score_analyze_prologue (start_addr, pc, this_frame, *this_cache); } /* Save SP. */ @@ -967,47 +966,38 @@ score_make_prologue_cache (struct frame_info *next_frame, void **this_cache) } static void -score_prologue_this_id (struct frame_info *next_frame, void **this_cache, +score_prologue_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct score_frame_cache *info = score_make_prologue_cache (next_frame, + struct score_frame_cache *info = score_make_prologue_cache (this_frame, this_cache); - (*this_id) = frame_id_build (info->base, - frame_func_unwind (next_frame, NORMAL_FRAME)); + (*this_id) = frame_id_build (info->base, get_frame_func (this_frame)); } -static void -score_prologue_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR * addrp, - int *realnump, gdb_byte * valuep) +static struct value * +score_prologue_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { - struct score_frame_cache *info = score_make_prologue_cache (next_frame, + struct score_frame_cache *info = score_make_prologue_cache (this_frame, this_cache); - trad_frame_get_prev_register (next_frame, info->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); } static const struct frame_unwind score_prologue_unwind = { NORMAL_FRAME, score_prologue_this_id, - score_prologue_prev_register + score_prologue_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -score_prologue_sniffer (struct frame_info *next_frame) -{ - return &score_prologue_unwind; -} - static CORE_ADDR -score_prologue_frame_base_address (struct frame_info *next_frame, +score_prologue_frame_base_address (struct frame_info *this_frame, void **this_cache) { struct score_frame_cache *info = - score_make_prologue_cache (next_frame, this_cache); + score_make_prologue_cache (this_frame, this_cache); return info->fp; } @@ -1020,7 +1010,7 @@ static const struct frame_base score_prologue_frame_base = }; static const struct frame_base * -score_prologue_frame_base_sniffer (struct frame_info *next_frame) +score_prologue_frame_base_sniffer (struct frame_info *this_frame) { return &score_prologue_frame_base; } @@ -1063,13 +1053,13 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Dummy frame hooks. */ set_gdbarch_return_value (gdbarch, score_return_value); set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); - set_gdbarch_unwind_dummy_id (gdbarch, score_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, score_dummy_id); set_gdbarch_push_dummy_call (gdbarch, score_push_dummy_call); /* Normal frame hooks. */ - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); + dwarf2_append_unwinders (gdbarch); frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); - frame_unwind_append_sniffer (gdbarch, score_prologue_sniffer); + frame_unwind_append_unwinder (gdbarch, &score_prologue_unwind); frame_base_append_sniffer (gdbarch, score_prologue_frame_base_sniffer); return gdbarch; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 7e49fed..73abdd1 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2512,7 +2512,7 @@ sh_alloc_frame_cache (void) } static struct sh_frame_cache * -sh_frame_cache (struct frame_info *next_frame, void **this_cache) +sh_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sh_frame_cache *cache; CORE_ADDR current_pc; @@ -2529,16 +2529,16 @@ sh_frame_cache (struct frame_info *next_frame, void **this_cache) However, for functions that don't need it, the frame pointer is optional. For these "frameless" functions the frame pointer is actually the frame pointer of the calling frame. */ - cache->base = frame_unwind_register_unsigned (next_frame, FP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, FP_REGNUM); if (cache->base == 0) return cache; - cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME); - current_pc = frame_pc_unwind (next_frame); + cache->pc = get_frame_func (this_frame); + current_pc = get_frame_pc (this_frame); if (cache->pc != 0) { ULONGEST fpscr; - fpscr = frame_unwind_register_unsigned (next_frame, FPSCR_REGNUM); + fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM); sh_analyze_prologue (cache->pc, current_pc, cache, fpscr); } @@ -2551,9 +2551,9 @@ sh_frame_cache (struct frame_info *next_frame, void **this_cache) setup yet. Try to reconstruct the base address for the stack frame by looking at the stack pointer. For truly "frameless" functions this might work too. */ - cache->base = frame_unwind_register_unsigned - (next_frame, - gdbarch_sp_regnum (get_frame_arch (next_frame))); + cache->base = get_frame_register_unsigned + (this_frame, + gdbarch_sp_regnum (get_frame_arch (this_frame))); } /* Now that we have the base address for the stack frame we can @@ -2569,30 +2569,17 @@ sh_frame_cache (struct frame_info *next_frame, void **this_cache) return cache; } -static void -sh_frame_prev_register (struct frame_info *next_frame, void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +sh_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { - struct gdbarch *gdbarch = get_frame_arch (next_frame); - struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache); + struct gdbarch *gdbarch = get_frame_arch (this_frame); + struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache); gdb_assert (regnum >= 0); if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp) - { - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (valuep) - { - /* Store the value. */ - store_unsigned_integer (valuep, 4, cache->saved_sp); - } - return; - } + return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp); /* The PC of the previous frame is stored in the PR register of the current frame. Frob regnum so that we pull the value from @@ -2601,33 +2588,17 @@ sh_frame_prev_register (struct frame_info *next_frame, void **this_cache, regnum = PR_REGNUM; if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1) - { - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = cache->saved_regs[regnum]; - *realnump = -1; - if (valuep) - { - /* Read the value in from memory. */ - read_memory (*addrp, valuep, - register_size (gdbarch, regnum)); - } - return; - } + return frame_unwind_got_memory (this_frame, regnum, + cache->saved_regs[regnum]); - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realnump = regnum; - if (valuep) - frame_unwind_register (next_frame, (*realnump), valuep); + return frame_unwind_got_register (this_frame, regnum, regnum); } static void -sh_frame_this_id (struct frame_info *next_frame, void **this_cache, +sh_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache); + struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache); /* This marks the outermost frame. */ if (cache->base == 0) @@ -2639,15 +2610,11 @@ sh_frame_this_id (struct frame_info *next_frame, void **this_cache, static const struct frame_unwind sh_frame_unwind = { NORMAL_FRAME, sh_frame_this_id, - sh_frame_prev_register + sh_frame_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -sh_frame_sniffer (struct frame_info *next_frame) -{ - return &sh_frame_unwind; -} - static CORE_ADDR sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { @@ -2663,16 +2630,17 @@ sh_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) } static struct frame_id -sh_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (sh_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, + gdbarch_sp_regnum (gdbarch)); + return frame_id_build (sp, get_frame_pc (this_frame)); } static CORE_ADDR -sh_frame_base_address (struct frame_info *next_frame, void **this_cache) +sh_frame_base_address (struct frame_info *this_frame, void **this_cache) { - struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache); + struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache); return cache->base; } @@ -2862,7 +2830,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_align (gdbarch, sh_frame_align); set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp); set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc); - set_gdbarch_unwind_dummy_id (gdbarch, sh_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, sh_dummy_id); frame_base_set_default (gdbarch, &sh_frame_base); set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p); @@ -2973,8 +2941,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, sh_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind); return gdbarch; } diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 6ad32f0..5456be7 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -2263,7 +2263,7 @@ sh64_alloc_frame_cache (void) } static struct sh64_frame_cache * -sh64_frame_cache (struct frame_info *next_frame, void **this_cache) +sh64_frame_cache (struct frame_info *this_frame, void **this_cache) { struct gdbarch *gdbarch; struct sh64_frame_cache *cache; @@ -2273,11 +2273,11 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache) if (*this_cache) return *this_cache; - gdbarch = get_frame_arch (next_frame); + gdbarch = get_frame_arch (this_frame); cache = sh64_alloc_frame_cache (); *this_cache = cache; - current_pc = frame_pc_unwind (next_frame); + current_pc = get_frame_pc (this_frame); cache->media_mode = pc_is_isa32 (current_pc); /* In principle, for normal frames, fp holds the frame pointer, @@ -2285,11 +2285,11 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache) However, for functions that don't need it, the frame pointer is optional. For these "frameless" functions the frame pointer is actually the frame pointer of the calling frame. */ - cache->base = frame_unwind_register_unsigned (next_frame, MEDIA_FP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, MEDIA_FP_REGNUM); if (cache->base == 0) return cache; - cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME); + cache->pc = get_frame_func (this_frame); if (cache->pc != 0) sh64_analyze_prologue (gdbarch, cache, cache->pc, current_pc); @@ -2302,8 +2302,8 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache) setup yet. Try to reconstruct the base address for the stack frame by looking at the stack pointer. For truly "frameless" functions this might work too. */ - cache->base = frame_unwind_register_unsigned - (next_frame, gdbarch_sp_regnum (gdbarch)); + cache->base = get_frame_register_unsigned + (this_frame, gdbarch_sp_regnum (gdbarch)); } /* Now that we have the base address for the stack frame we can @@ -2319,33 +2319,17 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache) return cache; } -static void -sh64_frame_prev_register (struct frame_info *next_frame, void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +sh64_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { - struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache); - struct gdbarch *gdbarch = get_frame_arch (next_frame); + struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache); + struct gdbarch *gdbarch = get_frame_arch (this_frame); gdb_assert (regnum >= 0); if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp) - { - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (valuep) - { - /* Store the value. */ - store_unsigned_integer (valuep, - register_size (gdbarch, - gdbarch_sp_regnum (gdbarch)), - cache->saved_sp); - } - return; - } + frame_unwind_got_constant (this_frame, regnum, cache->saved_sp); /* The PC of the previous frame is stored in the PR register of the current frame. Frob regnum so that we pull the value from @@ -2355,42 +2339,26 @@ sh64_frame_prev_register (struct frame_info *next_frame, void **this_cache, if (regnum < SIM_SH64_NR_REGS && cache->saved_regs[regnum] != -1) { - int reg_size = register_size (gdbarch, regnum); - int size; - - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = cache->saved_regs[regnum]; - *realnump = -1; if (gdbarch_tdep (gdbarch)->sh_abi == SH_ABI_32 && (regnum == MEDIA_FP_REGNUM || regnum == PR_REGNUM)) - size = 4; - else - size = reg_size; - if (valuep) { - memset (valuep, 0, reg_size); - if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) - read_memory (*addrp, valuep, size); - else - read_memory (*addrp, (char *) valuep + reg_size - size, size); + CORE_ADDR val; + val = read_memory_unsigned_integer (cache->saved_regs[regnum], 4); + return frame_unwind_got_constant (this_frame, regnum, val); } - return; + + return frame_unwind_got_memory (this_frame, regnum, + cache->saved_regs[regnum]); } - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realnump = regnum; - if (valuep) - frame_unwind_register (next_frame, (*realnump), valuep); + return frame_unwind_got_register (this_frame, regnum, regnum); } static void -sh64_frame_this_id (struct frame_info *next_frame, void **this_cache, +sh64_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache); + struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache); /* This marks the outermost frame. */ if (cache->base == 0) @@ -2402,15 +2370,11 @@ sh64_frame_this_id (struct frame_info *next_frame, void **this_cache, static const struct frame_unwind sh64_frame_unwind = { NORMAL_FRAME, sh64_frame_this_id, - sh64_frame_prev_register + sh64_frame_prev_register, + NULL, + default_frame_sniffer }; -static const struct frame_unwind * -sh64_frame_sniffer (struct frame_info *next_frame) -{ - return &sh64_frame_unwind; -} - static CORE_ADDR sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { @@ -2426,16 +2390,17 @@ sh64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) } static struct frame_id -sh64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +sh64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (sh64_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, + gdbarch_sp_regnum (gdbarch)); + return frame_id_build (sp, get_frame_pc (this_frame)); } static CORE_ADDR -sh64_frame_base_address (struct frame_info *next_frame, void **this_cache) +sh64_frame_base_address (struct frame_info *this_frame, void **this_cache) { - struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache); + struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache); return cache->base; } @@ -2521,7 +2486,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_align (gdbarch, sh64_frame_align); set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp); set_gdbarch_unwind_pc (gdbarch, sh64_unwind_pc); - set_gdbarch_unwind_dummy_id (gdbarch, sh64_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, sh64_dummy_id); frame_base_set_default (gdbarch, &sh64_frame_base); set_gdbarch_print_registers_info (gdbarch, sh64_print_registers_info); @@ -2532,8 +2497,8 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, sh64_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &sh64_frame_unwind); return gdbarch; } diff --git a/gdb/sparc64fbsd-tdep.c b/gdb/sparc64fbsd-tdep.c index 83694ff..77cb2d9 100644 --- a/gdb/sparc64fbsd-tdep.c +++ b/gdb/sparc64fbsd-tdep.c @@ -90,7 +90,7 @@ sparc64fbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) } static struct sparc_frame_cache * -sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame, +sparc64fbsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; @@ -101,15 +101,15 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame, if (*this_cache) return *this_cache; - cache = sparc_frame_cache (next_frame, this_cache); + cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* The third argument is a pointer to an instance of `ucontext_t', which has a member `uc_mcontext' that contains the saved registers. */ - addr = frame_unwind_register_unsigned (next_frame, SPARC_O2_REGNUM); + addr = get_frame_register_unsigned (this_frame, SPARC_O2_REGNUM); mcontext_addr = addr + 64; /* The following registers travel in the `mc_local' slots of @@ -136,7 +136,7 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame, /* The `local' and `in' registers have been saved in the register save area. */ addr = cache->saved_regs[SPARC_SP_REGNUM].addr; - sp = get_frame_memory_unsigned (next_frame, addr, 8); + sp = get_frame_memory_unsigned (this_frame, addr, 8); for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS; regnum <= SPARC_I7_REGNUM; regnum++, addr += 8) cache->saved_regs[regnum].addr = addr; @@ -147,7 +147,7 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame, #define FPRS_FEF (1 << 2) addr = cache->saved_regs[SPARC64_FPRS_REGNUM].addr; - fprs = get_frame_memory_unsigned (next_frame, addr, 8); + fprs = get_frame_memory_unsigned (this_frame, addr, 8); if (fprs & FPRS_FEF) { for (regnum = SPARC_F0_REGNUM, addr = mcontext_addr + 32 * 8; @@ -163,50 +163,49 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame, } static void -sparc64fbsd_sigtramp_frame_this_id (struct frame_info *next_frame, +sparc64fbsd_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct sparc_frame_cache *cache = - sparc64fbsd_sigtramp_frame_cache (next_frame, this_cache); + sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache); (*this_id) = frame_id_build (cache->base, cache->pc); } -static void -sparc64fbsd_sigtramp_frame_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, - CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +sparc64fbsd_sigtramp_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { struct sparc_frame_cache *cache = - sparc64fbsd_sigtramp_frame_cache (next_frame, this_cache); + sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache); - trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); } -static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind = -{ - SIGTRAMP_FRAME, - sparc64fbsd_sigtramp_frame_this_id, - sparc64fbsd_sigtramp_frame_prev_register -}; - -static const struct frame_unwind * -sparc64fbsd_sigtramp_frame_sniffer (struct frame_info *next_frame) +static int +sparc64fbsd_sigtramp_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); char *name; find_pc_partial_function (pc, &name, NULL, NULL); if (sparc64fbsd_pc_in_sigtramp (pc, name)) - return &sparc64fbsd_sigtramp_frame_unwind; + return 1; - return NULL; + return 0; } + +static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind = +{ + SIGTRAMP_FRAME, + sparc64fbsd_sigtramp_frame_this_id, + sparc64fbsd_sigtramp_frame_prev_register, + NULL, + sparc64fbsd_sigtramp_frame_sniffer +}; static void @@ -222,7 +221,7 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) sparc64fbsd_collect_fpregset); tdep->sizeof_fpregset = 272; - frame_unwind_append_sniffer (gdbarch, sparc64fbsd_sigtramp_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &sparc64fbsd_sigtramp_frame_unwind); sparc64_init_abi (info, gdbarch); diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c index 67b7900..45d52ec 100644 --- a/gdb/sparc64nbsd-tdep.c +++ b/gdb/sparc64nbsd-tdep.c @@ -90,13 +90,13 @@ sparc64nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) struct trad_frame_saved_reg * sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr, - struct frame_info *next_frame) + struct frame_info *this_frame) { struct trad_frame_saved_reg *saved_regs; CORE_ADDR addr, sp; int regnum, delta; - saved_regs = trad_frame_alloc_saved_regs (next_frame); + saved_regs = trad_frame_alloc_saved_regs (this_frame); /* The registers are saved in bits and pieces scattered all over the place. The code below records their location on the assumption @@ -127,7 +127,7 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr, /* The `local' and `in' registers have been saved in the register save area. */ addr = saved_regs[SPARC_SP_REGNUM].addr; - sp = get_frame_memory_unsigned (next_frame, addr, 8); + sp = get_frame_memory_unsigned (this_frame, addr, 8); for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS; regnum <= SPARC_I7_REGNUM; regnum++, addr += 8) saved_regs[regnum].addr = addr; @@ -141,7 +141,7 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr, ULONGEST i7; addr = saved_regs[SPARC_I7_REGNUM].addr; - i7 = get_frame_memory_unsigned (next_frame, addr, 8); + i7 = get_frame_memory_unsigned (this_frame, addr, 8); trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie); } } @@ -152,7 +152,7 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr, } static struct sparc_frame_cache * -sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame, +sparc64nbsd_sigcontext_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; @@ -161,7 +161,7 @@ sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame, if (*this_cache) return *this_cache; - cache = sparc_frame_cache (next_frame, 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 @@ -173,7 +173,7 @@ sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame, /* Since we couldn't find the frame's function, the cache was initialized under the assumption that we're frameless. */ cache->frameless_p = 0; - addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM); if (addr & 1) addr += BIAS; cache->base = addr; @@ -182,59 +182,58 @@ sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame, /* We find the appropriate instance of `struct sigcontext' at a fixed offset in the signal frame. */ addr = cache->base + 128 + 8; - cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame); + cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame); return cache; } static void -sparc64nbsd_sigcontext_frame_this_id (struct frame_info *next_frame, +sparc64nbsd_sigcontext_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct sparc_frame_cache *cache = - sparc64nbsd_sigcontext_frame_cache (next_frame, this_cache); + sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache); (*this_id) = frame_id_build (cache->base, cache->pc); } -static void -sparc64nbsd_sigcontext_frame_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, - CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +sparc64nbsd_sigcontext_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { struct sparc_frame_cache *cache = - sparc64nbsd_sigcontext_frame_cache (next_frame, this_cache); + sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache); - trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); } -static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind = -{ - SIGTRAMP_FRAME, - sparc64nbsd_sigcontext_frame_this_id, - sparc64nbsd_sigcontext_frame_prev_register -}; - -static const struct frame_unwind * -sparc64nbsd_sigtramp_frame_sniffer (struct frame_info *next_frame) +static int +sparc64nbsd_sigtramp_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); char *name; find_pc_partial_function (pc, &name, NULL, NULL); if (sparc64nbsd_pc_in_sigtramp (pc, name)) { if (name == NULL || strncmp (name, "__sigtramp_sigcontext", 21)) - return &sparc64nbsd_sigcontext_frame_unwind; + return 1; } - return NULL; + return 0; } + +static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind = +{ + SIGTRAMP_FRAME, + sparc64nbsd_sigcontext_frame_this_id, + sparc64nbsd_sigcontext_frame_prev_register, + NULL, + sparc64nbsd_sigtramp_frame_sniffer +}; static void @@ -251,7 +250,7 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Make sure we can single-step "new" syscalls. */ tdep->step_trap = sparcnbsd_step_trap; - frame_unwind_append_sniffer (gdbarch, sparc64nbsd_sigtramp_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &sparc64nbsd_sigcontext_frame_unwind); sparc64_init_abi (info, gdbarch); diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c index 55f0d49..9f8a84a 100644 --- a/gdb/sparc64obsd-tdep.c +++ b/gdb/sparc64obsd-tdep.c @@ -121,7 +121,7 @@ sparc64obsd_pc_in_sigtramp (CORE_ADDR pc, char *name) } static struct sparc_frame_cache * -sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache) +sparc64obsd_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR addr; @@ -129,20 +129,20 @@ sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache) if (*this_cache) return *this_cache; - cache = sparc_frame_cache (next_frame, 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 = frame_pc_unwind (next_frame); + 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. */ cache->frameless_p = 0; - addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); + addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM); if (addr & 1) addr += BIAS; cache->base = addr; @@ -151,59 +151,59 @@ sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache) /* 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, next_frame); + cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame); return cache; } static void -sparc64obsd_frame_this_id (struct frame_info *next_frame, void **this_cache, +sparc64obsd_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct sparc_frame_cache *cache = - sparc64obsd_frame_cache (next_frame, this_cache); + sparc64obsd_frame_cache (this_frame, this_cache); (*this_id) = frame_id_build (cache->base, cache->pc); } -static void -sparc64obsd_frame_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +sparc64obsd_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { struct sparc_frame_cache *cache = - sparc64obsd_frame_cache (next_frame, this_cache); + sparc64obsd_frame_cache (this_frame, this_cache); - trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); } -static const struct frame_unwind sparc64obsd_frame_unwind = -{ - SIGTRAMP_FRAME, - sparc64obsd_frame_this_id, - sparc64obsd_frame_prev_register -}; - -static const struct frame_unwind * -sparc64obsd_sigtramp_frame_sniffer (struct frame_info *next_frame) +static int +sparc64obsd_sigtramp_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); char *name; find_pc_partial_function (pc, &name, NULL, NULL); if (sparc64obsd_pc_in_sigtramp (pc, name)) - return &sparc64obsd_frame_unwind; + return 1; - return NULL; + return 0; } + +static const struct frame_unwind sparc64obsd_frame_unwind = +{ + SIGTRAMP_FRAME, + sparc64obsd_frame_this_id, + sparc64obsd_frame_prev_register, + NULL, + sparc64obsd_sigtramp_frame_sniffer +}; /* Kernel debugging support. */ static struct sparc_frame_cache * -sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache) +sparc64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR sp, trapframe_addr; @@ -212,13 +212,13 @@ sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache) if (*this_cache) return *this_cache; - cache = sparc_frame_cache (next_frame, this_cache); + cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); - sp = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + sp = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM); trapframe_addr = sp + BIAS + 176; - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + 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; @@ -232,55 +232,55 @@ sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache) } static void -sparc64obsd_trapframe_this_id (struct frame_info *next_frame, +sparc64obsd_trapframe_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct sparc_frame_cache *cache = - sparc64obsd_trapframe_cache (next_frame, this_cache); + sparc64obsd_trapframe_cache (this_frame, this_cache); (*this_id) = frame_id_build (cache->base, cache->pc); } -static void -sparc64obsd_trapframe_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +sparc64obsd_trapframe_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { struct sparc_frame_cache *cache = - sparc64obsd_trapframe_cache (next_frame, this_cache); + sparc64obsd_trapframe_cache (this_frame, this_cache); - trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); } -static const struct frame_unwind sparc64obsd_trapframe_unwind = -{ - NORMAL_FRAME, - sparc64obsd_trapframe_this_id, - sparc64obsd_trapframe_prev_register -}; - -static const struct frame_unwind * -sparc64obsd_trapframe_sniffer (struct frame_info *next_frame) +static int +sparc64obsd_trapframe_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) { CORE_ADDR pc; ULONGEST pstate; char *name; /* Check whether we are in privileged mode, and bail out if we're not. */ - pstate = frame_unwind_register_unsigned (next_frame, SPARC64_PSTATE_REGNUM); + pstate = get_frame_register_unsigned (this_frame, SPARC64_PSTATE_REGNUM); if ((pstate & SPARC64_PSTATE_PRIV) == 0) - return NULL; + return 0; - pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME); + pc = get_frame_address_in_block (this_frame); find_pc_partial_function (pc, &name, NULL, NULL); if (name && strcmp (name, "Lslowtrap_reenter") == 0) - return &sparc64obsd_trapframe_unwind; + return 1; - return NULL; + return 0; } + +static const struct frame_unwind sparc64obsd_trapframe_unwind = +{ + NORMAL_FRAME, + sparc64obsd_trapframe_this_id, + sparc64obsd_trapframe_prev_register, + NULL, + sparc64obsd_trapframe_sniffer +}; /* Threads support. */ @@ -378,8 +378,8 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Make sure we can single-step "new" syscalls. */ tdep->step_trap = sparcnbsd_step_trap; - frame_unwind_append_sniffer (gdbarch, sparc64obsd_sigtramp_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, sparc64obsd_trapframe_sniffer); + frame_unwind_append_unwinder (gdbarch, &sparc64obsd_frame_unwind); + frame_unwind_append_unwinder (gdbarch, &sparc64obsd_trapframe_unwind); sparc64_init_abi (info, gdbarch); diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 5349329..7fce311 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -812,13 +812,13 @@ v850_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr) } static struct v850_frame_cache * -v850_alloc_frame_cache (struct frame_info *next_frame) +v850_alloc_frame_cache (struct frame_info *this_frame) { struct v850_frame_cache *cache; int i; cache = FRAME_OBSTACK_ZALLOC (struct v850_frame_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* Base address. */ cache->base = 0; @@ -832,7 +832,7 @@ v850_alloc_frame_cache (struct frame_info *next_frame) } static struct v850_frame_cache * -v850_frame_cache (struct frame_info *next_frame, void **this_cache) +v850_frame_cache (struct frame_info *this_frame, void **this_cache) { struct v850_frame_cache *cache; CORE_ADDR current_pc; @@ -841,7 +841,7 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache) if (*this_cache) return *this_cache; - cache = v850_alloc_frame_cache (next_frame); + cache = v850_alloc_frame_cache (this_frame); *this_cache = cache; /* In principle, for normal frames, fp holds the frame pointer, @@ -849,16 +849,16 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache) However, for functions that don't need it, the frame pointer is optional. For these "frameless" functions the frame pointer is actually the frame pointer of the calling frame. */ - cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM); if (cache->base == 0) return cache; - cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME); - current_pc = frame_pc_unwind (next_frame); + cache->pc = get_frame_func (this_frame); + current_pc = get_frame_pc (this_frame); if (cache->pc != 0) { ULONGEST ctbp; - ctbp = frame_unwind_register_unsigned (next_frame, E_CTBP_REGNUM); + ctbp = get_frame_register_unsigned (this_frame, E_CTBP_REGNUM); v850_analyze_prologue (cache->pc, current_pc, cache, ctbp); } @@ -871,7 +871,7 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache) setup yet. Try to reconstruct the base address for the stack frame by looking at the stack pointer. For truly "frameless" functions this might work too. */ - cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM); } /* Now that we have the base address for the stack frame we can @@ -896,25 +896,22 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache) } -static void -v850_frame_prev_register (struct frame_info *next_frame, void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +v850_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { - struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache); + struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache); gdb_assert (regnum >= 0); - trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); } static void -v850_frame_this_id (struct frame_info *next_frame, void **this_cache, +v850_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache); + struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache); /* This marks the outermost frame. */ if (cache->base == 0) @@ -926,14 +923,10 @@ v850_frame_this_id (struct frame_info *next_frame, void **this_cache, static const struct frame_unwind v850_frame_unwind = { NORMAL_FRAME, v850_frame_this_id, - v850_frame_prev_register + v850_frame_prev_register, + NULL, + default_frame_sniffer }; - -static const struct frame_unwind * -v850_frame_sniffer (struct frame_info *next_frame) -{ - return &v850_frame_unwind; -} static CORE_ADDR v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) @@ -950,16 +943,17 @@ v850_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) } static struct frame_id -v850_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (v850_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, + gdbarch_sp_regnum (gdbarch)); + return frame_id_build (sp, get_frame_pc (this_frame)); } static CORE_ADDR -v850_frame_base_address (struct frame_info *next_frame, void **this_cache) +v850_frame_base_address (struct frame_info *this_frame, void **this_cache) { - struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache); + struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache); return cache->base; } @@ -1026,14 +1020,14 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_align (gdbarch, v850_frame_align); set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp); set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc); - set_gdbarch_unwind_dummy_id (gdbarch, v850_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, v850_dummy_id); frame_base_set_default (gdbarch, &v850_frame_base); /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, v850_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &v850_frame_unwind); return gdbarch; } diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 4daf95d..618befa 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -191,12 +191,12 @@ vax_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } static struct frame_id -vax_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +vax_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { CORE_ADDR fp; - fp = frame_unwind_register_unsigned (next_frame, VAX_FP_REGNUM); - return frame_id_build (fp, frame_pc_unwind (next_frame)); + fp = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM); + return frame_id_build (fp, get_frame_pc (this_frame)); } @@ -311,7 +311,7 @@ struct vax_frame_cache }; struct vax_frame_cache * -vax_frame_cache (struct frame_info *next_frame, void **this_cache) +vax_frame_cache (struct frame_info *this_frame, void **this_cache) { struct vax_frame_cache *cache; CORE_ADDR addr; @@ -323,16 +323,16 @@ vax_frame_cache (struct frame_info *next_frame, void **this_cache) /* Allocate a new cache. */ cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* The frame pointer is used as the base for the frame. */ - cache->base = frame_unwind_register_unsigned (next_frame, VAX_FP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM); if (cache->base == 0) return cache; /* The register save mask and control bits determine the layout of the stack frame. */ - mask = get_frame_memory_unsigned (next_frame, cache->base + 4, 4) >> 16; + mask = get_frame_memory_unsigned (this_frame, cache->base + 4, 4) >> 16; /* These are always saved. */ cache->saved_regs[VAX_PC_REGNUM].addr = cache->base + 16; @@ -362,7 +362,7 @@ vax_frame_cache (struct frame_info *next_frame, void **this_cache) stack address for the arguments that were pushed onto the stack. The return instruction will automatically pop the arguments from the stack. */ - numarg = get_frame_memory_unsigned (next_frame, addr, 1); + numarg = get_frame_memory_unsigned (this_frame, addr, 1); addr += 4 + numarg * 4; } @@ -373,57 +373,49 @@ vax_frame_cache (struct frame_info *next_frame, void **this_cache) } static void -vax_frame_this_id (struct frame_info *next_frame, void **this_cache, +vax_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache); + struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); /* This marks the outermost frame. */ if (cache->base == 0) return; - (*this_id) = frame_id_build (cache->base, - frame_func_unwind (next_frame, NORMAL_FRAME)); + (*this_id) = frame_id_build (cache->base, get_frame_func (this_frame)); } -static void -vax_frame_prev_register (struct frame_info *next_frame, void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +vax_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { - struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache); + struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); - trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); } static const struct frame_unwind vax_frame_unwind = { NORMAL_FRAME, vax_frame_this_id, - vax_frame_prev_register + vax_frame_prev_register, + NULL, + default_frame_sniffer }; - -static const struct frame_unwind * -vax_frame_sniffer (struct frame_info *next_frame) -{ - return &vax_frame_unwind; -} static CORE_ADDR -vax_frame_base_address (struct frame_info *next_frame, void **this_cache) +vax_frame_base_address (struct frame_info *this_frame, void **this_cache) { - struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache); + struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache); return cache->base; } static CORE_ADDR -vax_frame_args_address (struct frame_info *next_frame, void **this_cache) +vax_frame_args_address (struct frame_info *this_frame, void **this_cache) { - return frame_unwind_register_unsigned (next_frame, VAX_AP_REGNUM); + return get_frame_register_unsigned (this_frame, VAX_AP_REGNUM); } static const struct frame_base vax_frame_base = @@ -505,7 +497,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Call dummy code. */ set_gdbarch_push_dummy_call (gdbarch, vax_push_dummy_call); - set_gdbarch_unwind_dummy_id (gdbarch, vax_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, vax_dummy_id); /* Breakpoint info */ set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc); @@ -523,7 +515,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); - frame_unwind_append_sniffer (gdbarch, vax_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &vax_frame_unwind); return (gdbarch); } diff --git a/gdb/vaxobsd-tdep.c b/gdb/vaxobsd-tdep.c index 843982c..ed8acf6 100644 --- a/gdb/vaxobsd-tdep.c +++ b/gdb/vaxobsd-tdep.c @@ -57,9 +57,11 @@ static const gdb_byte vaxobsd_sigreturn[] = { }; static int -vaxobsd_sigtramp_p (struct frame_info *next_frame) +vaxobsd_sigtramp_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) { - CORE_ADDR pc = frame_pc_unwind (next_frame); + CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1)); CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset; gdb_byte *buf; @@ -70,7 +72,7 @@ vaxobsd_sigtramp_p (struct frame_info *next_frame) return 0; buf = alloca(sizeof vaxobsd_sigreturn); - if (!safe_frame_unwind_memory (next_frame, sigreturn_addr, + if (!safe_frame_unwind_memory (this_frame, sigreturn_addr, buf, sizeof vaxobsd_sigreturn)) return 0; @@ -81,7 +83,7 @@ vaxobsd_sigtramp_p (struct frame_info *next_frame) } static struct trad_frame_cache * -vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) +vaxobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) { struct trad_frame_cache *cache; CORE_ADDR addr, base, func; @@ -89,14 +91,14 @@ vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) if (*this_cache) return *this_cache; - cache = trad_frame_cache_zalloc (next_frame); + cache = trad_frame_cache_zalloc (this_frame); *this_cache = cache; - func = frame_pc_unwind (next_frame); + func = get_frame_pc (this_frame); func &= ~(vaxobsd_page_size - 1); - base = frame_unwind_register_unsigned (next_frame, VAX_SP_REGNUM); - addr = get_frame_memory_unsigned (next_frame, base - 4, 4); + 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); @@ -111,43 +113,32 @@ vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) } static void -vaxobsd_sigtramp_frame_this_id (struct frame_info *next_frame, +vaxobsd_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { struct trad_frame_cache *cache = - vaxobsd_sigtramp_frame_cache (next_frame, this_cache); + vaxobsd_sigtramp_frame_cache (this_frame, this_cache); trad_frame_get_id (cache, this_id); } -static void -vaxobsd_sigtramp_frame_prev_register (struct frame_info *next_frame, - void **this_cache, int regnum, - int *optimizedp, enum lval_type *lvalp, - CORE_ADDR *addrp, int *realnump, - gdb_byte *valuep) +static struct value * +vaxobsd_sigtramp_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { struct trad_frame_cache *cache = - vaxobsd_sigtramp_frame_cache (next_frame, this_cache); + vaxobsd_sigtramp_frame_cache (this_frame, this_cache); - trad_frame_get_register (cache, next_frame, regnum, - optimizedp, lvalp, addrp, realnump, valuep); + return trad_frame_get_register (cache, this_frame, regnum); } static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = { SIGTRAMP_FRAME, vaxobsd_sigtramp_frame_this_id, - vaxobsd_sigtramp_frame_prev_register + vaxobsd_sigtramp_frame_prev_register, + NULL, + vaxobsd_sigtramp_sniffer }; - -static const struct frame_unwind * -vaxobsd_sigtramp_frame_sniffer (struct frame_info *next_frame) -{ - if (vaxobsd_sigtramp_p (next_frame)) - return &vaxobsd_sigtramp_frame_unwind; - - return NULL; -} /* OpenBSD a.out. */ @@ -155,7 +146,7 @@ vaxobsd_sigtramp_frame_sniffer (struct frame_info *next_frame) static void vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { - frame_unwind_append_sniffer (gdbarch, vaxobsd_sigtramp_frame_sniffer); + frame_unwind_append_unwinder (gdbarch, &vaxobsd_sigtramp_frame_unwind); } /* FIXME: kettenis/20050821: Since OpenBSD/vax binaries are diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index adc2f21..eac5efd 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -311,7 +311,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch, static CORE_ADDR xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, struct xstormy16_frame_cache *cache, - struct frame_info *next_frame) + struct frame_info *this_frame) { CORE_ADDR next_addr; ULONGEST inst, inst2; @@ -638,7 +638,7 @@ xstormy16_alloc_frame_cache (void) } static struct xstormy16_frame_cache * -xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache) +xstormy16_frame_cache (struct frame_info *this_frame, void **this_cache) { struct xstormy16_frame_cache *cache; CORE_ADDR current_pc; @@ -650,17 +650,17 @@ xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache) cache = xstormy16_alloc_frame_cache (); *this_cache = cache; - cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM); if (cache->base == 0) return cache; - cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME); - current_pc = frame_pc_unwind (next_frame); + cache->pc = get_frame_func (this_frame); + current_pc = get_frame_pc (this_frame); if (cache->pc) - xstormy16_analyze_prologue (cache->pc, current_pc, cache, next_frame); + xstormy16_analyze_prologue (cache->pc, current_pc, cache, this_frame); if (!cache->uses_fp) - cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM); + cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM); cache->saved_sp = cache->base - cache->framesize; @@ -671,59 +671,29 @@ xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache) return cache; } -static void -xstormy16_frame_prev_register (struct frame_info *next_frame, - void **this_cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, gdb_byte *valuep) +static struct value * +xstormy16_frame_prev_register (struct frame_info *this_frame, + void **this_cache, int regnum) { - struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame, + struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame, this_cache); gdb_assert (regnum >= 0); if (regnum == E_SP_REGNUM && cache->saved_sp) - { - *optimizedp = 0; - *lvalp = not_lval; - *addrp = 0; - *realnump = -1; - if (valuep) - { - /* Store the value. */ - store_unsigned_integer (valuep, xstormy16_reg_size, cache->saved_sp); - } - return; - } + return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp); if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != REG_UNAVAIL) - { - *optimizedp = 0; - *lvalp = lval_memory; - *addrp = cache->saved_regs[regnum]; - *realnump = -1; - if (valuep) - { - /* Read the value in from memory. */ - read_memory (*addrp, valuep, - register_size (get_frame_arch (next_frame), regnum)); - } - return; - } + return frame_unwind_got_memory (this_frame, regnum, + cache->saved_regs[regnum]); - *optimizedp = 0; - *lvalp = lval_register; - *addrp = 0; - *realnump = regnum; - if (valuep) - frame_unwind_register (next_frame, (*realnump), valuep); + return frame_unwind_got_register (this_frame, regnum, regnum); } static void -xstormy16_frame_this_id (struct frame_info *next_frame, void **this_cache, +xstormy16_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame, + struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame, this_cache); /* This marks the outermost frame. */ @@ -734,9 +704,9 @@ xstormy16_frame_this_id (struct frame_info *next_frame, void **this_cache, } static CORE_ADDR -xstormy16_frame_base_address (struct frame_info *next_frame, void **this_cache) +xstormy16_frame_base_address (struct frame_info *this_frame, void **this_cache) { - struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame, + struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame, this_cache); return cache->base; } @@ -744,7 +714,9 @@ xstormy16_frame_base_address (struct frame_info *next_frame, void **this_cache) static const struct frame_unwind xstormy16_frame_unwind = { NORMAL_FRAME, xstormy16_frame_this_id, - xstormy16_frame_prev_register + xstormy16_frame_prev_register, + NULL, + default_frame_sniffer }; static const struct frame_base xstormy16_frame_base = { @@ -754,12 +726,6 @@ static const struct frame_base xstormy16_frame_base = { xstormy16_frame_base_address }; -static const struct frame_unwind * -xstormy16_frame_sniffer (struct frame_info *next_frame) -{ - return &xstormy16_frame_unwind; -} - static CORE_ADDR xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { @@ -773,11 +739,10 @@ xstormy16_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) } static struct frame_id -xstormy16_unwind_dummy_id (struct gdbarch *gdbarch, - struct frame_info *next_frame) +xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { - return frame_id_build (xstormy16_unwind_sp (gdbarch, next_frame), - frame_pc_unwind (next_frame)); + CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM); + return frame_id_build (sp, get_frame_pc (this_frame)); } @@ -832,7 +797,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) */ set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp); set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc); - set_gdbarch_unwind_dummy_id (gdbarch, xstormy16_unwind_dummy_id); + set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id); set_gdbarch_frame_align (gdbarch, xstormy16_frame_align); frame_base_set_default (gdbarch, &xstormy16_frame_base); @@ -851,8 +816,8 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) gdbarch_init_osabi (info, gdbarch); - frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); - frame_unwind_append_sniffer (gdbarch, xstormy16_frame_sniffer); + dwarf2_append_unwinders (gdbarch); + frame_unwind_append_unwinder (gdbarch, &xstormy16_frame_unwind); return gdbarch; } |