Always clear p_xthread if current thread no longer needs it, in theory, if

debugger exited without calling ptrace(PT_DETACH), there is a time window
that the p_xthread may be pointing to non-existing thread, in practical,
this is not a problem because child process soon will be killed by parent
process.
This commit is contained in:
David Xu 2012-07-10 05:45:13 +00:00
parent 4a4c0f7c24
commit 7ce60f6013

View file

@ -2436,9 +2436,10 @@ ptracestop(struct thread *td, int sig)
}
stopme:
thread_suspend_switch(td);
if (!(p->p_flag & P_TRACED)) {
if (p->p_xthread == td)
p->p_xthread = NULL;
if (!(p->p_flag & P_TRACED))
break;
}
if (td->td_dbgflags & TDB_SUSPEND) {
if (p->p_flag & P_SINGLE_EXIT)
break;