summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2005-12-06 20:59:55 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2005-12-06 20:59:55 +0000
commitd76aa760dd3cae9c6c3af03019a95b1439d0fce9 (patch)
tree586cef9eefe0d875c3b2c1c0fd02e7740352dbc2
parent385bd9026d6eca64c9cfbe55971afeec6e8b14aa (diff)
Try to prevent infinite backtraces.
-rw-r--r--gnu/usr.bin/binutils/gdb/frame.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils/gdb/frame.c b/gnu/usr.bin/binutils/gdb/frame.c
index 0d0e2c9094d..7c92d55261e 100644
--- a/gnu/usr.bin/binutils/gdb/frame.c
+++ b/gnu/usr.bin/binutils/gdb/frame.c
@@ -1235,6 +1235,18 @@ 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);
}