71 ! ! |
73 ! ! |
72 |
74 |
73 !VDBDebuggerConsoleApplication methodsFor:'event handling'! |
75 !VDBDebuggerConsoleApplication methodsFor:'event handling'! |
74 |
76 |
75 onCommandEvent: event |
77 onCommandEvent: event |
|
78 event command == outstandingCommand ifTrue:[ |
|
79 outstandingCommandToken := event token. |
|
80 ignoreNextLogStreamEvent := true. |
|
81 ]. |
76 |
82 |
77 "Created: / 06-06-2014 / 22:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
83 "Created: / 06-06-2014 / 22:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
84 "Modified: / 11-06-2014 / 12:35:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
78 ! |
85 ! |
79 |
86 |
80 onCommandResultEvent: event |
87 onCommandResultEvent: event |
|
88 outstandingCommandToken notNil ifTrue:[ |
|
89 event token == outstandingCommandToken ifTrue:[ |
|
90 outstandingCommand := outstandingCommandToken := nil. |
|
91 outstandingCommandBlocker signalForAll. |
|
92 ]. |
|
93 ]. |
81 |
94 |
82 "Created: / 06-06-2014 / 22:44:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
95 "Created: / 06-06-2014 / 22:44:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
83 "Modified: / 10-06-2014 / 01:33:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
96 "Modified: / 11-06-2014 / 11:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
84 ! |
97 ! |
85 |
98 |
86 onConsoleOutputEvent: event |
99 onLogOutputEvent: event |
87 consoleOutput nextPutAll: event value. |
100 ignoreNextLogStreamEvent ifTrue:[ |
88 consoleOutput nextPut: Character return. |
101 ignoreNextLogStreamEvent := false. |
89 |
102 ] ifFalse:[ |
90 "Created: / 06-06-2014 / 21:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
103 self onStreamOutputEvent: event |
91 "Modified: / 10-06-2014 / 01:33:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
104 ] |
92 ! |
105 |
93 |
106 "Created: / 11-06-2014 / 12:37:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
94 onTargetOutputEvent: event |
107 ! |
95 consoleOutput nextPutAll: event value. |
108 |
96 consoleOutput nextPut: Character return. |
109 onStreamOutputEvent: event |
97 |
110 event value asStringCollection do:[:line | |
98 "Created: / 06-06-2014 / 21:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
111 line notEmptyOrNil ifTrue:[ |
99 "Modified: / 10-06-2014 / 01:33:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
112 self showCR: line. |
|
113 ]. |
|
114 ]. |
|
115 |
|
116 "Created: / 11-06-2014 / 12:00:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
100 ! ! |
117 ! ! |
101 |
118 |
102 !VDBDebuggerConsoleApplication methodsFor:'hooks'! |
119 !VDBDebuggerConsoleApplication methodsFor:'hooks'! |
103 |
120 |
104 commonPostOpen |
121 commonPostOpen |
105 consoleProcess isNil ifTrue:[ |
122 consoleProcess isNil ifTrue:[ |
106 consoleProcess := |
123 consoleProcess := |
107 [ |
124 [ |
108 [ |
125 [ |
109 | cmd | |
126 | cmd | |
110 consoleOutput nextPutAll:'(gdb) '. |
127 self show: '(gdb) '. |
111 cmd := consoleInput nextLine asString. |
128 cmd := consoleInput nextLine asString. |
112 consoleOutput nextPutLine: cmd. |
129 self showCR: cmd. |
113 consoleOutput nextPut: Character return. |
130 debugger send: (outstandingCommand := GDBCLICommand new value: cmd) wait: false. |
114 debugger send: (GDBCLICommand new value: cmd) wait: true. |
131 outstandingCommandBlocker wait. |
115 ] loop. |
132 ] loop. |
116 ] newProcess. |
133 ] newProcess. |
117 consoleProcess name: 'VDB Debugger Console REPL loop'. |
134 consoleProcess name: 'VDB Debugger Console REPL loop'. |
118 consoleProcess resume. |
135 consoleProcess resume. |
119 ]. |
136 ]. |
120 |
137 |
121 "Created: / 10-06-2014 / 01:25:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
138 "Created: / 10-06-2014 / 01:25:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
122 "Modified: / 10-06-2014 / 19:55:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139 "Modified: / 11-06-2014 / 11:57:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
123 ! ! |
140 ! ! |
124 |
141 |
125 !VDBDebuggerConsoleApplication methodsFor:'initialization & release'! |
142 !VDBDebuggerConsoleApplication methodsFor:'initialization & release'! |
126 |
143 |
127 initialize |
144 initialize |
128 super initialize. |
145 super initialize. |
129 |
146 |
130 consoleInput := VDBInternalPipeStream new. |
147 consoleInput := VDBInternalPipeStream new. |
131 consoleOutput := VDBInternalPipeStream new. |
148 consoleOutput := VDBInternalPipeStream new. |
|
149 consoleOutputLock := RecursionLock new. |
|
150 outstandingCommandBlocker := Semaphore new. |
132 |
151 |
133 "Created: / 10-06-2014 / 01:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
152 "Created: / 10-06-2014 / 01:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
153 "Modified: / 11-06-2014 / 11:46:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
134 ! |
154 ! |
135 |
155 |
136 release |
156 release |
137 super release. |
157 super release. |
138 consoleProcess terminate. |
158 consoleProcess terminate. |
145 |
165 |
146 debugger announcer |
166 debugger announcer |
147 when: GDBCommandEvent send: #onCommandEvent: to: self; |
167 when: GDBCommandEvent send: #onCommandEvent: to: self; |
148 when: GDBCommandResultEvent send: #onCommandResultEvent: to: self; |
168 when: GDBCommandResultEvent send: #onCommandResultEvent: to: self; |
149 |
169 |
150 when: GDBConsoleOutputEvent send: #onConsoleOutputEvent: to: self; |
170 when: GDBConsoleOutputEvent send: #onStreamOutputEvent: to: self; |
151 when: GDBTargetOutputEvent send: #onTargetOutputEvent: to: self. |
171 when: GDBTargetOutputEvent send: #onStreamOutputEvent: to: self; |
|
172 when: GDBLogOutputEvent send: #onLogOutputEvent: to: self. |
152 |
173 |
153 "Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
174 "Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
175 "Modified: / 11-06-2014 / 12:38:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
176 ! ! |
|
177 |
|
178 !VDBDebuggerConsoleApplication methodsFor:'private - writing'! |
|
179 |
|
180 show: aString |
|
181 consoleOutputLock critical:[ |
|
182 consoleOutput nextPutAll: aString. |
|
183 ]. |
|
184 |
|
185 "Created: / 11-06-2014 / 08:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
186 "Modified: / 11-06-2014 / 11:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
187 ! |
|
188 |
|
189 showCR: aString |
|
190 consoleOutputLock critical:[ |
|
191 consoleOutput nextPutAll: aString. |
|
192 consoleOutput nextPut: Character nl. |
|
193 consoleOutput nextPut: Character return. |
|
194 ]. |
|
195 |
|
196 "Created: / 11-06-2014 / 08:02:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
197 "Modified: / 11-06-2014 / 11:56:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
154 ! ! |
198 ! ! |
155 |
199 |
156 !VDBDebuggerConsoleApplication class methodsFor:'documentation'! |
200 !VDBDebuggerConsoleApplication class methodsFor:'documentation'! |
157 |
201 |
158 version_HG |
202 version_HG |