summaryrefslogtreecommitdiff
path: root/gdb/frame-unwind.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-03-21 22:28:52 +0000
committerAndrew Cagney <cagney@redhat.com>2004-03-21 22:28:52 +0000
commit3d0e5d44322383b9989cbaaa8c8f644ffeffbbd3 (patch)
treee02e71c97cbc54a8be6bd19a4ec1f44838feeb9a /gdb/frame-unwind.c
parent4c73f0a0679827d838a68c7db3c55cb5542396ee (diff)
downloadgdb-3d0e5d44322383b9989cbaaa8c8f644ffeffbbd3.tar.gz
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.c31
1 files changed, 26 insertions, 5 deletions
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;
}