GDBDebugger.st
changeset 46 d06a04ecc788
parent 41 fb48207b6104
child 48 330aa6df3dfb
--- a/GDBDebugger.st	Tue Sep 23 23:48:13 2014 +0100
+++ b/GDBDebugger.st	Wed Sep 24 09:46:37 2014 +0100
@@ -115,7 +115,7 @@
     "Sends given command to GDB. If `aBoolean` is true, wait for
      command to finish. Otherwise, return immediately."
 
-    | token blocker releaser result |
+    | token blocker handler1 handler2 result |
 
     (aBoolean and:[Processor activeProcess == connection eventDispatchProcess]) ifTrue:[ 
         self error: 'Cannot send commands from within event dispatching process. Would deadlock'.
@@ -124,14 +124,18 @@
     token := self nextCommandSequnceNumber.
     aGDBCommand token: token.
     ^ aBoolean ifTrue:[ 
-        releaser := [ :ev |
+        handler1 := [ :ev |
                     ev token == token ifTrue:[ 
-                        self announcer unsubscribe: releaser.
+                        connection eventAnnouncer unsubscribe: handler1.
                         result := ev result.
-                        blocker signal.
+                        connection eventAnnouncerInternal when: GDBEventSetProcessingFinished do: handler2. 
                     ]].
+        handler2 := [ :ev |
+                    connection eventAnnouncerInternal unsubscribe: handler2.         
+                    blocker signal.
+                    ].
         blocker := Semaphore new.
-        self announcer when: GDBCommandResultEvent do: releaser.
+        connection eventAnnouncer when: GDBCommandResultEvent do: handler1.
         connection pushEvent: (GDBCommandEvent new command: aGDBCommand).
         blocker wait.
         result.
@@ -141,7 +145,7 @@
     ]
 
     "Created: / 02-06-2014 / 23:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 18-09-2014 / 00:14:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-09-2014 / 09:25:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GDBDebugger methodsFor:'event handling'!