--- a/VDBSimpleDebuggerConsoleApplication.st Sat Jan 19 23:28:30 2019 +0000
+++ b/VDBSimpleDebuggerConsoleApplication.st Sun Jan 20 00:06:22 2019 +0000
@@ -14,7 +14,7 @@
instanceVariableNames:'consoleView consoleInput consoleOutput consoleOutputLock
consoleProcess consolePrompt consolePromptPrinted
outstandingCommand outstandingCommandToken
- outstandingCommandBlocker ignoreNextLogStreamEvent'
+ outstandingCommandBlocker ignoreNextLogStreamEvent running'
classVariableNames:''
poolDictionaries:'GDBCommandStatus'
category:'VDB-UI-Console'
@@ -229,6 +229,21 @@
"Modified: / 30-12-2018 / 22:03:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+onRunningEvent: event
+ running := true.
+ consoleView readOnly: true.
+
+ "Created: / 19-01-2019 / 23:46:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+onStoppedEvent: event
+ running := false.
+ consoleView readOnly: false.
+ self showPrompt.
+
+ "Created: / 19-01-2019 / 23:46:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
onStreamOutputEvent: event
consolePromptPrinted ifTrue:[ self showCR:'' ].
consolePromptPrinted := false.
@@ -248,29 +263,14 @@
consoleProcess isNil ifTrue:[
consoleProcess :=
[
- [
- | cmdLine cmd |
- self showPrompt.
- cmdLine := consoleInput nextLine asString.
- consolePromptPrinted := false.
- self showCR: cmdLine.
- cmdLine notEmptyOrNil ifTrue:[
- cmd := GDBCommand parse: cmdLine.
- cmd isCLICommand ifTrue:[
- cmd runOnBackground: true.
- ].
- outstandingCommand := cmd.
- debugger send:cmd andWait:false.
- outstandingCommandBlocker wait.
- ]
- ] loop.
+ [ self consoleProcess1Command ] loop.
] newProcess.
consoleProcess name: 'VDB Debugger Console REPL loop'.
consoleProcess resume.
].
"Created: / 10-06-2014 / 01:25:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2019 / 23:05:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-01-2019 / 23:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
postBuildConsoleView: aTextCollector
@@ -295,12 +295,13 @@
consoleOutputLock := RecursionLock new.
consolePrompt := '(vdb) '.
consolePromptPrinted := false.
+ running := false.
outstandingCommandBlocker := Semaphore new.
ignoreNextLogStreamEvent := false.
"Created: / 10-06-2014 / 01:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 07-04-2018 / 23:13:27 / jv"
- "Modified: / 19-01-2019 / 21:49:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-01-2019 / 23:55:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeCompletion
@@ -328,6 +329,9 @@
when: GDBCommandEvent send: #onCommandEvent: to: self;
when: GDBCommandResultEvent send: #onCommandResultEvent: to: self;
+ when: GDBRunningEvent send: #onRunningEvent: to: self;
+ when: GDBStoppedEvent send: #onStoppedEvent: to: self;
+
when: GDBConsoleOutputEvent send: #onStreamOutputEvent: to: self;
when: GDBTargetOutputEvent send: #onStreamOutputEvent: to: self;
when: GDBLogOutputEvent send: #onLogOutputEvent: to: self;
@@ -338,10 +342,36 @@
consolePrompt := debugger getParameter: 'prompt'.
+ running := debugger inferiors anySatisfy:[ :tg | tg isRunning ].
+
self initializeCompletion.
"Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-01-2019 / 22:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-01-2019 / 23:51:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBSimpleDebuggerConsoleApplication methodsFor:'private - console process'!
+
+consoleProcess1Command
+ | cmdLine cmd |
+
+ self showPrompt.
+ cmdLine := consoleInput nextLine asString.
+ consolePromptPrinted := false.
+ self showCR: cmdLine.
+ cmdLine notEmptyOrNil ifTrue:[
+ cmd := GDBCommand parse: cmdLine.
+ cmd isCLICommand ifTrue:[
+ cmd runOnBackground: true.
+ ].
+ outstandingCommand := cmd.
+ consoleView readOnly:true.
+ debugger send:cmd andWait:false.
+ outstandingCommandBlocker wait.
+ consoleView readOnly:false.
+ ]
+
+ "Created: / 19-01-2019 / 23:49:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSimpleDebuggerConsoleApplication methodsFor:'private - writing'!
@@ -365,13 +395,14 @@
!
showPrompt
- consolePromptPrinted ifFalse:[
+ (running not and: [consolePromptPrinted not]) ifTrue:[
self show: consolePrompt.
consolePromptPrinted := true.
].
"Created: / 18-09-2014 / 23:18:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 04-04-2018 / 23:01:24 / jv"
+ "Modified: / 19-01-2019 / 23:58:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBSimpleDebuggerConsoleApplication class methodsFor:'documentation'!