aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-06-10 23:25:50 +0000
committerAndrew Cagney <cagney@redhat.com>2002-06-10 23:25:50 +0000
commit101dcfbe4ad4c4b054b2bd6b289fbe579e2503c6 (patch)
treee6ccb415259d2ab5fcea87dc107e731010dc8837 /gdb/frame.c
parent304270b6be4c0983933af3f6fe4c6b686a99a99d (diff)
downloadgdb-101dcfbe4ad4c4b054b2bd6b289fbe579e2503c6.zip
gdb-101dcfbe4ad4c4b054b2bd6b289fbe579e2503c6.tar.gz
gdb-101dcfbe4ad4c4b054b2bd6b289fbe579e2503c6.tar.bz2
* infrun.c (struct inferior_status): Replace fields
selected_frame_address and selected_level with field selected_frame_id. (save_inferior_status): Update. Use get_frame_id. (struct restore_selected_frame_args): Delete. (restore_selected_frame): Update. Use frame_find_by_id. (restore_inferior_status): Update. * breakpoint.h (struct breakpoint): Change type of watchpoint_frame to frame_id. * breakpoint.c (insert_breakpoints): Use frame_find_by_id. Remove call to get_current_frame. (do_enable_breakpoint): Use frame_find_by_id. Remove call to get_current_frame. (watchpoint_check): Use frame_find_by_id. * frame.h (record_selected_frame): Delete declaration. * stack.c (record_selected_frame): Delete function. * frame.h (struct frame_id): Define. (get_frame_id): Declare. (frame_find_by_id): Declare. * frame.c (frame_find_by_id): New function. (get_frame_id): New function.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index 85de9b8..5c52ed1 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -28,6 +28,56 @@
#include "regcache.h"
#include "gdb_assert.h"
+/* Return a frame uniq ID that can be used to, later re-find the
+ frame. */
+
+void
+get_frame_id (struct frame_info *fi, struct frame_id *id)
+{
+ if (fi == NULL)
+ {
+ id->base = 0;
+ id->pc = 0;
+ }
+ else
+ {
+ id->base = FRAME_FP (fi);
+ id->pc = fi->pc;
+ }
+}
+
+struct frame_info *
+frame_find_by_id (struct frame_id id)
+{
+ struct frame_info *frame;
+
+ /* ZERO denotes the null frame, let the caller decide what to do
+ about it. Should it instead return get_current_frame()? */
+ if (id.base == 0 && id.pc == 0)
+ return NULL;
+
+ for (frame = get_current_frame ();
+ frame != NULL;
+ frame = get_prev_frame (frame))
+ {
+ if (INNER_THAN (FRAME_FP (frame), id.base))
+ /* ``inner/current < frame < id.base''. Keep looking along
+ the frame chain. */
+ continue;
+ if (INNER_THAN (id.base, FRAME_FP (frame)))
+ /* ``inner/current < id.base < frame''. Oops, gone past it.
+ Just give up. */
+ return NULL;
+ /* FIXME: cagney/2002-04-21: This isn't sufficient. It should
+ use id.pc to check that the two frames belong to the same
+ function. Otherwise we'll do things like match dummy frames
+ or mis-match frameless functions. However, until someone
+ notices, stick with the existing behavour. */
+ return frame;
+ }
+ return NULL;
+}
+
/* FIND_SAVED_REGISTER ()
Return the address in which frame FRAME's value of register REGNUM