aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-05-02 00:21:41 +0000
committerAndrew Cagney <cagney@redhat.com>2004-05-02 00:21:41 +0000
commit7789d0fa8245d35616961917b7c4702b97bd898f (patch)
tree4ff0cd6ae39225bcbc6f4d506e106ba0e1ac8891 /gdb/thread.c
parent090df6852e2ff06f172598ab9fe01b5f21279e74 (diff)
downloadgdb-7789d0fa8245d35616961917b7c4702b97bd898f.zip
gdb-7789d0fa8245d35616961917b7c4702b97bd898f.tar.gz
gdb-7789d0fa8245d35616961917b7c4702b97bd898f.tar.bz2
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.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index b8a7f8b..35ba2b1 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -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. */