GDBConnection.st
changeset 79 303c4edc75ad
parent 78 c24e7d8bc881
child 85 6fea1000a2a5
--- a/GDBConnection.st	Fri May 26 08:05:28 2017 +0100
+++ b/GDBConnection.st	Thu Jun 01 12:15:43 2017 +0100
@@ -28,6 +28,18 @@
 
 !GDBConnection methodsFor:'accessing'!
 
+consoleInput
+    ^ process consoleInput
+
+    "Created: / 02-06-2017 / 23:34:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+consoleOutput
+    ^ process consoleOutput
+
+    "Created: / 02-06-2017 / 23:35:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 eventAnnouncer
     ^ eventAnnouncer
 !
@@ -165,7 +177,7 @@
 !GDBConnection methodsFor:'event pump'!
 
 eventPumpLoop
-    | parser |
+    | parser done |
 
     parser := GDBMIParser on:process debuggerOutput.
     parser 
@@ -182,14 +194,22 @@
         ].
     parser recorder:recorder.
     parser parsePostStartHeader.
+    done := false.
     [
-        process debuggerOutput atEnd
+        [
+            done or:[ process debuggerOutput atEnd ]
+        ] on: TerminateProcessRequest do:[:request| 
+            done := true.    
+        ].
     ] whileFalse:[
         | eventset |
 
         [
             [
                 eventset := parser parseOutput.
+                (eventset contains:[:each | each isCommandResultEvent and:[ each status == #exit] ]) ifTrue:[ 
+                    done := true.
+                ].
             ] on:StreamNotOpenError do:[ ^ self. ].
             self pushEventSet:eventset.
         ] on:AbortOperationRequest do:[
@@ -213,7 +233,7 @@
     ]
 
     "Created: / 02-06-2014 / 22:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 01-03-2015 / 08:26:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2017 / 22:22:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 eventPumpStart
@@ -308,24 +328,18 @@
 !
 
 released: status
+    self pushEvent: GDBExitEvent new.  
     TraceProcesses ifTrue:[ 
         Logger log: ('gdb process: exited with status %1' bindWith: status code)  severity: #trace facility: 'GDB'.
-    ].
-    TraceProcesses ifTrue:[ 
         Logger log: 'gdb process: waiting for event pump to finish' severity: #trace facility: 'GDB'.
     ].
-    [ eventPumpProcess notNil ] whileTrue:[ 
-        Delay waitForMilliseconds: 200.  
-    ].
-    TraceProcesses ifTrue:[ 
-        Logger log: ('gdb process: event pump finished' bindWith: status code)  severity: #trace facility: 'GDB'.
-    ].
+    self eventPumpStop.
     eventQueueNotifier signalForAll.           
     process release.
     inferiorPTY release.
 
     "Created: / 26-05-2014 / 21:31:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 25-08-2014 / 08:55:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2017 / 22:24:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GDBConnection class methodsFor:'documentation'!