summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-05-05 01:15:13 +0000
committerAndrew Cagney <cagney@redhat.com>2002-05-05 01:15:13 +0000
commitc346dce1e81fce1a0f45017a196536a7527804fa (patch)
tree24e66742fd53b4ab5152a0583b1d13c150ec4d01
parentbecea47ec87343904a98f30f3eb1903a364f7d1a (diff)
downloadgdb-c346dce1e81fce1a0f45017a196536a7527804fa.tar.gz
* frame.h (select_frame): Delete level parameter.
* stack.c (select_frame): Update. Use frame_relative_level to obtain the frame's level. (select_and_print_frame): Update call. (select_frame_command): Ditto. (up_silently_base): Ditto. (down_silently_base): Ditto. * ocd.c (ocd_start_remote): Ditto. * remote-rdp.c (remote_rdp_open): Ditto. * remote-mips.c (mips_initialize): Ditto. (common_open): Ditto. * remote-e7000.c (e7000_start_remote): Ditto. * m3-nat.c (select_thread): Ditto. * hppa-tdep.c (child_get_current_exception_event): Ditto. (child_get_current_exception_event): Ditto. * varobj.c (varobj_create): Ditto. (varobj_update): Ditto. (c_value_of_root): Ditto. * tracepoint.c (finish_tfind_command): Ditto. * corelow.c (core_open): Ditto. * arch-utils.c (generic_prepare_to_proceed): Ditto. * thread.c (info_threads_command): Ditto. (switch_to_thread): Ditto. * infrun.c (normal_stop): Ditto. (restore_selected_frame): Ditto. (restore_inferior_status): Ditto. * breakpoint.c (insert_breakpoints): Ditto. (watchpoint_check): Ditto. (bpstat_stop_status): Ditto. (do_enable_breakpoint): Ditto. * blockframe.c (flush_cached_frames): Ditto. (reinit_frame_cache): Ditto.
-rw-r--r--gdb/ChangeLog35
-rw-r--r--gdb/arch-utils.c2
-rw-r--r--gdb/blockframe.c4
-rw-r--r--gdb/breakpoint.c12
-rw-r--r--gdb/corelow.c2
-rw-r--r--gdb/frame.h2
-rw-r--r--gdb/hppa-tdep.c6
-rw-r--r--gdb/infrun.c8
-rw-r--r--gdb/m3-nat.c2
-rw-r--r--gdb/ocd.c2
-rw-r--r--gdb/remote-e7000.c2
-rw-r--r--gdb/remote-mips.c4
-rw-r--r--gdb/remote-rdp.c2
-rw-r--r--gdb/stack.c54
-rw-r--r--gdb/thread.c4
-rw-r--r--gdb/tracepoint.c2
-rw-r--r--gdb/varobj.c8
17 files changed, 77 insertions, 74 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fcd7fca9aae..c7e3758bb2f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,40 @@
2002-05-04 Andrew Cagney <ac131313@redhat.com>
+ * frame.h (select_frame): Delete level parameter.
+ * stack.c (select_frame): Update. Use frame_relative_level to
+ obtain the frame's level.
+ (select_and_print_frame): Update call.
+ (select_frame_command): Ditto.
+ (up_silently_base): Ditto.
+ (down_silently_base): Ditto.
+ * ocd.c (ocd_start_remote): Ditto.
+ * remote-rdp.c (remote_rdp_open): Ditto.
+ * remote-mips.c (mips_initialize): Ditto.
+ (common_open): Ditto.
+ * remote-e7000.c (e7000_start_remote): Ditto.
+ * m3-nat.c (select_thread): Ditto.
+ * hppa-tdep.c (child_get_current_exception_event): Ditto.
+ (child_get_current_exception_event): Ditto.
+ * varobj.c (varobj_create): Ditto.
+ (varobj_update): Ditto.
+ (c_value_of_root): Ditto.
+ * tracepoint.c (finish_tfind_command): Ditto.
+ * corelow.c (core_open): Ditto.
+ * arch-utils.c (generic_prepare_to_proceed): Ditto.
+ * thread.c (info_threads_command): Ditto.
+ (switch_to_thread): Ditto.
+ * infrun.c (normal_stop): Ditto.
+ (restore_selected_frame): Ditto.
+ (restore_inferior_status): Ditto.
+ * breakpoint.c (insert_breakpoints): Ditto.
+ (watchpoint_check): Ditto.
+ (bpstat_stop_status): Ditto.
+ (do_enable_breakpoint): Ditto.
+ * blockframe.c (flush_cached_frames): Ditto.
+ (reinit_frame_cache): Ditto.
+
+2002-05-04 Andrew Cagney <ac131313@redhat.com>
+
* MAINTAINERS (Host/Native): Add Jason Thorpe as NetBSD
maintainer.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 23caf9f98a3..154438acf26 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -338,7 +338,7 @@ generic_prepare_to_proceed (int select_it)
flush_cached_frames ();
registers_changed ();
stop_pc = wait_pc;
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
}
/* We return 1 to indicate that there is a breakpoint here,
so we need to step over it before continuing to avoid
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 6f2a796049f..706d0283cf1 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -254,7 +254,7 @@ flush_cached_frames (void)
obstack_init (&frame_cache_obstack);
current_frame = NULL; /* Invalidate cache */
- select_frame (NULL, -1);
+ select_frame (NULL);
annotate_frames_invalid ();
}
@@ -268,7 +268,7 @@ reinit_frame_cache (void)
/* FIXME: The inferior_ptid test is wrong if there is a corefile. */
if (PIDGET (inferior_ptid) != 0)
{
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
}
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5844b40f0a2..6f604f1961a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -918,7 +918,7 @@ insert_breakpoints (void)
fi = find_frame_addr_in_frame_chain (b->watchpoint_frame);
within_current_scope = (fi != NULL);
if (within_current_scope)
- select_frame (fi, -1);
+ select_frame (fi);
}
if (within_current_scope)
@@ -1003,7 +1003,7 @@ insert_breakpoints (void)
/* Restore the frame and level. */
if ((saved_frame != selected_frame) ||
(saved_level != frame_relative_level (selected_frame)))
- select_frame (saved_frame, saved_level);
+ select_frame (saved_frame);
if (val)
return_val = val; /* remember failure */
@@ -2334,7 +2334,7 @@ watchpoint_check (PTR p)
/* If we end up stopping, the current frame will get selected
in normal_stop. So this call to select_frame won't affect
the user. */
- select_frame (fr, -1);
+ select_frame (fr);
}
if (within_current_scope)
@@ -2665,7 +2665,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_breakpoint)
{
/* Need to select the frame, with all that implies
so that the conditions will have the right context. */
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
value_is_zero
= catch_errors (breakpoint_cond_eval, (b->cond),
"Error in testing breakpoint condition:\n",
@@ -7283,7 +7283,7 @@ is valid is not currently in scope.\n", bpt->number);
save_selected_frame = selected_frame;
save_selected_frame_level = frame_relative_level (selected_frame);
- select_frame (fr, -1);
+ select_frame (fr);
}
value_free (bpt->val);
@@ -7318,7 +7318,7 @@ have been allocated for other watchpoints.\n", bpt->number);
}
if (save_selected_frame_level >= 0)
- select_frame (save_selected_frame, save_selected_frame_level);
+ select_frame (save_selected_frame);
value_free_to_mark (mark);
}
if (modify_breakpoint_hook)
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 125952d9745..657cdc8ffc9 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -358,7 +358,7 @@ core_open (char *filename, int from_tty)
/* Now, set up the frame cache, and print the top of stack. */
flush_cached_frames ();
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
print_stack_frame (selected_frame,
frame_relative_level (selected_frame), 1);
}
diff --git a/gdb/frame.h b/gdb/frame.h
index 09f9b0d36a6..9a041c49f49 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -244,7 +244,7 @@ extern void print_only_stack_frame (struct frame_info *, int, int);
extern void show_stack_frame (struct frame_info *);
-extern void select_frame (struct frame_info *, int);
+extern void select_frame (struct frame_info *);
extern void record_selected_frame (CORE_ADDR *, int *);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index ed23d9a86fb..3890fc2f773 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -4465,7 +4465,7 @@ child_get_current_exception_event (void)
if (level != 0)
return (struct exception_event_record *) NULL;
- select_frame (fi, -1);
+ select_frame (fi);
/* Read in the arguments */
/* __d_eh_notify_callback() is called with 3 arguments:
@@ -4491,11 +4491,11 @@ child_get_current_exception_event (void)
if (level != 0)
return (struct exception_event_record *) NULL;
- select_frame (fi, -1);
+ select_frame (fi);
throw_addr = fi->pc;
/* Go back to original (top) frame */
- select_frame (curr_frame, -1);
+ select_frame (curr_frame);
current_ex_event.kind = (enum exception_event_kind) event_kind;
current_ex_event.throw_sal = find_pc_line (throw_addr, 1);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index acb722009a3..e9fea2a0ac7 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3441,7 +3441,7 @@ and/or watchpoints.\n");
if (!stop_stack_dummy)
{
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
/* Print current location without a level number, if
we have changed functions or hit a breakpoint.
@@ -3517,7 +3517,7 @@ and/or watchpoints.\n");
Can't rely on restore_inferior_status because that only gets
called if we don't stop in the called function. */
stop_pc = read_pc ();
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
}
done:
@@ -4024,7 +4024,7 @@ restore_selected_frame (void *args)
return 0;
}
- select_frame (frame, fr->level);
+ select_frame (frame);
return (1);
}
@@ -4079,7 +4079,7 @@ restore_inferior_status (struct inferior_status *inf_status)
frame. */
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
}
diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c
index 320cbf8e0ce..c29101b9c36 100644
--- a/gdb/m3-nat.c
+++ b/gdb/m3-nat.c
@@ -1101,7 +1101,7 @@ select_thread (mach_port_t task, int thread_id, int flag)
stop_pc = read_pc ();
flush_cached_frames ();
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
}
return KERN_SUCCESS;
diff --git a/gdb/ocd.c b/gdb/ocd.c
index 6834eea648f..9dd90e9c992 100644
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -255,7 +255,7 @@ ocd_start_remote (PTR dummy)
registers_changed ();
stop_pc = read_pc ();
set_current_frame (create_new_frame (read_fp (), stop_pc));
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
print_stack_frame (selected_frame, -1, 1);
buf[0] = OCD_LOG_FILE;
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index dee664d8736..d9cf5e8bba9 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -630,7 +630,7 @@ e7000_start_remote (void *dummy)
registers_changed ();
stop_pc = read_pc ();
set_current_frame (create_new_frame (read_fp (), stop_pc));
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
print_stack_frame (selected_frame, -1, 1);
return 1;
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 385b69a4252..a1df0eb94e9 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1495,7 +1495,7 @@ mips_initialize (void)
mips_request ('r', 0, 0, &err, mips_receive_wait, NULL);
set_current_frame (create_new_frame (read_fp (), read_pc ()));
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
}
/* Open a connection to the remote board. */
@@ -1621,7 +1621,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
registers_changed ();
stop_pc = read_pc ();
set_current_frame (create_new_frame (read_fp (), stop_pc));
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
print_stack_frame (selected_frame, -1, 1);
xfree (serial_port_name);
}
diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c
index 2f9183a9bc7..f6ccf1e812b 100644
--- a/gdb/remote-rdp.c
+++ b/gdb/remote-rdp.c
@@ -1164,7 +1164,7 @@ remote_rdp_open (char *args, int from_tty)
registers_changed ();
stop_pc = read_pc ();
set_current_frame (create_new_frame (read_fp (), stop_pc));
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
print_stack_frame (selected_frame, -1, 1);
}
diff --git a/gdb/stack.c b/gdb/stack.c
index d34e57174f4..75eb6a1f274 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1459,50 +1459,18 @@ args_plus_locals_info (char *ignore, int from_tty)
}
-/* Select frame FI, and note that its stack level is LEVEL.
- LEVEL may be -1 if an actual level number is not known. */
+/* Select frame FI (or NULL - to invalidate the current frame). */
void
-select_frame (struct frame_info *fi, int level)
+select_frame (struct frame_info *fi)
{
register struct symtab *s;
selected_frame = fi;
- /* 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__,
- "Conflicting frame levels fi->level=%d, level=%d",
- (fi ? fi->level : -1),
- level);
+ /* NOTE: cagney/2002-05-04: FI can be NULL. This occures when the
+ frame is being invalidated. */
if (selected_frame_level_changed_hook)
- selected_frame_level_changed_hook (level);
+ selected_frame_level_changed_hook (frame_relative_level (fi));
/* Ensure that symbols for this frame are read in. Also, determine the
source language of this frame, and switch to it if desired. */
@@ -1520,12 +1488,12 @@ select_frame (struct frame_info *fi, int level)
}
-/* Select frame FI, noting that its stack level is LEVEL. Also print
- the stack frame and show the source if this is the tui version. */
+/* Select frame FI. Also print the stack frame and show the source if
+ this is the tui version. */
void
select_and_print_frame (struct frame_info *fi, int level)
{
- select_frame (fi, level);
+ select_frame (fi);
if (fi)
{
print_stack_frame (fi, level, 1);
@@ -1640,7 +1608,7 @@ select_frame_command (char *level_exp, int from_tty)
if (!frame1)
level = 0;
- select_frame (frame, level);
+ select_frame (frame);
}
/* The "frame" command. With no arg, print selected frame briefly.
@@ -1685,7 +1653,7 @@ up_silently_base (char *count_exp)
fi = find_relative_frame (selected_frame, &count1);
if (count1 != 0 && count_exp == 0)
error ("Initial frame selected; you cannot go up.");
- select_frame (fi, frame_relative_level (selected_frame) + count - count1);
+ select_frame (fi);
}
static void
@@ -1730,7 +1698,7 @@ down_silently_base (char *count_exp)
error ("Bottom (i.e., innermost) frame selected; you cannot go down.");
}
- select_frame (frame, frame_relative_level (selected_frame) + count - count1);
+ select_frame (frame);
}
/* ARGSUSED */
diff --git a/gdb/thread.c b/gdb/thread.c
index 640c4396c9b..45130bbb0ee 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -476,7 +476,7 @@ info_threads_command (char *arg, int from_tty)
}
else
{
- select_frame (cur_frame, saved_frame_level);
+ select_frame (cur_frame);
}
/* re-show current frame. */
@@ -495,7 +495,7 @@ switch_to_thread (ptid_t ptid)
flush_cached_frames ();
registers_changed ();
stop_pc = read_pc ();
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
}
static void
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 24ad8563c36..dd5adb0ef35 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1928,7 +1928,7 @@ finish_tfind_command (char *msg,
flush_cached_frames ();
registers_changed ();
- select_frame (get_current_frame (), 0);
+ select_frame (get_current_frame ());
set_traceframe_num (target_frameno);
set_tracepoint_num (target_tracept);
if (target_frameno == -1)
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 3f13894b2be..9ae145e2170 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -458,7 +458,7 @@ varobj_create (char *objname,
{
var->root->frame = FRAME_FP (fi);
old_fi = selected_frame;
- select_frame (fi, -1);
+ select_frame (fi);
}
/* We definitively need to catch errors here.
@@ -485,7 +485,7 @@ varobj_create (char *objname,
/* Reset the selected frame */
if (fi != NULL)
- select_frame (old_fi, -1);
+ select_frame (old_fi);
}
/* If the variable object name is null, that means this
@@ -983,7 +983,7 @@ varobj_update (struct varobj **varp, struct varobj ***changelist)
}
/* Restore selected frame */
- select_frame (old_fi, -1);
+ select_frame (old_fi);
if (type_changed)
return -2;
@@ -1862,7 +1862,7 @@ c_value_of_root (struct varobj **var_handle)
within_scope = fi != NULL;
/* FIXME: select_frame could fail */
if (within_scope)
- select_frame (fi, -1);
+ select_frame (fi);
}
if (within_scope)