|
1 " |
|
2 jv:vdb - Visual / VM Debugger |
|
3 Copyright (C) 2015-now Jan Vrany |
|
4 |
|
5 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' |
|
6 |
|
7 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ |
|
8 " |
|
9 "{ Package: 'jv:vdb' }" |
|
10 |
|
11 "{ NameSpace: Smalltalk }" |
|
12 |
|
13 VDBAbstractUnixConsoleApplication subclass:#VDBUnixReplayServerConsoleApplication |
|
14 instanceVariableNames:'rrHolder rr' |
|
15 classVariableNames:'' |
|
16 poolDictionaries:'' |
|
17 category:'VDB-UI-Console-Unix' |
|
18 ! |
|
19 |
|
20 !VDBUnixReplayServerConsoleApplication class methodsFor:'documentation'! |
|
21 |
|
22 copyright |
|
23 " |
|
24 jv:vdb - Visual / VM Debugger |
|
25 Copyright (C) 2015-now Jan Vrany |
|
26 |
|
27 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' |
|
28 |
|
29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ |
|
30 " |
|
31 ! ! |
|
32 |
|
33 !VDBUnixReplayServerConsoleApplication class methodsFor:'accessing'! |
|
34 |
|
35 windowTitle |
|
36 ^ 'Replay Console' |
|
37 |
|
38 "Created: / 26-07-2018 / 17:12:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
39 ! ! |
|
40 |
|
41 !VDBUnixReplayServerConsoleApplication methodsFor:'accessing'! |
|
42 |
|
43 consoleInput |
|
44 "superclass VDBAbstractConsoleApplication says that I am responsible to implement this method" |
|
45 |
|
46 ^ rr consoleInput |
|
47 |
|
48 "Modified: / 26-07-2018 / 17:14:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
49 ! |
|
50 |
|
51 consoleOutput |
|
52 "superclass VDBAbstractConsoleApplication says that I am responsible to implement this method" |
|
53 |
|
54 ^ rr consoleOutput |
|
55 |
|
56 "Modified: / 26-07-2018 / 17:14:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
57 ! ! |
|
58 |
|
59 !VDBUnixReplayServerConsoleApplication methodsFor:'acessing'! |
|
60 |
|
61 rr |
|
62 ^ rr |
|
63 |
|
64 "Created: / 26-07-2018 / 17:17:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
65 ! |
|
66 |
|
67 rr: aRR |
|
68 self rrHolder value: aRR |
|
69 |
|
70 "Created: / 26-07-2018 / 17:17:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
71 ! ! |
|
72 |
|
73 !VDBUnixReplayServerConsoleApplication methodsFor:'aspects'! |
|
74 |
|
75 consoleView |
|
76 consoleView isNil ifTrue:[ |
|
77 consoleView :=VT100TerminalView new. |
|
78 consoleView foregroundColor: Color white |
|
79 backgroundColor: Color black; |
|
80 cursorForegroundColor: Color white |
|
81 backgroundColor: Color white. |
|
82 rr notNil ifTrue:[ |
|
83 consoleView inStream: self consoleInput. |
|
84 consoleView outStream: self consoleOutput. |
|
85 consoleView startReaderProcessWhenVisible. |
|
86 ]. |
|
87 ]. |
|
88 ^ consoleView |
|
89 |
|
90 "Created: / 26-07-2018 / 20:27:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
91 ! |
|
92 |
|
93 rrHolder |
|
94 "return/create the 'debuggerHolder' value holder (automatically generated)" |
|
95 |
|
96 rrHolder isNil ifTrue:[ |
|
97 rrHolder := ValueHolder new. |
|
98 rrHolder addDependent:self. |
|
99 ]. |
|
100 ^ rrHolder |
|
101 |
|
102 "Created: / 26-07-2018 / 17:17:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
103 ! |
|
104 |
|
105 rrHolder:aValueModel |
|
106 "set the 'debuggerHolder' value holder (automatically generated)" |
|
107 |
|
108 |oldValue newValue| |
|
109 |
|
110 rrHolder notNil ifTrue:[ |
|
111 oldValue := rrHolder value. |
|
112 rrHolder removeDependent:self. |
|
113 ]. |
|
114 rrHolder := aValueModel. |
|
115 rrHolder notNil ifTrue:[ |
|
116 rrHolder addDependent:self. |
|
117 ]. |
|
118 newValue := rrHolder value. |
|
119 oldValue ~~ newValue ifTrue:[ |
|
120 self update:#value with:newValue from:rrHolder. |
|
121 ]. |
|
122 |
|
123 "Created: / 26-07-2018 / 17:18:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
124 ! ! |
|
125 |
|
126 !VDBUnixReplayServerConsoleApplication methodsFor:'change & update'! |
|
127 |
|
128 update:something with:aParameter from:changedObject |
|
129 "Invoked when an object that I depend upon sends a change notification." |
|
130 |
|
131 changedObject == rrHolder ifTrue:[ |
|
132 rrHolder value == rr ifFalse:[ |
|
133 rr notNil ifTrue:[ |
|
134 self unsubscribe. |
|
135 ]. |
|
136 rr := rrHolder value. |
|
137 rr notNil ifTrue:[ |
|
138 self subscribe. |
|
139 ]. |
|
140 ]. |
|
141 ^ self. |
|
142 ]. |
|
143 super update:something with:aParameter from:changedObject |
|
144 |
|
145 "Created: / 26-07-2018 / 17:19:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
146 ! ! |
|
147 |
|
148 !VDBUnixReplayServerConsoleApplication methodsFor:'event handling'! |
|
149 |
|
150 onRRExitEvent: anRRTerminaedEvent |
|
151 consoleView notNil ifTrue:[ |
|
152 | status info | |
|
153 status := anRRTerminaedEvent status. |
|
154 consoleView cr. |
|
155 (status success or:[status status == #signal and:[status code == UnixOperatingSystem sigTERM]]) ifTrue:[ |
|
156 info := resources string: '>> replay server terminated' |
|
157 ] ifFalse:[status isError ifTrue:[ |
|
158 info := resources string: '>> replay server terminated (with status %1)' with: anRRTerminaedEvent status code. |
|
159 ] ifFalse:[status status == #signal ifTrue:[ |
|
160 info := resources string: '>> replay server crashed (signal %1)' with: anRRTerminaedEvent status code. |
|
161 ]]]. |
|
162 consoleView nextPutLine: (info asText allBold colorizeAllWith:Color red). |
|
163 ]. |
|
164 |
|
165 "Created: / 31-07-2018 / 08:52:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
166 ! |
|
167 |
|
168 onRRStartEvent: anRRStartedEvent |
|
169 |
|
170 "Created: / 31-07-2018 / 08:52:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
171 ! ! |
|
172 |
|
173 !VDBUnixReplayServerConsoleApplication methodsFor:'initialization & release'! |
|
174 |
|
175 subscribe |
|
176 "Register for debugger events. To be overrided by subclasses" |
|
177 |
|
178 super subscribe. |
|
179 rr notNil ifTrue:[ |
|
180 (rr announcer) |
|
181 when:RRStartEvent |
|
182 send:#onRRStartEvent: |
|
183 to:self; |
|
184 when:RRExitEvent |
|
185 send:#onRRExitEvent: |
|
186 to:self. |
|
187 consoleView notNil ifTrue:[ |
|
188 consoleView stopReaderProcess. |
|
189 consoleView inStream:self consoleInput. |
|
190 consoleView outStream:self consoleOutput. |
|
191 consoleView startReaderProcessWhenVisible. |
|
192 ]. |
|
193 ]. |
|
194 |
|
195 "Created: / 26-07-2018 / 17:19:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
196 "Modified: / 31-07-2018 / 08:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
197 ! |
|
198 |
|
199 unsubscribe |
|
200 "Unsubscribe myself fo debugger events" |
|
201 |
|
202 super unsubscribe. |
|
203 rr notNil ifTrue:[ |
|
204 rr announcer unsubscribe: self. |
|
205 ]. |
|
206 consoleView notNil ifTrue:[ |
|
207 consoleView stopReaderProcess. |
|
208 consoleView inStream: nil. |
|
209 consoleView outStream: nil. |
|
210 ]. |
|
211 |
|
212 "Created: / 26-07-2018 / 17:20:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
213 "Modified: / 31-07-2018 / 08:38:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
214 ! ! |
|
215 |
|
216 !VDBUnixReplayServerConsoleApplication methodsFor:'startup & release'! |
|
217 |
|
218 closeRequest |
|
219 (rr notNil and:[ rr running ]) ifTrue:[ |
|
220 (Dialog confirm: (resources string: 'Replay Server is running. Stop server and close?')) ifFalse:[ |
|
221 ^ self. |
|
222 ]. |
|
223 rr stop. |
|
224 ]. |
|
225 ^ super closeRequest. |
|
226 |
|
227 "Created: / 27-07-2018 / 07:49:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
228 ! ! |
|
229 |