diff options
author | Michael Snyder <msnyder@vmware.com> | 1997-04-29 04:27:26 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 1997-04-29 04:27:26 +0000 |
commit | c889a1eb873d3e87d2fe38b83c7d27a2915eb792 (patch) | |
tree | 360276cfbff79e2fe612c4b4ba83ca4346027224 /gdb/thread.c | |
parent | 75dc6b820fb2bbfd8ee192a1ed8194fc42415169 (diff) | |
download | gdb-c889a1eb873d3e87d2fe38b83c7d27a2915eb792.zip gdb-c889a1eb873d3e87d2fe38b83c7d27a2915eb792.tar.gz gdb-c889a1eb873d3e87d2fe38b83c7d27a2915eb792.tar.bz2 |
Mon Apr 28 21:25:32 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
* Makefile.in: Add rule for gnu-nat.o and i386gnu-nat.o (Gnu Hurd)
* config/i386/i386gnu.mh: remove rules for [i386]gnu-nat.o, now
in Makefile.in (as for other targets); add NATDEPFILE corelow.o to
satisfy symbol dependancy in solib.c (core_ops).
* target.[ch] conditionalize Mach-specific signals so that they
won't show up in non-Mach gdb's!
* thread.c: add function thread_id_to_pid; change name of static
function "thread_switch" to "switch_to_thread", to avoid conflict
with Mach global symbol; move thread_cmd_list to global scope
so targets can add their own thread commands.
* infrun.c: sig_print_info: allow for long signal names.
* gnu-nat.[ch]: tidying up comments.
* gnu-nat.c: move several functions to static scope, just for tidy;
remove calls to prune_threads and renumber_threads;
gnu_wait must not return -1 when inferior exits;
attach_to_child will modify inferior_pid in a way that allows
fork_inferior to remain unchanged;
remove extra arg from startup_inferior;
move mach-specific thread commands here from thread.c.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r-- | gdb/thread.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/gdb/thread.c b/gdb/thread.c index 2d1826a..cd7fb02 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -65,7 +65,7 @@ static void prune_threads PARAMS ((void)); static void -thread_switch PARAMS ((int pid)); +switch_to_thread PARAMS ((int pid)); static struct thread_info * find_thread_id PARAMS ((int num)); @@ -165,6 +165,17 @@ pid_to_thread_id (pid) } int +thread_id_to_pid (num) + int num; +{ + struct thread_info *thread = find_thread_id (num); + if (thread) + return thread->pid; + else + return -1; +} + +int in_thread_list (pid) int pid; { @@ -309,18 +320,18 @@ info_threads_command (arg, from_tty) printf_filtered ("%d %s ", tp->num, target_pid_to_str (tp->pid)); - thread_switch (tp->pid); + switch_to_thread (tp->pid); print_stack_frame (selected_frame, -1, 0); } - thread_switch (current_pid); + switch_to_thread (current_pid); prune_threads (); } /* Switch from one thread to another. */ static void -thread_switch (pid) +switch_to_thread (pid) int pid; { if (pid == inferior_pid) @@ -338,7 +349,7 @@ restore_current_thread (pid) int pid; { if (pid != inferior_pid) - thread_switch (pid); + switch_to_thread (pid); } /* Apply a GDB command to a list of threads. List syntax is a whitespace @@ -365,7 +376,7 @@ thread_apply_all_command (cmd, from_tty) for (tp = thread_list; tp; tp = tp->next) { - thread_switch (tp->pid); + switch_to_thread (tp->pid); printf_filtered ("\nThread %d (%s):\n", tp->num, target_pid_to_str (inferior_pid)); execute_command (cmd, from_tty); @@ -428,7 +439,7 @@ thread_apply_command (tidlist, from_tty) continue; } - thread_switch (tp->pid); + switch_to_thread (tp->pid); printf_filtered ("\nThread %d (%s):\n", tp->num, target_pid_to_str (inferior_pid)); execute_command (cmd, from_tty); @@ -459,16 +470,18 @@ see the IDs of currently known threads."); error ("Thread ID %d not known. Use the \"info threads\" command to\n\ see the IDs of currently known threads.", num); - thread_switch (tp->pid); + switch_to_thread (tp->pid); printf_filtered ("[Switching to %s]\n", target_pid_to_str (inferior_pid)); print_stack_frame (selected_frame, selected_frame_level, 1); } +/* Commands with a prefix of `thread'. */ +struct cmd_list_element *thread_cmd_list = NULL; + void _initialize_thread () { - static struct cmd_list_element *thread_cmd_list = NULL; static struct cmd_list_element *thread_apply_list = NULL; extern struct cmd_list_element *cmdlist; |