summaryrefslogtreecommitdiff
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
commitdfa2726f54d0007bcbcc70d63d49d93a9272e367 (patch)
tree26c45a72e6844ad11b0190025448f625b90b6892 /gdb/thread.c
parentf2cb65e39b12b8e46ea161598c264b90a6e6bc13 (diff)
downloadgdb-dfa2726f54d0007bcbcc70d63d49d93a9272e367.tar.gz
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 b8a7f8bfc51..35ba2b14a16 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. */