189 "Created: / 12-12-2017 / 21:04:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
189 "Created: / 12-12-2017 / 21:04:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
190 "Modified: / 15-01-2018 / 09:35:03 / jv" |
190 "Modified: / 15-01-2018 / 09:35:03 / jv" |
191 "Modified: / 21-10-2018 / 08:06:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
191 "Modified: / 21-10-2018 / 08:06:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
192 ! |
192 ! |
193 |
193 |
|
194 initializeWithCommand: command |
|
195 | inputPipe input outputPipe output errorPipe error argv | |
|
196 |
|
197 argv := (self command2argv: command) , |
|
198 ((Array new: 6) |
|
199 at: 1 put: '-q'; |
|
200 at: 2 put: '-nx'; |
|
201 at: 3 put: '--interpreter'; |
|
202 at: 4 put: 'mi2'; |
|
203 at: 5 put: '-ex'; |
|
204 at: 6 put: 'set new-console on'; |
|
205 yourself). |
|
206 |
|
207 inputPipe := NonPositionableExternalStream makePipe. |
|
208 input := inputPipe second. |
|
209 outputPipe := NonPositionableExternalStream makePipe. |
|
210 output := outputPipe first. |
|
211 errorPipe := NonPositionableExternalStream makePipe. |
|
212 error := outputPipe first. |
|
213 |
|
214 |
|
215 Processor |
|
216 monitor:[ |
|
217 pid := OperatingSystem |
|
218 exec:argv first |
|
219 withArguments:argv |
|
220 environment:OperatingSystem getEnvironment |
|
221 fileDescriptors: (Array |
|
222 with: inputPipe first fileDescriptor |
|
223 with: outputPipe second fileDescriptor |
|
224 with: errorPipe second fileDescriptor |
|
225 ) |
|
226 fork:true |
|
227 newPgrp:false |
|
228 inDirectory:Filename currentDirectory |
|
229 showWindow: false. |
|
230 debuggerInput := input. |
|
231 debuggerOutput := output. |
|
232 debuggerError := error. |
|
233 pid. |
|
234 ] |
|
235 action:[:stat | self exited:stat. ]. |
|
236 inputPipe first close. |
|
237 outputPipe second close. |
|
238 errorPipe second close. |
|
239 pid isNil ifTrue:[ |
|
240 input close. |
|
241 output close. |
|
242 error close. |
|
243 self error:'Failed to launch gdb'. |
|
244 ]. |
|
245 |
|
246 "Created: / 12-12-2018 / 20:13:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
247 "Modified: / 17-12-2018 / 10:51:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
248 ! |
|
249 |
194 release |
250 release |
195 pid := connection := nil. |
251 pid := connection := nil. |
196 debuggerInput notNil ifTrue:[ debuggerInput close ]. |
252 debuggerInput notNil ifTrue:[ debuggerInput close ]. |
197 debuggerOutput notNil ifTrue:[ debuggerOutput close ]. |
253 debuggerOutput notNil ifTrue:[ debuggerOutput close ]. |
198 |
254 |