Alexandre Julliard : server: Detaching from a process needs to continue all the pending events.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 30 13:50:30 CDT 2007


Module: wine
Branch: master
Commit: 9c18d92f3665f949dcfb1cb222346d58344e8d2c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9c18d92f3665f949dcfb1cb222346d58344e8d2c

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Aug 30 19:47:43 2007 +0200

server: Detaching from a process needs to continue all the pending events.

---

 server/debugger.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/server/debugger.c b/server/debugger.c
index eb89ef9..ee8ef10 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -451,7 +451,7 @@ static int debugger_attach( struct process *process, struct thread *debugger )
 /* detach a process from a debugger thread (and resume it ?) */
 int debugger_detach( struct process *process, struct thread *debugger )
 {
-    struct debug_event *event;
+    struct debug_event *event, *next;
     struct debug_ctx *debug_ctx;
 
     if (!process->debugger || process->debugger != debugger)
@@ -464,23 +464,18 @@ int debugger_detach( struct process *process, struct thread *debugger )
     /* send continue indication for all events */
     debug_ctx = debugger->debug_ctx;
 
-    /* find the event in the queue
-     * FIXME: could loop on process' threads and look the debug_event field */
-    LIST_FOR_EACH_ENTRY( event, &debug_ctx->event_queue, struct debug_event, entry )
+    /* free all events from this process */
+    LIST_FOR_EACH_ENTRY_SAFE( event, next, &debug_ctx->event_queue, struct debug_event, entry )
     {
-        if (event->state != EVENT_QUEUED) continue;
-
-        if (event->sender->process == process)
-        {
-            assert( event->sender->debug_event == event );
-            event->status = DBG_CONTINUE;
-            event->state  = EVENT_CONTINUED;
-            wake_up( &event->obj, 0 );
-            unlink_event( debug_ctx, event );
-            /* from queued debug event */
-            resume_process( process );
-            break;
-        }
+        if (event->sender->process != process) continue;
+
+        assert( event->state != EVENT_CONTINUED );
+        event->status = DBG_CONTINUE;
+        event->state  = EVENT_CONTINUED;
+        wake_up( &event->obj, 0 );
+        unlink_event( debug_ctx, event );
+        /* from queued debug event */
+        resume_process( process );
     }
 
     /* remove relationships between process and its debugger */




More information about the wine-cvs mailing list