aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>1997-05-21 23:33:33 +0000
committerMichael Snyder <msnyder@vmware.com>1997-05-21 23:33:33 +0000
commit3780c3370815a315927580bcd22ce5e361cc9950 (patch)
treece084be089ac9adc56a4618d34d20c6c5cb333a2 /gdb/thread.c
parentb4a4a6dc0f47fb30af11d0b636014b6edced417f (diff)
downloadgdb-3780c3370815a315927580bcd22ce5e361cc9950.zip
gdb-3780c3370815a315927580bcd22ce5e361cc9950.tar.gz
gdb-3780c3370815a315927580bcd22ce5e361cc9950.tar.bz2
Wed May 21 16:03:25 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
* procfs.c (init_procinfo): new function, abstracts some code shared by create_procinfo and do_attach; (procfs_set_inferior_syscall_traps): new function, abstracts some code needed by procfs_init_inferior, do_attach, and procfs_lwp_creation_handler; (procfs_first_available): new function, find any LWP that's runnable; (procfs_thread_alive): replace stub function with real implementation; (procfs_lwp_creation_handler): fix bug starting new child threads; (info_proc): bug fixes and enhancements for the "INFO PROCESSES" command; (close_procinfo_file): call new function "delete_thread" to cleanup GDB's thread database; (proc_init_failed): add new argument "kill", to control whether process is killed (so this function can be shared by create_procinfo and do_attach); (procfs_exit_handler): handle exit from an attached process, and cleanup procinfo handles when the process exits; (procfs_resume, procfs_wait): cleanup after a thread when it exits; (do_attach, do_detach): handle attached processes with multiple threads; plus some general improvements in the diagnostic output. * sol-thread.c (sol_thread_alive): replace stub with real implementation; (thread_to_lwp, lwp_to_thread): enhance to handle threads that may have exited; (sol_thread_attach): add startup setup stuff; (sol_thread_detach): add unpush_target call; (sol_thread_mourn_inferior): add unpush_target call; (sol_thread_wait, sol_thread_resume): enhance to deal with thread exit cleanly; (sol_thread_new_objfile, sol_thread_pid_to_str): detect unsuccessful startup and don't crash; plus some general cleanup. * thread.c (delete_thread): new function, allows targets to notify gdb when a thread is no longer valid. * infrun.c (wait_for_inferior): don't try to detect a new thread on receiving a TARGET_EXITED event.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 7ffc65a..b8bf9e1 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -125,6 +125,31 @@ add_thread (pid)
thread_list = tp;
}
+void
+delete_thread (pid)
+ int pid;
+{
+ struct thread_info *tp, *tpprev;
+
+ tpprev = NULL;
+
+ for (tp = thread_list; tp; tpprev = tp, tp = tp->next)
+ if (tp->pid == pid)
+ break;
+
+ if (!tp)
+ return;
+
+ if (tpprev)
+ tpprev->next = tp->next;
+ else
+ thread_list = tp->next;
+
+ free (tp);
+
+ return;
+}
+
static struct thread_info *
find_thread_id (num)
int num;
@@ -332,7 +357,10 @@ info_threads_command (arg, from_tty)
printf_filtered ("%d %s ", tp->num, target_pid_to_str (tp->pid));
switch_to_thread (tp->pid);
- print_stack_frame (selected_frame, -1, 0);
+ if (selected_frame)
+ print_stack_frame (selected_frame, -1, 0);
+ else
+ printf_filtered ("[No stack.]\n");
}
switch_to_thread (current_pid);