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>
* 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
function, moved to "xstormy16-tdep.c".
* 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
convert this. */
struct frame_info *saved_frame;
int saved_level, within_current_scope;
int within_current_scope;
struct value *mark = value_mark ();
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. */
/* 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
selected frame. */
saved_frame = deprecated_selected_frame;
saved_level = frame_relative_level (deprecated_selected_frame);
saved_frame_id = get_frame_id (deprecated_selected_frame);
/* Determine if the watchpoint is within scope. */
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;
}
/* Restore the frame and level. */
if (saved_frame != deprecated_selected_frame
|| saved_level != frame_relative_level (deprecated_selected_frame))
select_frame (saved_frame);
/* Restore the selected frame. */
select_frame (frame_find_by_id (saved_frame_id));
return val;
}
@ -7564,8 +7561,6 @@ disable_command (char *args, int from_tty)
static void
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;
struct value *mark;
@ -7612,6 +7607,9 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
bpt->type == bp_read_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)
{
struct frame_info *fr =
@ -7624,9 +7622,6 @@ is valid is not currently in scope.\n", bpt->number);
bpt->enable_state = bp_disabled;
return;
}
save_selected_frame = deprecated_selected_frame;
save_selected_frame_level = frame_relative_level (deprecated_selected_frame);
select_frame (fr);
}
@ -7661,8 +7656,7 @@ have been allocated for other watchpoints.\n", bpt->number);
}
}
if (save_selected_frame_level >= 0)
select_frame (save_selected_frame);
select_frame (frame_find_by_id (saved_frame_id));
value_free_to_mark (mark);
}
}

View File

@ -1,7 +1,7 @@
/* Multi-process/thread control for GDB, the GNU debugger.
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.
@ -417,15 +417,9 @@ info_threads_command (char *arg, int from_tty)
struct thread_info *tp;
ptid_t current_ptid;
struct frame_info *cur_frame;
int saved_frame_level = frame_relative_level (get_selected_frame ());
int counter;
struct frame_id saved_frame_id = get_frame_id (get_selected_frame ());
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 ();
target_find_new_threads ();
current_ptid = inferior_ptid;
@ -453,27 +447,23 @@ info_threads_command (char *arg, int from_tty)
switch_to_thread (current_ptid);
/* Code below copied from "up_silently_base" in "stack.c".
* It restores the frame set by the user before the "info threads"
* command. We have finished the info-threads display by switching
* back to the current thread. That switch has put us at the top
* of the stack (leaf frame).
*/
counter = saved_frame_level;
cur_frame = find_relative_frame (get_selected_frame (), &counter);
if (counter != 0)
/* Restores the frame set by the user before the "info threads"
command. We have finished the info-threads display by switching
back to the current thread. That switch has put us at the top of
the stack (leaf frame). */
cur_frame = frame_find_by_id (saved_frame_id);
if (cur_frame == NULL)
{
/* 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");
print_stack_frame (get_selected_frame (), 0, LOCATION);
}
else
{
select_frame (cur_frame);
/* re-show current frame. */
show_stack_frame (cur_frame);
}
/* re-show current frame. */
show_stack_frame (cur_frame);
}
/* Switch from one thread to another. */