diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-03-21 22:28:52 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-03-21 22:28:52 +0000 |
commit | 82417da5f06061d684c325816bdb1b1f0075fbc4 (patch) | |
tree | 959630fbbe0e4a12aef2fc4165cb44f9e862af71 /gdb/frame-unwind.c | |
parent | e5fbc737f638ac7154ce0ad79e165af82ca03f9e (diff) | |
download | gdb-82417da5f06061d684c325816bdb1b1f0075fbc4.zip gdb-82417da5f06061d684c325816bdb1b1f0075fbc4.tar.gz gdb-82417da5f06061d684c325816bdb1b1f0075fbc4.tar.bz2 |
2004-03-21 Andrew Cagney <cagney@redhat.com>
* 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.
Diffstat (limited to 'gdb/frame-unwind.c')
-rw-r--r-- | gdb/frame-unwind.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index 1d34091..cacb2ed 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; } |