aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-04-10 22:14:02 +0000
committerAndrew Cagney <cagney@redhat.com>2002-04-10 22:14:02 +0000
commit7cc19214aa83761f61b42a8eed01732d39495972 (patch)
tree6855c224bd10e273e3742910687fe47f7624c0d8 /gdb/stack.c
parent67a2b77effae04a5f6c050fd191149c26deb8a82 (diff)
downloadfsf-binutils-gdb-7cc19214aa83761f61b42a8eed01732d39495972.zip
fsf-binutils-gdb-7cc19214aa83761f61b42a8eed01732d39495972.tar.gz
fsf-binutils-gdb-7cc19214aa83761f61b42a8eed01732d39495972.tar.bz2
* stack.c (select_frame): Check that selected_frame and the
specified level are as expected. * blockframe.c (get_prev_frame): Set the `level' from next_frame. Update copyright. * frame.h (struct frame_info): Add field `level'. Update copyright. Work-in-progress PR gdb/464.
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index bedb6ee..a348934 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1458,6 +1458,38 @@ select_frame (struct frame_info *fi, int level)
selected_frame = fi;
selected_frame_level = level;
+ /* FIXME: cagney/2002-04-05: It can't be this easy (and looking at
+ the increasingly complex list of checkes, it wasn't)! GDB is
+ dragging around, and constantly updating, the global variable
+ selected_frame_level. Surely all that was needed was for the
+ level to be computed direct from the frame (by counting back to
+ the inner-most frame) or, as has been done here using a cached
+ value. For moment, check that the expected and the actual level
+ are consistent. If, after a few weeks, no one reports that this
+ assertion has failed, the global selected_frame_level and many
+ many parameters can all be deleted. */
+ if (fi == NULL && level == -1)
+ /* Ok. The target is clearing the selected frame as part of a
+ cache flush. */
+ ;
+ else if (fi != NULL && fi->level == level)
+ /* Ok. What you would expect. Level is redundant. */
+ ;
+ else if (fi != NULL && level == -1)
+ /* Ok. See breakpoint.c. The watchpoint code changes the
+ selected frame to the frame that contains the watchpoint and
+ then, later changes it back to the old value. The -1 is used
+ as a marker so that the watchpoint code can easily detect that
+ things are not what they should be. Why the watchpoint code
+ can't mindlessly save/restore the selected frame I don't know,
+ hopefully it can be simplified that way. Hopefully the global
+ selected_frame can be replaced by a frame parameter, making
+ still more simplification possible. */
+ ;
+ else
+ internal_error (__FILE__, __LINE__,
+ "oops! fi=0x%p, fi->level=%d, level=%d",
+ fi, fi ? fi->level : -1, level);
if (selected_frame_level_changed_hook)
selected_frame_level_changed_hook (level);