Alexandre Julliard : server: Always detach from the thread when we are done with ptrace.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 10 13:47:53 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 5cc97c4e0bd04925deda6553f9e159302a7590ba
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=5cc97c4e0bd04925deda6553f9e159302a7590ba

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Apr 10 20:21:46 2006 +0200

server: Always detach from the thread when we are done with ptrace.

---

 server/ptrace.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/server/ptrace.c b/server/ptrace.c
index 4280b1c..51101d3 100644
--- a/server/ptrace.c
+++ b/server/ptrace.c
@@ -274,8 +274,12 @@ void resume_after_ptrace( struct 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 */




More information about the wine-cvs mailing list