diff options
author | Michael Snyder <msnyder@vmware.com> | 2001-05-23 00:06:15 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2001-05-23 00:06:15 +0000 |
commit | 5fd913cc666e3625b9c9c8c64411679ae9a93213 (patch) | |
tree | 02942f12bb24b288a188f87cf9d2e574c36078cb | |
parent | 7ed49443c244d7a9e911f013fcdd70306a349866 (diff) | |
download | gdb-5fd913cc666e3625b9c9c8c64411679ae9a93213.zip gdb-5fd913cc666e3625b9c9c8c64411679ae9a93213.tar.gz gdb-5fd913cc666e3625b9c9c8c64411679ae9a93213.tar.bz2 |
2001-05-22 Michael Snyder <msnyder@redhat.com>
* thread-db.c: Allow for defunct zombie threads.
(attach_thread): Do not attempt to attach zombie thread.
(thread_db_thread_alive): Return false for defunct zombie thread.
(find_new_threads_callback): Don't add defunct zombie thread to list.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/thread-db.c | 20 |
2 files changed, 24 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2600102..ec08aff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2001-05-22 Michael Snyder <msnyder@redhat.com> + + * thread-db.c: Allow for defunct zombie threads. + (attach_thread): Do not attempt to attach zombie thread. + (thread_db_thread_alive): Return false for defunct zombie thread. + (find_new_threads_callback): Don't add defunct zombie thread to list. + 2001-05-22 Jim Blandy <jimb@redhat.com> Add support for the GNU V3 C++ ABI. diff --git a/gdb/thread-db.c b/gdb/thread-db.c index a54f9fb..d989c49 100644 --- a/gdb/thread-db.c +++ b/gdb/thread-db.c @@ -573,6 +573,9 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p, tp->private = xmalloc (sizeof (struct private_thread_info)); tp->private->lwpid = ti_p->ti_lid; + if (ti_p->ti_state == TD_THR_UNKNOWN) + return;/* A zombie thread that's been joined -- do not attach. */ + /* Under Linux, we have to attach to each and every thread. */ #ifdef ATTACH_LWP ATTACH_LWP (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid)), 0); @@ -894,11 +897,12 @@ thread_db_mourn_inferior (void) static int thread_db_thread_alive (ptid_t ptid) { + td_thrhandle_t th; + td_thrinfo_t ti; + td_err_e err; + if (is_thread (ptid)) { - td_thrhandle_t th; - td_err_e err; - err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th); if (err != TD_OK) return 0; @@ -907,6 +911,13 @@ thread_db_thread_alive (ptid_t ptid) if (err != TD_OK) return 0; + err = td_thr_get_info_p (&th, &ti); + if (err != TD_OK) + return 0; + + if (ti.ti_state == TD_THR_UNKNOWN) + return 0; /* A zombie thread that's been joined. */ + return 1; } @@ -927,6 +938,9 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data) if (err != TD_OK) error ("Cannot get thread info: %s", thread_db_err_str (err)); + if (ti.ti_state == TD_THR_UNKNOWN) + return 0; /* A zombie that's been reaped -- ignore. */ + ptid = BUILD_THREAD (ti.ti_tid, GET_PID (inferior_ptid)); if (! in_thread_list (ptid)) |