Show log output in simple console
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 13 Mar 2019 14:07:49 +0000
changeset 149 adaffe052a41
parent 148 7d2d523173af
child 150 2bd269c89e8c
Show log output in simple console This needed because, for example, python errors and stacktrace is reported on log stream, not on output stream.
VDBSimpleDebuggerConsoleApplication.st
--- a/VDBSimpleDebuggerConsoleApplication.st	Wed Mar 13 13:54:14 2019 +0000
+++ b/VDBSimpleDebuggerConsoleApplication.st	Wed Mar 13 14:07:49 2019 +0000
@@ -11,7 +11,7 @@
 "{ NameSpace: Smalltalk }"
 
 VDBAbstractConsoleApplication subclass:#VDBSimpleDebuggerConsoleApplication
-	instanceVariableNames:'prompt promptPrinted running'
+	instanceVariableNames:'prompt promptPrinted running ignoreNextLogEvent'
 	classVariableNames:''
 	poolDictionaries:'GDBCommandStatus'
 	category:'VDB-UI-Console'
@@ -111,18 +111,17 @@
             ].
         ]].
     ].
-    consoleView readOnly:true.  
+    consoleView readOnly:true. 
+    ignoreNextLogEvent := true.
     debugger send:cmd andWithResultDo:[:result| 
-        result isError ifTrue:[ 
-            consoleView showCR: (result propertyAt: #msg)
-        ].
         consoleView readOnly:false.
+        ignoreNextLogEvent := false.
         self showPrompt.
     ].
 
     "Created: / 25-01-2019 / 12:12:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 29-01-2019 / 09:37:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (format): / 13-03-2019 / 12:56:04 / jv"
+    "Modified: / 13-03-2019 / 14:02:22 / jv"
 ! !
 
 !VDBSimpleDebuggerConsoleApplication methodsFor:'aspects'!
@@ -143,6 +142,16 @@
     "Created: / 19-01-2019 / 22:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+onLogOutputEvent: event
+    ignoreNextLogEvent ifTrue:[
+        ignoreNextLogEvent := false.
+    ] ifFalse:[
+        self onStreamOutputEvent: event
+    ].
+
+    "Created: / 13-03-2019 / 13:59:39 / jv"
+!
+
 onRunningEvent: event
     running := true.
     consoleView readOnly: true.
@@ -188,10 +197,11 @@
     prompt := '(gdb) '.
     promptPrinted := false.
     running := false.
+    ignoreNextLogEvent := false
 
     "Created: / 10-06-2014 / 01:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 07-04-2018 / 23:13:27 / jv"
     "Modified: / 25-01-2019 / 22:01:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-03-2019 / 14:01:53 / jv"
 !
 
 initializeConsoleView: view
@@ -232,6 +242,7 @@
         when: GDBStoppedEvent           send: #onStoppedEvent:          to: self;
 
         when: GDBConsoleOutputEvent     send: #onStreamOutputEvent:     to: self;
+        when: GDBLogOutputEvent         send: #onLogOutputEvent:        to: self;
         when: GDBTargetOutputEvent      send: #onStreamOutputEvent:     to: self;
 
         when: GDBCmdParamChangedEvent   send: #onCmdParamChanged:       to: self.
@@ -240,6 +251,7 @@
 
     "Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 25-01-2019 / 12:33:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-03-2019 / 13:59:19 / jv"
 ! !
 
 !VDBSimpleDebuggerConsoleApplication methodsFor:'private'!