GDBDriver.st
changeset 18 6bf3d5c400d1
parent 11 474fbb650afe
child 19 c48d33e27d34
--- a/GDBDriver.st	Thu Jun 19 10:10:52 2014 +0100
+++ b/GDBDriver.st	Thu Jun 19 22:16:26 2014 +0100
@@ -3,7 +3,7 @@
 Object subclass:#GDBDriver
 	instanceVariableNames:'pid debuggerInput debuggerOutput inferiorPTY eventAnnouncer
 		eventQueue eventQueueLock eventQueueNotifier eventDispatchProcess
-		eventPumpProcess'
+		eventPumpProcess outstandingCommands'
 	classVariableNames:''
 	poolDictionaries:'GDBDebugFlags'
 	category:'GDB-Private'
@@ -122,9 +122,11 @@
     command token notNil ifTrue:[ 
         debuggerInput nextPutAll: command token printString.
     ].
+    outstandingCommands add: command.
     debuggerInput nextPutLine: command asString.
 
     "Created: / 02-06-2014 / 23:38:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-06-2014 / 22:08:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GDBDriver methodsFor:'event pump'!
@@ -133,6 +135,13 @@
     | parser |
 
     parser := GDBParser on: debuggerOutput.
+    parser token2CommandMappingBlock:[ :token | 
+        | command |
+
+        command :=  outstandingCommands detect:[:cmd | cmd token == token ] ifNone:[nil].
+        command notNil ifTrue:[ outstandingCommands remove: command ].
+        command
+    ].
     [ debuggerOutput atEnd ] whileFalse:[ 
         | eventset |
 
@@ -165,7 +174,7 @@
     ]
 
     "Created: / 02-06-2014 / 22:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 03-06-2014 / 00:54:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-06-2014 / 22:10:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 eventPumpStart
@@ -236,12 +245,14 @@
     eventQueueLock := RecursionLock new.
     eventQueueNotifier := Semaphore new.
     eventAnnouncer := Announcer new.
+    outstandingCommands := Set new.
     eventAnnouncer 
         when:GDBCommandEvent
         send:#onCommand:
         to:self.
 
     "Created: / 09-06-2014 / 18:21:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-06-2014 / 22:08:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 release