2004-02-20 Andrew Cagney * frame.c (get_prev_frame): With the exception of the inner-most frame, do not backtrace past a frame with a zero pc. Index: frame.c =================================================================== RCS file: /cvs/src/src/gdb/frame.c,v retrieving revision 1.162 diff -u -r1.162 frame.c --- frame.c 16 Feb 2004 21:49:21 -0000 1.162 +++ frame.c 20 Feb 2004 21:12:52 -0000 @@ -1721,14 +1721,9 @@ return prev; } -/* Return a structure containing various interesting information - about the frame that called THIS_FRAME. Returns NULL - if there is no such frame. - - This function tests some target-independent conditions that should - terminate the frame chain, such as unwinding past main(). It - should not contain any target-dependent tests, such as checking - whether the program-counter is zero. */ +/* Return a structure containing various interesting information about + the frame that called THIS_FRAME. Returns NULL if there is no such + frame. */ struct frame_info * get_prev_frame (struct frame_info *this_frame) @@ -1843,6 +1838,24 @@ fprint_frame (gdb_stdlog, NULL); fprintf_unfiltered (gdb_stdlog, "// inside entry func }\n"); } + return NULL; + } + + /* Don't allow frames with a zero PC to unwind. The exception is + the inner-most frame - a jump through a NULL pointer results in + an inner most frame that is both unwindable and has a zero + PC. */ + /* NOTE: cagney/2004-02-20: The old zero PC check, removed + 2004-01-11, had the problem that it stopped backtraces from that + inner most zero PCed frame. */ + if (this_frame->level > 0 && get_frame_pc (this_frame) == 0) + { + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, " // PC zero }\n"); + } return NULL; }