Changed GDBDebugger>>send:wait: to block until event set finishes.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 24 Sep 2014 09:46:37 +0100
changeset 46 d06a04ecc788
parent 45 deb908479a37
child 47 4f5d75acecb0
Changed GDBDebugger>>send:wait: to block until event set finishes. In other words, method returns after command finished and all event handlers processed (except those for GDBEventSetFinishedEvent). Not really sure this is good idea...
GDBDebugger.st
GDBMI_var_info_num_children.st
libgdbs.rc
tests/GDBSimulatorProcessTests.st
tests/tests.rc
--- 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'!
--- a/GDBMI_var_info_num_children.st	Tue Sep 23 23:48:13 2014 +0100
+++ b/GDBMI_var_info_num_children.st	Wed Sep 24 09:46:37 2014 +0100
@@ -37,3 +37,10 @@
 	^ 'var-info-num-children'
 ! !
 
+!GDBMI_var_info_num_children class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/libgdbs.rc	Tue Sep 23 23:48:13 2014 +0100
+++ b/libgdbs.rc	Wed Sep 24 09:46:37 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Tue, 23 Sep 2014 22:46:15 GMT\0"
+      VALUE "ProductDate", "Wed, 24 Sep 2014 08:42:21 GMT\0"
     END
 
   END
--- a/tests/GDBSimulatorProcessTests.st	Tue Sep 23 23:48:13 2014 +0100
+++ b/tests/GDBSimulatorProcessTests.st	Wed Sep 24 09:46:37 2014 +0100
@@ -31,16 +31,17 @@
     self assert: events isEmpty.
 
     debugger send: (GDBMI_file_exec_and_symbols new arguments: {'/home/jv/Private/Projects/SmalltalkX/sources/branches/jv1/build/jv/libgdbs/tests/c/factorial'}).
+    Delay waitForMilliseconds: 100.
 
-    self assert: events size == 2.
+    self assert: events size == 4.
     self assert: events first class == GDBCommandEvent.
     self assert: events first command class == GDBMI_file_exec_and_symbols.
         
-    self assert: events second class == GDBCommandResultEvent.
-    self assert: events second result command == events first command.
+    self assert: events third class == GDBCommandResultEvent.
+    self assert: events third result command == events first command.
 
     "Created: / 24-06-2014 / 13:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 05-07-2014 / 22:54:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-09-2014 / 09:29:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 test_02
@@ -55,15 +56,16 @@
     self assert: events isEmpty.
 
     debugger send: (GDBMI_file_exec_and_symbols new arguments: {'bla bla'}).
+    Delay waitForMilliseconds: 100.
 
-    self assert: events size == 4.
+    self assert: events size == 6.
     self assert: events first class == GDBCommandEvent.
     self assert: events first command class == GDBMI_file_exec_and_symbols.
         
-    self assert: events second class == GDBCommandResultEvent.
-    self assert: events second result command == events first command.
+    self assert: events third class == GDBCommandResultEvent.
+    self assert: events third result command == events first command.
 
     "Created: / 05-07-2014 / 22:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 06-09-2014 / 00:46:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-09-2014 / 09:41:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/tests/tests.rc	Tue Sep 23 23:48:13 2014 +0100
+++ b/tests/tests.rc	Wed Sep 24 09:46:37 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Tue, 23 Sep 2014 22:46:17 GMT\0"
+      VALUE "ProductDate", "Wed, 24 Sep 2014 08:42:23 GMT\0"
     END
 
   END