From 82417da5f06061d684c325816bdb1b1f0075fbc4 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 21 Mar 2004 22:28:52 +0000 Subject: 2004-03-21 Andrew Cagney * frame-unwind.h: Update copyright. (struct frame_data): Add opaque declaration. (frame_sniffer_ftype): Declare. (struct frame_unwind): Add "unwind_data" and "sniffer". (frame_unwind_register_unwinder): Declare. (frame_unwind_find_by_frame): Add parameter "this_cache". * frame.c (get_frame_id, create_new_frame, legacy_get_prev_frame) (legacy_get_prev_frame, legacy_get_prev_frame) (get_frame_type): Pass the prologue_cache to frame_unwind_find_by_frame. * frame-unwind.c (struct frame_unwind_table_entry): Add field "unwinder". (frame_unwind_register_unwinder): New function. (frame_unwind_find_by_frame): Handle an unwind sniffer. --- gdb/frame-unwind.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'gdb/frame-unwind.c') diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index 1d340912dac..cacb2ed4160 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -31,6 +31,7 @@ static struct gdbarch_data *frame_unwind_data; struct frame_unwind_table_entry { frame_unwind_sniffer_ftype *sniffer; + const struct frame_unwind *unwinder; struct frame_unwind_table_entry *next; }; @@ -61,8 +62,19 @@ frame_unwind_append_sniffer (struct gdbarch *gdbarch, table->tail = &((*table->tail)->next); } +void +frame_unwind_register_unwinder (struct gdbarch *gdbarch, + const struct frame_unwind *unwinder) +{ + struct frame_unwind_table *table = gdbarch_data (gdbarch, frame_unwind_data); + (*table->tail) = GDBARCH_OBSTACK_ZALLOC (gdbarch, + struct frame_unwind_table_entry); + (*table->tail)->unwinder = unwinder; + table->tail = &((*table->tail)->next); +} + const struct frame_unwind * -frame_unwind_find_by_frame (struct frame_info *next_frame) +frame_unwind_find_by_frame (struct frame_info *next_frame, void **this_cache) { int i; struct gdbarch *gdbarch = get_frame_arch (next_frame); @@ -76,10 +88,19 @@ frame_unwind_find_by_frame (struct frame_info *next_frame) return legacy_saved_regs_unwind; for (entry = table->head; entry != NULL; entry = entry->next) { - const struct frame_unwind *desc; - desc = entry->sniffer (next_frame); - if (desc != NULL) - return desc; + if (entry->sniffer != NULL) + { + const struct frame_unwind *desc = NULL; + desc = entry->sniffer (next_frame); + if (desc != NULL) + return desc; + } + if (entry->unwinder != NULL) + { + if (entry->unwinder->sniffer (entry->unwinder, next_frame, + this_cache)) + return entry->unwinder; + } } return legacy_saved_regs_unwind; } -- cgit v1.2.1