aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-11-22 13:46:51 +0000
committerPedro Alves <palves@redhat.com>2013-11-22 13:46:51 +0000
commit8ad6489081e0685755f03779fb26463b83add34c (patch)
treed09f74abd60c79cb5f7cde5353df25f27d8ca2d5 /gdb/frame.c
parentc8381c86b4d54d2362ebcdcdd88c352aa62c207a (diff)
downloadfsf-binutils-gdb-8ad6489081e0685755f03779fb26463b83add34c.zip
fsf-binutils-gdb-8ad6489081e0685755f03779fb26463b83add34c.tar.gz
fsf-binutils-gdb-8ad6489081e0685755f03779fb26463b83add34c.tar.bz2
Revert "Don't let two frames with the same id end up in the frame chain."
This reverts commit be2c48b4d50b992ba83bc51f086e316621a03a14.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index 535a5a6..63f20d5 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1666,7 +1666,6 @@ get_prev_frame_1 (struct frame_info *this_frame)
{
struct frame_id this_id;
struct gdbarch *gdbarch;
- struct frame_info *prev_frame;
gdb_assert (this_frame != NULL);
gdbarch = get_frame_arch (this_frame);
@@ -1768,6 +1767,22 @@ get_prev_frame_1 (struct frame_info *this_frame)
}
}
+ /* Check that this and the next frame are not identical. If they
+ are, there is most likely a stack cycle. As with the inner-than
+ test above, avoid comparing the inner-most and sentinel frames. */
+ if (this_frame->level > 0
+ && frame_id_eq (this_id, get_frame_id (this_frame->next)))
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // this frame has same ID }\n");
+ }
+ this_frame->stop_reason = UNWIND_SAME_ID;
+ return NULL;
+ }
+
/* Check that this and the next frame do not unwind the PC register
to the same memory location. If they do, then even though they
have different frame IDs, the new frame will be bogus; two
@@ -1815,31 +1830,7 @@ get_prev_frame_1 (struct frame_info *this_frame)
}
}
- prev_frame = get_prev_frame_raw (this_frame);
-
- /* Check that this and the prev frame are not identical. If they
- are, there is most likely a stack cycle. Unlike the tests above,
- we do this right after creating the prev frame, to avoid ever
- ending up with two frames with the same id in the frame
- chain. */
- if (prev_frame != NULL
- && frame_id_eq (get_frame_id (prev_frame),
- get_frame_id (this_frame)))
- {
- if (frame_debug)
- {
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, NULL);
- fprintf_unfiltered (gdb_stdlog, " // this frame has same ID }\n");
- }
- this_frame->stop_reason = UNWIND_SAME_ID;
- /* Unlink. */
- prev_frame->next = NULL;
- this_frame->prev = NULL;
- return NULL;
- }
-
- return prev_frame;
+ return get_prev_frame_raw (this_frame);
}
/* Construct a new "struct frame_info" and link it previous to