2004-05-01 Andrew Cagney <cagney@redhat.com>

* breakpoint.c (insert_bp_location): Use get_frame_id, and
	frame_find_by_id instead of frame_relative_level.
	(do_enable_breakpoint): Ditto.
	* thread.c: Update copyright.
	(info_threads_command): Ditto, simplify.
This commit is contained in:
Andrew Cagney 2004-05-02 00:21:41 +00:00
parent 090df6852e
commit 7789d0fa82
3 changed files with 27 additions and 37 deletions

View file

@ -1,5 +1,11 @@
2004-05-01 Andrew Cagney <cagney@redhat.com> 2004-05-01 Andrew Cagney <cagney@redhat.com>
* breakpoint.c (insert_bp_location): Use get_frame_id, and
frame_find_by_id instead of frame_relative_level.
(do_enable_breakpoint): Ditto.
* thread.c: Update copyright.
(info_threads_command): Ditto, simplify.
* frame.c (deprecated_generic_get_saved_register): Delete * frame.c (deprecated_generic_get_saved_register): Delete
function, moved to "xstormy16-tdep.c". function, moved to "xstormy16-tdep.c".
* xstormy16-tdep.c (xstormy16_get_saved_register): Inline * xstormy16-tdep.c (xstormy16_get_saved_register): Inline

View file

@ -910,18 +910,17 @@ insert_bp_location (struct bp_location *bpt,
must watch. As soon as a many-to-one mapping is available I'll must watch. As soon as a many-to-one mapping is available I'll
convert this. */ convert this. */
struct frame_info *saved_frame; int within_current_scope;
int saved_level, within_current_scope;
struct value *mark = value_mark (); struct value *mark = value_mark ();
struct value *v; struct value *v;
struct frame_id saved_frame_id;
/* Save the current frame and level so we can restore it after /* Save the current frame's ID so we can restore it after
evaluating the watchpoint expression on its own frame. */ evaluating the watchpoint expression on its own frame. */
/* FIXME drow/2003-09-09: It would be nice if evaluate_expression /* FIXME drow/2003-09-09: It would be nice if evaluate_expression
took a frame parameter, so that we didn't have to change the took a frame parameter, so that we didn't have to change the
selected frame. */ selected frame. */
saved_frame = deprecated_selected_frame; saved_frame_id = get_frame_id (deprecated_selected_frame);
saved_level = frame_relative_level (deprecated_selected_frame);
/* Determine if the watchpoint is within scope. */ /* Determine if the watchpoint is within scope. */
if (bpt->owner->exp_valid_block == NULL) if (bpt->owner->exp_valid_block == NULL)
@ -1018,10 +1017,8 @@ insert_bp_location (struct bp_location *bpt,
bpt->owner->disposition = disp_del_at_next_stop; bpt->owner->disposition = disp_del_at_next_stop;
} }
/* Restore the frame and level. */ /* Restore the selected frame. */
if (saved_frame != deprecated_selected_frame select_frame (frame_find_by_id (saved_frame_id));
|| saved_level != frame_relative_level (deprecated_selected_frame))
select_frame (saved_frame);
return val; return val;
} }
@ -7564,8 +7561,6 @@ disable_command (char *args, int from_tty)
static void static void
do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition) do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
{ {
struct frame_info *save_selected_frame = NULL;
int save_selected_frame_level = -1;
int target_resources_ok, other_type_used; int target_resources_ok, other_type_used;
struct value *mark; struct value *mark;
@ -7612,6 +7607,9 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
bpt->type == bp_read_watchpoint || bpt->type == bp_read_watchpoint ||
bpt->type == bp_access_watchpoint) bpt->type == bp_access_watchpoint)
{ {
struct frame_id saved_frame_id;
saved_frame_id = get_frame_id (get_selected_frame ());
if (bpt->exp_valid_block != NULL) if (bpt->exp_valid_block != NULL)
{ {
struct frame_info *fr = struct frame_info *fr =
@ -7624,9 +7622,6 @@ is valid is not currently in scope.\n", bpt->number);
bpt->enable_state = bp_disabled; bpt->enable_state = bp_disabled;
return; return;
} }
save_selected_frame = deprecated_selected_frame;
save_selected_frame_level = frame_relative_level (deprecated_selected_frame);
select_frame (fr); select_frame (fr);
} }
@ -7661,8 +7656,7 @@ have been allocated for other watchpoints.\n", bpt->number);
} }
} }
if (save_selected_frame_level >= 0) select_frame (frame_find_by_id (saved_frame_id));
select_frame (save_selected_frame);
value_free_to_mark (mark); value_free_to_mark (mark);
} }
} }

View file

@ -1,7 +1,7 @@
/* Multi-process/thread control for GDB, the GNU debugger. /* Multi-process/thread control for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, Copyright 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA. Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
@ -417,15 +417,9 @@ info_threads_command (char *arg, int from_tty)
struct thread_info *tp; struct thread_info *tp;
ptid_t current_ptid; ptid_t current_ptid;
struct frame_info *cur_frame; struct frame_info *cur_frame;
int saved_frame_level = frame_relative_level (get_selected_frame ()); struct frame_id saved_frame_id = get_frame_id (get_selected_frame ());
int counter;
char *extra_info; char *extra_info;
/* Check that there really is a frame. This happens when a simulator
is connected but not loaded or running, for instance. */
if (legacy_frame_p (current_gdbarch) && saved_frame_level < 0)
error ("No frame.");
prune_threads (); prune_threads ();
target_find_new_threads (); target_find_new_threads ();
current_ptid = inferior_ptid; current_ptid = inferior_ptid;
@ -453,15 +447,12 @@ info_threads_command (char *arg, int from_tty)
switch_to_thread (current_ptid); switch_to_thread (current_ptid);
/* Code below copied from "up_silently_base" in "stack.c". /* Restores the frame set by the user before the "info threads"
* It restores the frame set by the user before the "info threads" command. We have finished the info-threads display by switching
* command. We have finished the info-threads display by switching back to the current thread. That switch has put us at the top of
* back to the current thread. That switch has put us at the top the stack (leaf frame). */
* of the stack (leaf frame). cur_frame = frame_find_by_id (saved_frame_id);
*/ if (cur_frame == NULL)
counter = saved_frame_level;
cur_frame = find_relative_frame (get_selected_frame (), &counter);
if (counter != 0)
{ {
/* Ooops, can't restore, tell user where we are. */ /* Ooops, can't restore, tell user where we are. */
warning ("Couldn't restore frame in current thread, at frame 0"); warning ("Couldn't restore frame in current thread, at frame 0");
@ -470,11 +461,10 @@ info_threads_command (char *arg, int from_tty)
else else
{ {
select_frame (cur_frame); select_frame (cur_frame);
}
/* re-show current frame. */ /* re-show current frame. */
show_stack_frame (cur_frame); show_stack_frame (cur_frame);
} }
}
/* Switch from one thread to another. */ /* Switch from one thread to another. */