aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-thread-db.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-12-31 21:04:51 +0000
committerDaniel Jacobowitz <drow@false.org>2006-12-31 21:04:51 +0000
commit9ee57c332efe6e35ee95d8be28f89c320590e0a3 (patch)
tree534180cc1ea69fcb73a26a76247247003eecf013 /gdb/linux-thread-db.c
parent59f80f10887fdfa0299b22f33b11efa4ec069fee (diff)
downloadgdb-9ee57c332efe6e35ee95d8be28f89c320590e0a3.zip
gdb-9ee57c332efe6e35ee95d8be28f89c320590e0a3.tar.gz
gdb-9ee57c332efe6e35ee95d8be28f89c320590e0a3.tar.bz2
* linux-nat.c (lin_lwp_attach_lwp): Return a status. Do not
add the LWP to our list until we are attached. Warn instead of erroring if the attach fails. * linux-nat.h (lin_lwp_attach_lwp): New prototype. * linux-thread-db.c (attach_thread): Call lin_lwp_attach_lwp directly. Do not add the thread to our list until we are successfully attached. * config/nm-linux.h (lin_lwp_attach_lwp, ATTACH_LWP): Delete.
Diffstat (limited to 'gdb/linux-thread-db.c')
-rw-r--r--gdb/linux-thread-db.c15
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)