diff options
Diffstat (limited to 'gdb/linux-thread-db.c')
-rw-r--r-- | gdb/linux-thread-db.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 4b0aef7..94774c5 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -690,6 +690,13 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p, check_thread_signals (); + if (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE) + return; /* A zombie thread -- do not attach. */ + + /* Under GNU/Linux, we have to attach to each and every thread. */ + if (lin_lwp_attach_lwp (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid)), 0) < 0) + return; + /* Add the thread to GDB's thread list. */ tp = add_thread (ptid); tp->private = xmalloc (sizeof (struct private_thread_info)); @@ -698,14 +705,6 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p, if (verbose) printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid)); - if (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE) - return; /* A zombie thread -- do not attach. */ - - /* Under GNU/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); -#endif - /* Enable thread event reporting for this thread. */ err = td_thr_event_enable_p (th_p, 1); if (err != TD_OK) |