diff options
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/s390-tdep.c | 68 |
2 files changed, 54 insertions, 30 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3121b17..dcffe70 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2004-03-22 Andrew Cagney <cagney@redhat.com> + + * s390-tdep.c (struct s390_stub_unwind_cache): Rename + s390_pltstub_unwind_cache. + (s390_stub_frame_unwind_cache): Rename + s390_pltstub_frame_unwind_cache. + (s390_stub_frame_this_id): Rename s390_pltstub_frame_this_id. + (s390_stub_frame_prev_register): Rename + s390_pltstub_frame_prev_register. + (s390_stub_frame_unwind): Rename s390_pltstub_frame_unwind. + (s390_stub_frame_sniffer): Rename s390_stub_frame_sniffer. + + From Ulrich Weigand: + * s390-tdep.c (s390_pltstub_frame_sniffer): Handle invalid function + pointer calls like PLT calls. + 2004-03-22 Daniel Jacobowitz <drow@mvista.com> * mips-tdep.c (non_heuristic_proc_desc): Search using the specified diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 7e3463e..0f8f65d 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -2037,27 +2037,29 @@ s390_frame_sniffer (struct frame_info *next_frame) } -/* PLT stub stack frames. */ - -struct s390_pltstub_unwind_cache { +/* Code stubs and their stack frames. For things like PLTs and NULL + function calls (where there is no true frame and the return address + is in the RETADDR register). */ +struct s390_stub_unwind_cache +{ CORE_ADDR frame_base; struct trad_frame_saved_reg *saved_regs; }; -static struct s390_pltstub_unwind_cache * -s390_pltstub_frame_unwind_cache (struct frame_info *next_frame, - void **this_prologue_cache) +static struct s390_stub_unwind_cache * +s390_stub_frame_unwind_cache (struct frame_info *next_frame, + void **this_prologue_cache) { struct gdbarch *gdbarch = get_frame_arch (next_frame); int word_size = gdbarch_ptr_bit (gdbarch) / 8; - struct s390_pltstub_unwind_cache *info; + struct s390_stub_unwind_cache *info; ULONGEST reg; if (*this_prologue_cache) return *this_prologue_cache; - info = FRAME_OBSTACK_ZALLOC (struct s390_pltstub_unwind_cache); + info = FRAME_OBSTACK_ZALLOC (struct s390_stub_unwind_cache); *this_prologue_cache = info; info->saved_regs = trad_frame_alloc_saved_regs (next_frame); @@ -2072,41 +2074,47 @@ s390_pltstub_frame_unwind_cache (struct frame_info *next_frame, } static void -s390_pltstub_frame_this_id (struct frame_info *next_frame, - void **this_prologue_cache, - struct frame_id *this_id) +s390_stub_frame_this_id (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *this_id) { - struct s390_pltstub_unwind_cache *info - = s390_pltstub_frame_unwind_cache (next_frame, this_prologue_cache); + struct s390_stub_unwind_cache *info + = s390_stub_frame_unwind_cache (next_frame, this_prologue_cache); *this_id = frame_id_build (info->frame_base, frame_pc_unwind (next_frame)); } static void -s390_pltstub_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, void *bufferp) -{ - struct s390_pltstub_unwind_cache *info - = s390_pltstub_frame_unwind_cache (next_frame, this_prologue_cache); +s390_stub_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, void *bufferp) +{ + struct s390_stub_unwind_cache *info + = s390_stub_frame_unwind_cache (next_frame, this_prologue_cache); trad_frame_prev_register (next_frame, info->saved_regs, regnum, optimizedp, lvalp, addrp, realnump, bufferp); } -static const struct frame_unwind s390_pltstub_frame_unwind = { +static const struct frame_unwind s390_stub_frame_unwind = { NORMAL_FRAME, - s390_pltstub_frame_this_id, - s390_pltstub_frame_prev_register + s390_stub_frame_this_id, + s390_stub_frame_prev_register }; static const struct frame_unwind * -s390_pltstub_frame_sniffer (struct frame_info *next_frame) +s390_stub_frame_sniffer (struct frame_info *next_frame) { - if (!in_plt_section (frame_pc_unwind (next_frame), NULL)) - return NULL; - - return &s390_pltstub_frame_unwind; + CORE_ADDR pc = frame_pc_unwind (next_frame); + bfd_byte insn[S390_MAX_INSTR_SIZE]; + + /* If the current PC points to non-readable memory, we assume we + have trapped due to an invalid function pointer call. We handle + the non-existing current function like a PLT stub. */ + if (in_plt_section (pc, NULL) + || s390_readinstruction (insn, pc) < 0) + return &s390_stub_frame_unwind; + return NULL; } @@ -3028,7 +3036,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) dwarf2_frame_set_init_reg (gdbarch, s390_dwarf2_frame_init_reg); frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); - frame_unwind_append_sniffer (gdbarch, s390_pltstub_frame_sniffer); + frame_unwind_append_sniffer (gdbarch, s390_stub_frame_sniffer); frame_unwind_append_sniffer (gdbarch, s390_sigtramp_frame_sniffer); frame_unwind_append_sniffer (gdbarch, s390_frame_sniffer); frame_base_set_default (gdbarch, &s390_frame_base); |