46 eventQueueEmpty ifFalse:[ |
46 eventQueueEmpty ifFalse:[ |
47 event := eventQueue removeFirst. |
47 event := eventQueue removeFirst. |
48 ] |
48 ] |
49 ]. |
49 ]. |
50 eventQueueEmpty ifFalse:[ |
50 eventQueueEmpty ifFalse:[ |
51 self eventDispatchSingle: event. |
51 [ |
|
52 self eventDispatchSingle: event. |
|
53 ] on: Error do:[:ex | |
|
54 "/ Pass |
|
55 ]. |
52 ]. |
56 ]. |
53 ]. |
57 ]. |
54 eventQueueNotifier wait. |
58 eventQueueNotifier wait. |
55 ] loop. |
59 ] |
56 |
60 |
57 "Created: / 02-06-2014 / 22:51:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
61 "Created: / 02-06-2014 / 22:51:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
62 "Modified: / 03-06-2014 / 00:44:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
58 ! |
63 ! |
59 |
64 |
60 eventDispatchSingle: aGDBEvent |
65 eventDispatchSingle: aGDBEvent |
61 TraceEvents ifTrue:[ |
66 TraceEvents ifTrue:[ |
62 Logger log: ('Announcing: %1' bindWith: aGDBEvent) severity: #trace facility: 'GDB' originator: self attachment: aGDBEvent |
67 Logger log: ('Announcing: %1' bindWith: aGDBEvent class name) severity: #trace facility: 'GDB' |
63 ]. |
68 ]. |
64 eventAnnouncer announce: aGDBEvent |
69 eventAnnouncer announce: aGDBEvent |
65 |
70 |
66 "Created: / 02-06-2014 / 22:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
71 "Created: / 02-06-2014 / 22:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
72 "Modified: / 03-06-2014 / 00:12:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
67 ! |
73 ! |
68 |
74 |
69 eventDispatchStart |
75 eventDispatchStart |
70 eventDispatchProcess isNil ifTrue:[ |
76 eventDispatchProcess isNil ifTrue:[ |
71 eventDispatchProcess := [ |
77 eventDispatchProcess := [ |
72 self eventDispatchLoop |
78 self eventDispatchLoop |
73 ] newProcess. |
79 ] newProcess. |
74 eventDispatchProcess name:('GDB Event dispatcher (%1)' bindWith:pid). |
80 eventDispatchProcess name:('GDB Event dispatcher (%1)' bindWith:pid). |
75 eventDispatchProcess priority:Processor userBackgroundPriority. |
81 eventDispatchProcess priority:Processor userBackgroundPriority. |
76 eventDispatchProcess addExitAction:[ eventDispatchProcess := nil. ]. |
82 eventDispatchProcess addExitAction:[ eventDispatchProcess := nil. ]. |
|
83 eventDispatchProcess resume. |
77 ]. |
84 ]. |
78 |
85 |
79 "Created: / 02-06-2014 / 22:51:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
86 "Created: / 02-06-2014 / 22:51:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
87 "Modified: / 02-06-2014 / 23:58:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
80 ! |
88 ! |
81 |
89 |
82 eventDispatchStop |
90 eventDispatchStop |
83 | t | |
91 | t | |
84 |
92 |
98 onCommand: aGDBCommandEvent |
106 onCommand: aGDBCommandEvent |
99 | command | |
107 | command | |
100 |
108 |
101 command := aGDBCommandEvent command. |
109 command := aGDBCommandEvent command. |
102 command token notNil ifTrue:[ |
110 command token notNil ifTrue:[ |
103 output nextPutLine: command token printString. |
111 input nextPutAll: command token printString. |
104 ]. |
112 ]. |
105 output nextPutLine: command asString. |
113 input nextPutLine: command asString. |
106 |
114 |
107 "Created: / 02-06-2014 / 23:38:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
115 "Created: / 02-06-2014 / 23:38:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
108 ! ! |
116 ! ! |
109 |
117 |
110 !GDBDriver methodsFor:'event pump'! |
118 !GDBDriver methodsFor:'event pump'! |
114 |
122 |
115 parser := GDBParser on: output. |
123 parser := GDBParser on: output. |
116 [ output atEnd ] whileFalse:[ |
124 [ output atEnd ] whileFalse:[ |
117 | eventset | |
125 | eventset | |
118 |
126 |
119 eventset := parser parseOutput. |
127 [ |
120 self pushEventSet: eventset. |
128 [ |
|
129 eventset := parser parseOutput. |
|
130 ] on: StreamNotOpenError do:[ |
|
131 ^ self. |
|
132 ]. |
|
133 self pushEventSet: eventset. |
|
134 ] on: AbortOperationRequest do:[ |
|
135 | terminator i c | |
|
136 |
|
137 terminator := '(gdb)'. |
|
138 i := 1. |
|
139 output notNil ifTrue:[ |
|
140 [ output atEnd not and: [i <= terminator size ] ] whileTrue:[ |
|
141 c := output next. |
|
142 c == (terminator at: i) ifTrue:[ |
|
143 i := i + 1. |
|
144 ] ifFalse:[ |
|
145 i := 1. |
|
146 ]. |
|
147 ]. |
|
148 output next. "/ read nl. |
|
149 ] ifFalse:[ |
|
150 ^ self. |
|
151 ]. |
|
152 ] |
121 ] |
153 ] |
122 |
154 |
123 "Created: / 02-06-2014 / 22:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
155 "Created: / 02-06-2014 / 22:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
156 "Modified: / 03-06-2014 / 00:54:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
124 ! |
157 ! |
125 |
158 |
126 eventPumpStart |
159 eventPumpStart |
127 eventPumpProcess isNil ifTrue:[ |
160 eventPumpProcess isNil ifTrue:[ |
128 eventPumpProcess := [ |
161 eventPumpProcess := [ |
129 self eventPumpLoop |
162 self eventPumpLoop |
130 ] newProcess. |
163 ] newProcess. |
131 eventPumpProcess name:('GDB Event pump (%1)' bindWith:pid). |
164 eventPumpProcess name:('GDB Event pump (%1)' bindWith:pid). |
132 eventPumpProcess priority:Processor userBackgroundPriority. |
165 eventPumpProcess priority:Processor userBackgroundPriority. |
133 eventPumpProcess addExitAction:[ eventPumpProcess := nil. ]. |
166 eventPumpProcess addExitAction:[ eventPumpProcess := nil. ]. |
|
167 eventPumpProcess resume. |
134 ]. |
168 ]. |
135 |
169 |
136 "Created: / 02-06-2014 / 22:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
170 "Created: / 02-06-2014 / 22:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
171 "Modified: / 02-06-2014 / 23:58:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
137 ! |
172 ! |
138 |
173 |
139 eventPumpStop |
174 eventPumpStop |
140 | t | |
175 | t | |
141 |
176 |
188 "Modified: / 02-06-2014 / 23:39:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
223 "Modified: / 02-06-2014 / 23:39:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
189 ! |
224 ! |
190 |
225 |
191 release |
226 release |
192 pid notNil ifTrue:[ |
227 pid notNil ifTrue:[ |
193 self eventPumpStop. |
|
194 self eventDispatchStop. |
|
195 OperatingSystem sendSignal:(OperatingSystem sigKILL) to:pid. |
228 OperatingSystem sendSignal:(OperatingSystem sigKILL) to:pid. |
196 ] |
229 ] |
197 |
230 |
198 "Created: / 26-05-2014 / 21:30:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
231 "Created: / 26-05-2014 / 21:30:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
199 "Modified: / 02-06-2014 / 23:41:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
232 "Modified: / 03-06-2014 / 00:55:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
200 ! |
233 ! |
201 |
234 |
202 released: status |
235 released: status |
203 pid := nil. |
236 pid := nil. |
204 self eventPumpStop. |
|
205 self eventDispatchStop. |
|
206 |
|
207 input notNil ifTrue:[ |
237 input notNil ifTrue:[ |
208 input close. |
238 input close. |
209 input := nil. |
239 input := nil. |
210 ]. |
240 ]. |
211 output notNil ifTrue:[ |
241 output notNil ifTrue:[ |
212 output close. |
242 output close. |
213 output := nil. |
243 output := nil. |
214 ]. |
244 ]. |
215 |
245 |
216 "Created: / 26-05-2014 / 21:31:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
246 "Created: / 26-05-2014 / 21:31:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
217 "Modified: / 02-06-2014 / 23:42:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
247 "Modified: / 03-06-2014 / 00:46:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
218 ! ! |
248 ! ! |
219 |
249 |
220 !GDBDriver class methodsFor:'documentation'! |
250 !GDBDriver class methodsFor:'documentation'! |
221 |
251 |
222 version_HG |
252 version_HG |