This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] Infinite backtraces...
How about something like this to prevent infinite unwindings from pc==0
frames?
(note for reviewers: the stub frame unwinder is selected for frames
where pc == 0)
randolph
2004-12-05 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_stub_Frame_unwind_cache): Stop unwinding if
unwinding from a frame with pc == 0.
(hppa_stub_frame_this_id): Likewise.
(hppa_stub_frame_prev_register): Only provide real values if the frame
cache is not NULL.
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.185
diff -u -p -r1.185 hppa-tdep.c
--- hppa-tdep.c 6 Dec 2004 03:32:26 -0000 1.185
+++ hppa-tdep.c 6 Dec 2004 07:11:29 -0000
@@ -2111,10 +2115,13 @@ hppa_stub_frame_unwind_cache (struct fra
struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct hppa_stub_unwind_cache *info;
struct unwind_table_entry *u;
if (*this_cache)
return *this_cache;
+ if (frame_pc_unwind (next_frame) == 0)
+ return NULL;
+
info = FRAME_OBSTACK_ZALLOC (struct hppa_stub_unwind_cache);
*this_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
@@ -2149,7 +2164,11 @@ hppa_stub_frame_this_id (struct frame_in
{
struct hppa_stub_unwind_cache *info
= hppa_stub_frame_unwind_cache (next_frame, this_prologue_cache);
- *this_id = frame_id_build (info->base, frame_pc_unwind (next_frame));
+
+ if (info)
+ *this_id = frame_id_build (info->base, frame_pc_unwind (next_frame));
+ else
+ *this_id = null_frame_id;
}
static void
@@ -2161,8 +2180,11 @@ hppa_stub_frame_prev_register (struct fr
{
struct hppa_stub_unwind_cache *info
= hppa_stub_frame_unwind_cache (next_frame, this_prologue_cache);
- hppa_frame_prev_register_helper (next_frame, info->saved_regs, regnum,
- optimizedp, lvalp, addrp, realnump, valuep);
+
+ if (info)
+ hppa_frame_prev_register_helper (next_frame, info->saved_regs, regnum,
+ optimizedp, lvalp, addrp, realnump,
+ valuep);
}
static const struct frame_unwind hppa_stub_frame_unwind = {