2011-09-02 Pedro Alves <pedro@codesourcery.com>

* linux-nat.c (in_pid_list_p): New.
	(linux_record_stopped_pid): Delete.
	(lin_lwp_attach_lwp): Check if PTRACE_ATTACH failed because we're
	already attached to the LWP.  Return an indication if so.
	(linux_nat_filter_event): Adjust.
	* linux-thread-db.c (attach_thread): Handle lin_lwp_attach_lwp
	returning an indication to ignore this thread.
This commit is contained in:
Pedro Alves 2011-09-02 21:03:06 +00:00
parent 68e77c9e30
commit 84636d2874
3 changed files with 86 additions and 14 deletions

View file

@ -1140,9 +1140,25 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p,
/* Under GNU/Linux, we have to attach to each and every thread. */
if (target_has_execution
&& tp == NULL
&& lin_lwp_attach_lwp (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid))) < 0)
return 0;
&& tp == NULL)
{
int res;
res = lin_lwp_attach_lwp (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid)));
if (res < 0)
{
/* Error, stop iterating. */
return 0;
}
else if (res > 0)
{
/* Pretend this thread doesn't exist yet, and keep
iterating. */
return 1;
}
/* Otherwise, we sucessfully attached to the thread. */
}
/* Construct the thread's private data. */
private = xmalloc (sizeof (struct private_thread_info));