From 38ef4f233f7c97ab49ff2127177d3824d3823a22 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 10 May 2006 18:34:29 +0000 Subject: [PATCH] * gdb/frame.c (get_prev_frame): Move check for pc == 0 ... (get_prev_frame_1): ... to here. --- ChangeLog.csl | 5 +++++ gdb/frame.c | 32 ++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog.csl b/ChangeLog.csl index 04f61f2f11a..5cf4205ac0d 100644 --- a/ChangeLog.csl +++ b/ChangeLog.csl @@ -1,3 +1,8 @@ +2006-05-10 Daniel Jacobowitz + + * gdb/frame.c (get_prev_frame): Move check for pc == 0 ... + (get_prev_frame_1): ... to here. + 2006-05-09 Daniel Jacobowitz * gdb/bsd-uthread.c (bsd_uthread_solib_loaded): Always pass 0 for diff --git a/gdb/frame.c b/gdb/frame.c index 80814fbf35e..0f737741ce5 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1133,6 +1133,26 @@ get_prev_frame_1 (struct frame_info *this_frame) this_frame->prev = prev_frame; prev_frame->next = this_frame; + /* Now that the frame chain is in a consistant state, check whether + this frame is useful. If it is not, unlink it. Its storage will + be reclaimed the next time the frame cache is flushed, and we + will not try to unwind THIS_FRAME again. */ + + /* Assume that the only way to get a zero PC is through something + like a SIGSEGV or a dummy frame, and hence that NORMAL frames + will never unwind a zero PC. This will look up the unwinder + for the newly created frame, to determine its type. */ + if (prev_frame->level > 0 + && get_frame_type (prev_frame) == NORMAL_FRAME + && get_frame_type (this_frame) == NORMAL_FRAME + && get_frame_pc (prev_frame) == 0) + { + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, "-> // zero PC}\n"); + this_frame->prev = NULL; + return NULL; + } + if (frame_debug) { fprintf_unfiltered (gdb_stdlog, "-> "); @@ -1310,18 +1330,6 @@ get_prev_frame (struct frame_info *this_frame) return NULL; } - /* Assume that the only way to get a zero PC is through something - like a SIGSEGV or a dummy frame, and hence that NORMAL frames - will never unwind a zero PC. */ - if (this_frame->level > 0 - && get_frame_type (this_frame) == NORMAL_FRAME - && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME - && get_frame_pc (this_frame) == 0) - { - frame_debug_got_null_frame (gdb_stdlog, this_frame, "zero PC"); - return NULL; - } - return get_prev_frame_1 (this_frame); } -- 2.47.2