From 5cc97c4e0bd04925deda6553f9e159302a7590ba Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 10 Apr 2006 20:21:46 +0200 Subject: [PATCH] server: Always detach from the thread when we are done with ptrace. --- server/ptrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/ptrace.c b/server/ptrace.c index 4280b1c6b9e..51101d3c0c6 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -274,8 +274,12 @@ void resume_after_ptrace( struct thread *thread ) { if (thread->unix_pid == -1) return; assert( thread->attached ); - ptrace( get_thread_single_step(thread) ? PTRACE_SINGLESTEP : PTRACE_CONT, - get_ptrace_pid(thread), (caddr_t)1, 0 /* cancel the SIGSTOP */ ); + if (ptrace( PTRACE_DETACH, get_ptrace_pid(thread), (caddr_t)1, 0 ) == -1) + { + if (errno == ESRCH) thread->unix_pid = thread->unix_tid = -1; /* thread got killed */ + } + if (debug_level) fprintf( stderr, "%04x: *detached*\n", thread->id ); + thread->attached = 0; } /* read an int from a thread address space */ -- 2.11.4.GIT