author | Claus Gittinger <cg@exept.de> |
Sat, 11 Nov 1995 16:41:09 +0100 | |
changeset 165 | df29ee4514c1 |
parent 155 | 33c9fa03fc79 |
child 167 | 1fc176fd017e |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
45 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
73 | 13 |
'From Smalltalk/X, Version:2.10.4 on 25-feb-1995 at 9:36:24 am'! |
14 |
||
0 | 15 |
StandardSystemView subclass:#DebugView |
73 | 16 |
instanceVariableNames:'busy haveControl exitAction canContinue contextView codeView |
75 | 17 |
receiverInspector contextInspector contextArray selectedContext |
18 |
catchBlock grabber traceView tracing bigStep skipLineNr |
|
19 |
steppedContextAddress canAbort abortButton terminateButton |
|
78 | 20 |
continueButton stepButton nextButton sendButton returnButton restartButton |
75 | 21 |
exclusive inspecting nChainShown inspectedProcess updateProcess |
127 | 22 |
stopButton updateButton monitorToggle stepping steppedContextLineno actualContext inWrap' |
73 | 23 |
classVariableNames:'CachedDebugger CachedExclusive OpenDebuggers MoreDebuggingDetail' |
24 |
poolDictionaries:'' |
|
25 |
category:'Interface-Debugger' |
|
0 | 26 |
! |
27 |
||
29 | 28 |
!DebugView class methodsFor:'documentation'! |
29 |
||
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
45 | 33 |
All Rights Reserved |
29 | 34 |
|
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
0 | 43 |
|
29 | 44 |
version |
165
df29ee4514c1
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
155
diff
changeset
|
45 |
^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.48 1995-11-11 15:39:37 cg Exp $' |
29 | 46 |
! |
0 | 47 |
|
29 | 48 |
documentation |
49 |
" |
|
50 |
this class implements a graphical debugger interface. |
|
51 |
The debugger usually sits on top of the faulting process, |
|
52 |
taking over its event processing. Thus only the 'stopped' process is affected; |
|
53 |
other processes continue to respond to events. |
|
54 |
||
55 |
The one exception is when an error occurs within the dispatcher process |
|
56 |
or in one of the eventhandler processes - in this case, the debugger |
|
57 |
will sit on an exclusive display connection. |
|
58 |
||
59 |
The whole debugging will be changed, once the required process primitives |
|
60 |
are available, which allow control of another processes execution |
|
61 |
(i.e. single-step, restart & return). The setup will be changed then, |
|
62 |
to have the debugger control the debuggee (i.e. two processes) |
|
35 | 63 |
|
64 |
See additional information in 'doc/misc/debugger.doc'. |
|
53 | 65 |
|
66 |
Notice: the DebugView class caches the last used debugger in a class |
|
67 |
variable. It may happen, that a malfunctioning debugger (for example, |
|
68 |
a halfway destoyed one) is kept there. You will notice this, if a |
|
69 |
debugger comes up without showing any contents. In this case, close |
|
70 |
(or destroy) the broken debugView, and execute |
|
71 |
Debugger newDebugger |
|
72 |
which removes the cached debugger and forces creation of a new one the |
|
73 |
next time. This is a temporary workaround - the debugger will be fixed to |
|
74 |
avoid this problem. |
|
29 | 75 |
" |
76 |
! ! |
|
0 | 77 |
|
78 |
!DebugView class methodsFor:'instance creation'! |
|
79 |
||
73 | 80 |
enterUnconditional:aContext withMessage:aString |
81 |
"enter a debugger - do not check for recursive invocation" |
|
82 |
||
83 |
|aDebugger| |
|
84 |
||
85 |
StepInterruptPending := nil. |
|
86 |
aDebugger := self new. |
|
87 |
aDebugger setLabelFor:aString in:Processor activeProcess. |
|
88 |
aDebugger enter:aContext. |
|
89 |
^ nil |
|
90 |
||
91 |
"nil halt" |
|
92 |
! |
|
93 |
||
0 | 94 |
new |
56 | 95 |
"return a new DebugView - return a cached debugger if it already |
0 | 96 |
exists" |
97 |
||
57 | 98 |
|debugger| |
29 | 99 |
|
57 | 100 |
" |
101 |
need a blocking debugger if no processes or |
|
102 |
or if its a timing/interrupt process |
|
103 |
(because otherwise we would not get any events here ... |
|
104 |
" |
|
105 |
Processor activeProcessIsSystemProcess ifTrue:[ |
|
45 | 106 |
CachedExclusive isNil ifTrue:[ |
107 |
debugger := self newExclusive |
|
108 |
] ifFalse:[ |
|
109 |
debugger := CachedExclusive. |
|
110 |
CachedExclusive := nil. |
|
111 |
]. |
|
7 | 112 |
] ifFalse:[ |
45 | 113 |
CachedDebugger isNil ifTrue:[ |
114 |
debugger := super new. |
|
115 |
debugger label:'Debugger'. |
|
116 |
debugger icon:(Form fromFile:'Debugger.xbm' resolution:100). |
|
117 |
] ifFalse:[ |
|
118 |
debugger := CachedDebugger. |
|
119 |
CachedDebugger := nil. |
|
120 |
] |
|
7 | 121 |
]. |
122 |
^ debugger |
|
0 | 123 |
! |
124 |
||
29 | 125 |
enter:aContext withMessage:aString |
53 | 126 |
"enter a debugger; if this is a recursive invocation, enter |
127 |
a MiniDebugger instead. |
|
128 |
This is the standard way of entering the debugger; |
|
129 |
sent from error- and halt messages." |
|
0 | 130 |
|
93 | 131 |
|active| |
132 |
||
57 | 133 |
StepInterruptPending := nil. |
134 |
||
62 | 135 |
thisContext isRecursive ifTrue:[ |
93 | 136 |
^ MiniDebugger enterWithMessage:'recursive error in debugger'. |
62 | 137 |
]. |
138 |
||
57 | 139 |
" |
140 |
well, it could be a stepping or sending debugger up there; |
|
141 |
in this case, return to it. This happens, when a stepping process |
|
142 |
runs into an error (for example, a halt). In this case, we want the |
|
143 |
stepping debugger to come up again instead of a new one. |
|
144 |
" |
|
145 |
OpenDebuggers notNil ifTrue:[ |
|
93 | 146 |
active := Processor activeProcess. |
57 | 147 |
OpenDebuggers do:[:aDebugger | |
148 |
aDebugger notNil ifTrue:[ |
|
93 | 149 |
(aDebugger inspectedProcess == active) ifTrue:[ |
57 | 150 |
"/ 'entering stepping debugger again' printNL. |
151 |
aDebugger unstep. |
|
93 | 152 |
aDebugger setLabelFor:aString in:active. |
57 | 153 |
^ aDebugger enter:aContext. |
154 |
] |
|
155 |
] |
|
156 |
] |
|
157 |
]. |
|
158 |
||
53 | 159 |
^ self enterUnconditional:aContext withMessage:aString |
160 |
! |
|
161 |
||
73 | 162 |
newExclusive |
163 |
"return a debugger for exclusive display access" |
|
53 | 164 |
|
73 | 165 |
|debugger| |
14 | 166 |
|
73 | 167 |
debugger := super new. |
168 |
debugger label:'Debugger'. |
|
169 |
debugger icon:(Form fromFile:'Debugger.xbm' resolution:100). |
|
170 |
debugger exclusive:true. |
|
171 |
^ debugger |
|
172 |
! |
|
0 | 173 |
|
73 | 174 |
newDebugger |
175 |
"force creation of a new debugger" |
|
176 |
||
177 |
CachedDebugger := nil. |
|
178 |
CachedExclusive := nil. |
|
179 |
OpenDebuggers := nil. |
|
180 |
||
181 |
" |
|
182 |
DebugView newDebugger |
|
183 |
" |
|
0 | 184 |
! |
185 |
||
105 | 186 |
lowSpaceCleanup |
187 |
"in low memory situations, give up cached debuggers" |
|
188 |
||
189 |
self newDebugger |
|
190 |
! |
|
191 |
||
29 | 192 |
openOn:aProcess |
193 |
"start a debugger on aProcess |
|
194 |
(actually not more than a good-looking inspector)" |
|
15 | 195 |
|
52 | 196 |
|aDebugger label nm| |
15 | 197 |
|
198 |
aDebugger := super new. |
|
199 |
aDebugger icon:(Form fromFile:'Debugger.xbm' resolution:100). |
|
29 | 200 |
aProcess notNil ifTrue:[ |
52 | 201 |
nm := aProcess name. |
202 |
nm notNil ifTrue:[ |
|
61 | 203 |
nm := (nm contractTo:17) , '-' , aProcess id printString |
52 | 204 |
] ifFalse:[ |
205 |
nm := aProcess id printString |
|
206 |
]. |
|
207 |
label := 'Debugger [' , nm , ']'. |
|
29 | 208 |
] ifFalse:[ |
45 | 209 |
label := 'no process' |
29 | 210 |
]. |
211 |
aDebugger label:label. |
|
15 | 212 |
aDebugger iconLabel:'Debugger'. |
213 |
aDebugger openOn:aProcess. |
|
214 |
^ nil |
|
73 | 215 |
! |
216 |
||
217 |
enterWithMessage:aString |
|
218 |
"the standard way of entering the debugger - sent from Objects |
|
219 |
error- and halt messages" |
|
220 |
||
221 |
^ self enter:(thisContext sender) withMessage:aString |
|
222 |
||
223 |
"Debugger enterWithMessage:'hi there'" |
|
224 |
! |
|
225 |
||
226 |
enter |
|
227 |
"another way of entering the debugger" |
|
228 |
||
229 |
^ self enter:(thisContext sender) withMessage:'Debugger' |
|
230 |
||
231 |
"Debugger enter" |
|
232 |
! |
|
233 |
||
234 |
enter:aContext |
|
235 |
"enter the debugger on aContext" |
|
236 |
||
237 |
^ self enter:aContext withMessage:'Debugger' |
|
238 |
! ! |
|
239 |
||
240 |
!DebugView methodsFor:'private control loop'! |
|
241 |
||
242 |
controlLoop |
|
243 |
"this is a kludge: |
|
244 |
start a dispatchloop which exits when |
|
245 |
either continue, return or step is pressed |
|
246 |
" |
|
247 |
||
248 |
haveControl := true. |
|
249 |
[haveControl] whileTrue:[ |
|
250 |
self controlLoopCatchingErrors |
|
251 |
]. |
|
252 |
catchBlock := nil. |
|
253 |
! |
|
254 |
||
255 |
controlLoopCatchingErrors |
|
256 |
"setup a self removing catch-block" |
|
257 |
catchBlock := [catchBlock := nil. ^ nil]. |
|
258 |
||
155
33c9fa03fc79
dont access windowGroup if debugger is a modal one
Claus Gittinger <cg@exept.de>
parents:
132
diff
changeset
|
259 |
(exclusive or:[windowGroup isNil]) ifTrue:[ |
73 | 260 |
"if we do not have multiple processes or its a system process |
261 |
we start another dispatch loop, which exits when |
|
262 |
either continue, return or step is pressed |
|
263 |
or (via the catchBlock) if an error occurs. |
|
264 |
Since our display is an extra exclusive one |
|
265 |
all processing for normal views stops here ... |
|
266 |
" |
|
267 |
device dispatchModalWhile:[haveControl] |
|
268 |
] ifFalse:[ |
|
269 |
"we do have multiple processes - |
|
270 |
simply enter the DebugViews-Windowgroup event loop. |
|
271 |
effectively suspending event processing for the currently |
|
272 |
active group. |
|
273 |
" |
|
274 |
SignalSet anySignal handle:[:ex | |
|
275 |
|answer| |
|
276 |
||
108 | 277 |
"/ answer := self confirm:('error in debugger: ' , ex errorString , '\\debug again ?') withCRs. |
278 |
"/ answer ifTrue:[ |
|
279 |
"/ Debugger enterUnconditional:(ex suspendedContext) withMessage:'error in debugger: ' , ex errorString. |
|
280 |
"/ ] ifFalse:[ |
|
281 |
"/ 'ignored error in debugger: ' errorPrint. |
|
282 |
"/ ex errorString errorPrintNL. |
|
283 |
"/ ]. |
|
284 |
answer := Dialog |
|
285 |
choose:('error in debugger: ' , ex errorString , '\\debug again ?') withCRs |
|
286 |
labels:#('debug' 'proceed' 'ignore' ) |
|
287 |
values:#(#debug #proceed #ignore) |
|
288 |
default:#ignore. |
|
289 |
answer == #debug ifTrue:[ |
|
73 | 290 |
Debugger enterUnconditional:(ex suspendedContext) withMessage:'error in debugger: ' , ex errorString. |
108 | 291 |
ex proceed. |
292 |
]. |
|
293 |
answer == #proceed ifTrue:[ |
|
294 |
ex proceed. |
|
73 | 295 |
]. |
296 |
ex return. |
|
297 |
] do:[ |
|
93 | 298 |
windowGroup eventLoopWhile:[true] onLeave:[] |
73 | 299 |
]. |
300 |
]. |
|
301 |
catchBlock := nil. |
|
0 | 302 |
! ! |
303 |
||
304 |
!DebugView methodsFor:'initialization'! |
|
305 |
||
306 |
initialize |
|
101 | 307 |
|v panel hpanel bpanel separator| |
0 | 308 |
|
309 |
super initialize. |
|
310 |
||
311 |
font := font on:device. |
|
312 |
||
7 | 313 |
busy := false. |
14 | 314 |
exclusive := false. |
29 | 315 |
inspecting := false. |
0 | 316 |
exitAction := nil. |
10 | 317 |
bigStep := false. |
29 | 318 |
canContinue := false. |
319 |
canAbort := false. |
|
0 | 320 |
|
321 |
bpanel := HorizontalPanelView |
|
101 | 322 |
"/ origin:(0.0 @ 0.0) |
323 |
"/ extent:(1.0 @ (font height * 2)) |
|
45 | 324 |
in:self. |
101 | 325 |
bpanel horizontalLayout:#leftSpace. |
326 |
bpanel verticalSpace:ViewSpacing // 2. |
|
0 | 327 |
|
7 | 328 |
terminateButton := Button |
45 | 329 |
label:(resources at:'terminate') |
330 |
action:[terminateButton turnOffWithoutRedraw. self doTerminate] |
|
331 |
in:bpanel. |
|
101 | 332 |
separator := View extent:(10 @ 5) in:bpanel. |
333 |
separator borderWidth:0; level:0. |
|
45 | 334 |
|
0 | 335 |
abortButton := Button |
45 | 336 |
label:(resources at:'abort') |
337 |
action:[abortButton turnOffWithoutRedraw. self doAbort] |
|
338 |
in:bpanel. |
|
29 | 339 |
returnButton := Button |
45 | 340 |
label:(resources at:'return') |
341 |
action:[returnButton turnOff. self doReturn] |
|
342 |
in:bpanel. |
|
20 | 343 |
|
344 |
restartButton := Button |
|
45 | 345 |
label:(resources at:'restart') |
346 |
action:[restartButton turnOff. self doRestart] |
|
347 |
in:bpanel. |
|
348 |
||
101 | 349 |
separator := View extent:(10 @ 5) in:bpanel. |
350 |
separator borderWidth:0; level:0. |
|
20 | 351 |
|
0 | 352 |
continueButton := Button |
45 | 353 |
label:(resources at:'continue') |
354 |
action:[continueButton turnOffWithoutRedraw. self doContinue] |
|
355 |
in:bpanel. |
|
101 | 356 |
|
357 |
separator := View extent:(10 @ 5) in:bpanel. |
|
358 |
separator borderWidth:0; level:0. |
|
45 | 359 |
|
78 | 360 |
nextButton := Button |
361 |
label:(resources at:'next') |
|
362 |
action:[stepButton turnOff. self doNext] |
|
363 |
in:bpanel. |
|
0 | 364 |
stepButton := Button |
45 | 365 |
label:(resources at:'step') |
366 |
action:[stepButton turnOff. self doStep] |
|
367 |
in:bpanel. |
|
0 | 368 |
sendButton := Button |
45 | 369 |
label:(resources at:'send') |
370 |
action:[sendButton turnOff. self doSend] |
|
371 |
in:bpanel. |
|
0 | 372 |
|
101 | 373 |
bpanel origin:(0.0 @ 0.0) |
105 | 374 |
extent:(1.0 @ (bpanel preferredExtent y)). |
101 | 375 |
|
0 | 376 |
panel := VariableVerticalPanel |
45 | 377 |
origin:(0.0 @ bpanel height) |
378 |
corner:(1.0 @ 1.0) |
|
379 |
in:self. |
|
0 | 380 |
|
381 |
v := ScrollableView for:SelectionInListView in:panel. |
|
382 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25). |
|
383 |
||
384 |
contextView := v scrolledView. |
|
385 |
contextView action:[:lineNr | self showSelection:lineNr]. |
|
386 |
||
387 |
v := ScrollableView for:CodeView in:panel. |
|
388 |
v origin:(0.0 @ 0.25) corner:(1.0 @ 0.75). |
|
389 |
||
390 |
codeView := v scrolledView. |
|
391 |
||
392 |
hpanel := VariableHorizontalPanel in:panel. |
|
393 |
hpanel origin:(0.0 @ 0.75) corner:(1.0 @ 1.0). |
|
394 |
||
395 |
receiverInspector := InspectorView |
|
45 | 396 |
origin:(0.0 @ 0.0) corner:(0.5 @ 1.0) |
397 |
in:hpanel. |
|
0 | 398 |
|
399 |
contextInspector := ContextInspectorView |
|
45 | 400 |
origin:(0.5 @ 0.0) corner:(1.0 @ 1.0) |
401 |
in:hpanel |
|
0 | 402 |
! |
403 |
||
73 | 404 |
createOnTop |
405 |
^ false "true" |
|
406 |
! |
|
407 |
||
0 | 408 |
initializeMiddleButtonMenu |
45 | 409 |
|labels m| |
0 | 410 |
|
22 | 411 |
labels := resources array:#( |
45 | 412 |
'show more' |
413 |
'-' |
|
57 | 414 |
'skip' |
415 |
'-' |
|
22 | 416 |
" |
45 | 417 |
'continue' |
418 |
'terminate' |
|
419 |
'abort' |
|
420 |
'-' |
|
421 |
'step' |
|
422 |
'send' |
|
423 |
'-' |
|
424 |
'return' |
|
425 |
'restart' |
|
426 |
'-' |
|
22 | 427 |
" |
45 | 428 |
'remove breakpoint' |
48 | 429 |
'remove all trace & breakpoints' |
45 | 430 |
'-' |
75 | 431 |
'browse class' |
108 | 432 |
'browse class hierarchy' |
433 |
'browse full class protocol' |
|
75 | 434 |
'implementors' |
435 |
'senders' |
|
45 | 436 |
'-' |
437 |
'inspect context' |
|
124 | 438 |
'copy walkback text' |
45 | 439 |
'-' |
440 |
'quickTerminate' |
|
105 | 441 |
'=' |
124 | 442 |
'exit smalltalk (no confirmation)' |
45 | 443 |
). |
0 | 444 |
|
45 | 445 |
m := (PopUpMenu |
446 |
labels:labels |
|
447 |
selectors:#( |
|
73 | 448 |
showMore |
45 | 449 |
nil |
73 | 450 |
skip |
57 | 451 |
nil |
45 | 452 |
" |
453 |
doContinue |
|
454 |
doTerminate |
|
455 |
doAbort |
|
456 |
nil |
|
457 |
doStep |
|
458 |
doSend |
|
459 |
nil |
|
460 |
doReturn |
|
461 |
doRestart |
|
462 |
nil |
|
22 | 463 |
" |
73 | 464 |
removeBreakpoint |
465 |
removeAllBreakpoints |
|
45 | 466 |
nil |
73 | 467 |
browseClass |
108 | 468 |
browseClassHierarchy |
469 |
browseFullClassProtocol |
|
73 | 470 |
implementors |
471 |
senders |
|
45 | 472 |
nil |
73 | 473 |
inspectContext |
45 | 474 |
nil |
73 | 475 |
quickTerminate |
124 | 476 |
copyWalkbackText |
73 | 477 |
nil |
478 |
exit |
|
45 | 479 |
) |
480 |
receiver:self |
|
481 |
for:contextView). |
|
482 |
||
483 |
contextView middleButtonMenu:m. |
|
484 |
||
485 |
inspecting ifTrue:[ |
|
486 |
m notNil ifTrue:[ |
|
106 | 487 |
m disableAll:#(doTraceStep removeBreakpoint). |
45 | 488 |
]. |
489 |
] |
|
0 | 490 |
! |
491 |
||
73 | 492 |
setLabelFor:aMessage in:aProcess |
493 |
|l nm| |
|
494 |
||
495 |
l := aMessage , ' ('. |
|
496 |
nm := aProcess name. |
|
497 |
nm notNil ifTrue:[ |
|
90 | 498 |
l := l , (nm contractTo:17) , ''. |
73 | 499 |
]. |
90 | 500 |
l := l , '[' , aProcess id printString , '])'. |
73 | 501 |
self label:l. |
502 |
! |
|
503 |
||
0 | 504 |
addToCurrentProject |
505 |
"ignored here" |
|
506 |
||
507 |
^ self |
|
508 |
! |
|
509 |
||
13 | 510 |
realize |
511 |
super realize. |
|
512 |
exclusive ifTrue:[ |
|
45 | 513 |
windowGroup := nil |
13 | 514 |
]. |
45 | 515 |
|
57 | 516 |
inspecting ifTrue:[ |
517 |
inspectedProcess notNil ifTrue:[ |
|
518 |
" |
|
519 |
set prio somewhat higher (by 2, to allow walkBack-update process |
|
520 |
to run between mine and the debugged processes prio) |
|
521 |
" |
|
522 |
Processor activeProcess |
|
523 |
priority:(inspectedProcess priority + 2 min:16). |
|
524 |
] |
|
45 | 525 |
] |
73 | 526 |
! ! |
527 |
||
528 |
!DebugView methodsFor:'private'! |
|
529 |
||
530 |
cacheMyself |
|
531 |
"remember myself for next debug session" |
|
532 |
||
533 |
"caching the last debugger will make the next debugger appear |
|
534 |
faster, since no resources have to be allocated in the display. |
|
535 |
We have to be careful to release all refs to the debuggee, though. |
|
536 |
Otherwise, the GC will not be able to release it" |
|
537 |
||
155
33c9fa03fc79
dont access windowGroup if debugger is a modal one
Claus Gittinger <cg@exept.de>
parents:
132
diff
changeset
|
538 |
windowGroup notNil ifTrue:[ |
165
df29ee4514c1
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
155
diff
changeset
|
539 |
windowGroup setProcess:nil. |
155
33c9fa03fc79
dont access windowGroup if debugger is a modal one
Claus Gittinger <cg@exept.de>
parents:
132
diff
changeset
|
540 |
]. |
132 | 541 |
|
73 | 542 |
busy := false. |
543 |
codeView acceptAction:nil. |
|
544 |
codeView doItAction:nil. |
|
545 |
codeView contents:nil. |
|
546 |
receiverInspector release. |
|
547 |
contextInspector release. |
|
548 |
inspectedProcess := nil. |
|
549 |
exitAction := nil. |
|
550 |
contextArray := nil. |
|
551 |
selectedContext := actualContext := nil. |
|
552 |
catchBlock := nil. |
|
553 |
grabber := nil. |
|
554 |
self autoUpdateOff. |
|
555 |
||
556 |
exclusive ifTrue:[CachedExclusive := self] ifFalse:[CachedDebugger := self]. |
|
557 |
! |
|
558 |
||
559 |
showError:message |
|
560 |
codeView contents:(resources string:message). |
|
81 | 561 |
shown ifTrue:[ |
90 | 562 |
exclusive ifFalse:[codeView flash] |
81 | 563 |
] |
73 | 564 |
! |
565 |
||
566 |
interrestingContextFrom:aContext |
|
567 |
"return an interresting contexts offset, or nil. |
|
568 |
This is the context initially shown in the walkback. |
|
569 |
We move up the calling chain, skipping all intermediate Signal |
|
570 |
and Exception contexts, to present the context in which the error |
|
571 |
actually occured. |
|
572 |
Just for your convenience :-)" |
|
573 |
||
574 |
|c found offset sel prev ex| |
|
575 |
||
576 |
"somewhere, at the bottom, there must be a raise ..." |
|
577 |
||
578 |
c := aContext. |
|
579 |
1 to:5 do:[:i | |
|
580 |
c isNil ifTrue:[^ 1 "^ nil"]. |
|
581 |
sel := c selector. |
|
582 |
(sel == #raise) ifTrue:[ |
|
583 |
(c receiver isKindOf:Exception) ifTrue:[ |
|
584 |
ex := c receiver |
|
585 |
]. |
|
586 |
offset := i. |
|
587 |
found := c |
|
588 |
]. |
|
589 |
c := c sender. |
|
590 |
]. |
|
591 |
||
592 |
" |
|
593 |
if this is a noHandler exception, skip forward |
|
594 |
to the erronous context |
|
595 |
" |
|
596 |
ex notNil ifTrue:[ |
|
597 |
ex signal == Signal noHandlerSignal ifTrue:[ |
|
598 |
c := ex suspendedContext |
|
599 |
] |
|
600 |
]. |
|
601 |
||
602 |
(c := found) isNil ifTrue:[^ 1]. |
|
603 |
||
604 |
" |
|
605 |
got it; move up, skipping all intermediate Signal and |
|
606 |
Exception contexts |
|
607 |
" |
|
608 |
prev := nil. |
|
609 |
[ |
|
610 |
((c receiver isSignal) |
|
611 |
or:[(c receiver isKindOf:Exception)]) |
|
612 |
] whileTrue:[ |
|
613 |
prev := c. |
|
614 |
(c := c sender) isNil ifTrue:[^ offset]. |
|
615 |
offset := offset + 1. |
|
616 |
]. |
|
617 |
||
618 |
" |
|
619 |
now, we are one above the raise |
|
620 |
" |
|
621 |
||
622 |
" |
|
623 |
if the sender of the raise is one of objects error methods ... |
|
624 |
" |
|
625 |
( #( halt halt: |
|
626 |
error error: |
|
627 |
doesNotUnderstand: |
|
628 |
subclassResponsibility |
|
629 |
primitiveFailed) includes:c selector) |
|
630 |
ifTrue:[ |
|
631 |
c selector == #doesNotUnderstand: ifTrue:[ |
|
632 |
" |
|
633 |
one more up, to get to the originating context |
|
634 |
" |
|
635 |
(c := c sender) isNil ifTrue:[^ offset]. |
|
636 |
offset := offset + 1. |
|
637 |
]. |
|
638 |
(c := c sender) isNil ifTrue:[^ offset]. |
|
639 |
offset := offset + 1. |
|
640 |
] ifFalse:[ |
|
641 |
" |
|
642 |
ok, got the raise - if its a BreakPoint, look for the sender |
|
643 |
" |
|
644 |
(MessageTracer notNil and:[prev receiver == MessageTracer breakpointSignal]) ifTrue:[ |
|
645 |
offset := offset + 1 |
|
646 |
]. |
|
647 |
]. |
|
648 |
||
649 |
^ offset |
|
650 |
! |
|
651 |
||
652 |
inspectedProcess |
|
653 |
^ inspectedProcess |
|
654 |
! |
|
655 |
||
656 |
busy |
|
657 |
^ busy |
|
658 |
! |
|
659 |
||
660 |
stepping |
|
661 |
^ stepping |
|
662 |
! |
|
663 |
||
664 |
setContext:aContext |
|
665 |
"show calling chain from aContext in the walk-back listview" |
|
666 |
||
75 | 667 |
|con text method caller caller2 m count| |
73 | 668 |
|
669 |
(contextArray notNil and:[aContext == (contextArray at:1)]) ifTrue:[ |
|
670 |
"no change" |
|
671 |
^ false |
|
672 |
]. |
|
673 |
||
674 |
m := contextView middleButtonMenu. |
|
675 |
m notNil ifTrue:[ |
|
676 |
m disable:#showMore. |
|
677 |
]. |
|
678 |
||
679 |
aContext isNil ifTrue:[ |
|
680 |
text := Array with:'** no context **'. |
|
681 |
contextArray := nil. |
|
682 |
] ifFalse:[ |
|
683 |
text := OrderedCollection new:nChainShown. |
|
684 |
contextArray := OrderedCollection new:nChainShown. |
|
685 |
con := aContext. |
|
686 |
||
687 |
" |
|
688 |
get them all |
|
689 |
" |
|
75 | 690 |
count := 0. |
691 |
[con notNil and:[count <= nChainShown]] whileTrue:[ |
|
692 |
contextArray add:con. count := count + 1. |
|
73 | 693 |
(MoreDebuggingDetail == true) ifTrue:[ |
694 |
text add:(((ObjectMemory addressOf:con) printStringRadix:16) , ' ' , con printString). |
|
695 |
] ifFalse:[ |
|
696 |
text add:con printString. |
|
697 |
]. |
|
698 |
||
699 |
method := con method. |
|
700 |
(method notNil and:[method isWrapped]) ifTrue:[ |
|
701 |
" |
|
702 |
kludge: if its a wrapped method, then hide the wrap-call |
|
703 |
" |
|
704 |
caller := con sender. |
|
705 |
(caller notNil and:[caller receiver == method originalMethod]) ifTrue:[ |
|
706 |
caller2 := caller sender. |
|
707 |
(caller2 notNil and:[caller2 method == method]) ifTrue:[ |
|
708 |
con := caller2 |
|
709 |
] |
|
710 |
]. |
|
711 |
caller := caller2 := nil |
|
712 |
]. |
|
713 |
con := con sender |
|
714 |
]. |
|
715 |
||
716 |
" |
|
717 |
did we reach the end ? |
|
718 |
" |
|
719 |
(con isNil or:[con sender isNil]) ifTrue:[ |
|
720 |
" |
|
721 |
the very last one is the startup context |
|
722 |
(in main) - it has nil as receiver and nil as selector |
|
723 |
" |
|
724 |
contextArray last selector isNil ifTrue:[ |
|
725 |
contextArray removeLast. |
|
726 |
text removeLast |
|
727 |
] |
|
728 |
] ifFalse:[ |
|
729 |
m notNil ifTrue:[ |
|
730 |
m enable:#showMore. |
|
731 |
text add:(resources string:'*** more walkback follows - click here to see them ***') |
|
732 |
]. |
|
733 |
]. |
|
734 |
]. |
|
735 |
||
736 |
contextView setList:text. |
|
737 |
receiverInspector release. |
|
738 |
contextInspector release. |
|
739 |
||
740 |
m notNil ifTrue:[ |
|
741 |
m disable:#removeBreakpoint. |
|
742 |
m disable:#implementors. |
|
743 |
m disable:#senders. |
|
744 |
m disable:#browseClass. |
|
745 |
]. |
|
746 |
^ true |
|
747 |
! |
|
748 |
||
749 |
showTerminated |
|
750 |
self showError:'** the process has terminated **' |
|
751 |
! |
|
752 |
||
92 | 753 |
processPerform:aMessage |
73 | 754 |
"do something, then update the context list" |
755 |
||
756 |
inspectedProcess isDead ifTrue:[ |
|
757 |
self showTerminated. |
|
758 |
^ self |
|
759 |
]. |
|
92 | 760 |
inspectedProcess perform:aMessage. |
761 |
" |
|
762 |
give the process a chance to run, then update |
|
763 |
" |
|
764 |
(Delay forSeconds:0.2) wait. |
|
765 |
self setContext:(inspectedProcess suspendedContext). |
|
766 |
! |
|
767 |
||
768 |
interruptProcessWith:aBlock |
|
769 |
"let inspected process do something, then update the context list" |
|
770 |
||
771 |
inspectedProcess isDead ifTrue:[ |
|
772 |
self showTerminated. |
|
773 |
^ self |
|
774 |
]. |
|
73 | 775 |
inspectedProcess interruptWith:aBlock. |
776 |
" |
|
777 |
give the process a chance to run, then update |
|
778 |
" |
|
779 |
(Delay forSeconds:0.2) wait. |
|
780 |
self setContext:(inspectedProcess suspendedContext). |
|
781 |
! |
|
782 |
||
783 |
exclusive:aBoolean |
|
784 |
exclusive := aBoolean |
|
785 |
! |
|
786 |
||
787 |
unstep |
|
788 |
stepping := false. |
|
789 |
bigStep := false. |
|
790 |
steppedContextAddress := nil. |
|
791 |
exitAction := nil |
|
61 | 792 |
! |
793 |
||
73 | 794 |
updateContext |
795 |
|oldContext idx| |
|
796 |
||
797 |
inspectedProcess state == #dead ifTrue:[ |
|
798 |
self showTerminated. |
|
799 |
^ self |
|
800 |
]. |
|
801 |
||
802 |
oldContext := selectedContext. |
|
803 |
(self setContext:(inspectedProcess suspendedContext)) ifTrue:[ |
|
804 |
oldContext notNil ifTrue:[ |
|
805 |
contextArray notNil ifTrue:[ |
|
806 |
idx := contextArray identityIndexOf:oldContext. |
|
807 |
idx ~~ 0 ifTrue:[ |
|
808 |
self showSelection:idx |
|
809 |
] ifFalse:[ |
|
810 |
codeView contents:('** context returned **') |
|
811 |
] |
|
812 |
] |
|
813 |
] |
|
814 |
] |
|
815 |
! ! |
|
816 |
||
126 | 817 |
!DebugView methodsFor:'help'! |
818 |
||
819 |
helpTextFor:aComponent |
|
820 |
|s| |
|
821 |
||
822 |
aComponent == abortButton ifTrue:[ |
|
823 |
s := 'HELP_ABORT' |
|
824 |
]. |
|
825 |
aComponent == terminateButton ifTrue:[ |
|
826 |
s := 'HELP_TERMINATE' |
|
827 |
]. |
|
828 |
aComponent == continueButton ifTrue:[ |
|
829 |
s := 'HELP_CONTINUE' |
|
830 |
]. |
|
831 |
aComponent == stepButton ifTrue:[ |
|
832 |
s := 'HELP_STEP' |
|
833 |
]. |
|
834 |
aComponent == nextButton ifTrue:[ |
|
835 |
s := 'HELP_NEXT' |
|
836 |
]. |
|
837 |
aComponent == stepButton ifTrue:[ |
|
838 |
s := 'HELP_STEP' |
|
839 |
]. |
|
840 |
aComponent == sendButton ifTrue:[ |
|
841 |
s := 'HELP_SEND' |
|
842 |
]. |
|
843 |
aComponent == returnButton ifTrue:[ |
|
844 |
s := 'HELP_RETURN' |
|
845 |
]. |
|
846 |
aComponent == restartButton ifTrue:[ |
|
847 |
s := 'HELP_RESTART' |
|
848 |
]. |
|
849 |
aComponent == contextView ifTrue:[ |
|
850 |
s := 'HELP_WALKBACK' |
|
851 |
]. |
|
852 |
aComponent == codeView ifTrue:[ |
|
853 |
s := 'HELP_CODEVIEW' |
|
854 |
]. |
|
855 |
aComponent == monitorToggle ifTrue:[ |
|
856 |
s := 'HELP_MONITOR' |
|
857 |
]. |
|
127 | 858 |
aComponent == updateButton ifTrue:[ |
859 |
s := 'HELP_UPDATE' |
|
860 |
]. |
|
861 |
aComponent == stopButton ifTrue:[ |
|
862 |
s := 'HELP_STOP' |
|
863 |
]. |
|
126 | 864 |
(aComponent isSubViewOf:receiverInspector) ifTrue:[ |
865 |
s := 'HELP_REC_INSP' |
|
866 |
]. |
|
867 |
(aComponent isSubViewOf:contextInspector) ifTrue:[ |
|
868 |
s := 'HELP_CON_INSP' |
|
869 |
]. |
|
870 |
||
871 |
s notNil ifTrue:[ |
|
872 |
^ resources string:s |
|
873 |
]. |
|
874 |
^ nil |
|
875 |
||
876 |
"Modified: 29.8.1995 / 23:38:54 / claus" |
|
877 |
! ! |
|
878 |
||
73 | 879 |
!DebugView methodsFor:'basic'! |
880 |
||
881 |
enter:aContext |
|
882 |
"enter the debugger - get and display the context, then start an |
|
883 |
exclusive event loop on top of eveything else" |
|
884 |
||
885 |
|con selection m idx retval s| |
|
886 |
||
887 |
busy := true. |
|
888 |
inspecting := false. |
|
889 |
inspectedProcess := Processor activeProcess. |
|
890 |
stepping := false. |
|
891 |
bigStep := false. |
|
892 |
nChainShown := 50. |
|
893 |
||
894 |
"if debugger is entered while a box has grabbed the |
|
895 |
pointer, we must ungrab - otherwise X wont talk to |
|
896 |
us here |
|
897 |
" |
|
898 |
(grabber := device activePointerGrab) notNil ifTrue:[ |
|
75 | 899 |
device ungrabPointer |
73 | 900 |
]. |
901 |
||
902 |
terminateButton enable. |
|
903 |
||
904 |
drawableId notNil ifTrue:[ |
|
75 | 905 |
"not the first time - realize at old position" |
906 |
terminateButton turnOffWithoutRedraw. |
|
907 |
continueButton turnOffWithoutRedraw. |
|
908 |
returnButton turnOffWithoutRedraw. |
|
909 |
restartButton turnOffWithoutRedraw. |
|
910 |
abortButton turnOffWithoutRedraw. |
|
78 | 911 |
nextButton turnOffWithoutRedraw. |
75 | 912 |
stepButton turnOffWithoutRedraw. |
913 |
sendButton turnOffWithoutRedraw. |
|
73 | 914 |
] ifFalse:[ |
132 | 915 |
self iconLabel:'Debugger'. |
916 |
]. |
|
917 |
||
918 |
exclusive ifFalse:[ |
|
919 |
"/ create a (modal) windowGroup for myself |
|
920 |
||
921 |
windowGroup isNil ifTrue:[ |
|
922 |
windowGroup := WindowGroup new. |
|
923 |
windowGroup addTopView:self. |
|
75 | 924 |
]. |
132 | 925 |
windowGroup setProcess:Processor activeProcess. |
926 |
windowGroup setModal:true. |
|
73 | 927 |
]. |
928 |
||
929 |
" |
|
930 |
get the walkback list |
|
931 |
" |
|
932 |
self setContext:aContext. |
|
933 |
||
934 |
" |
|
935 |
and find the one context to show initially |
|
936 |
- if we came here by a send (single step), its the top context; |
|
937 |
- if we came here by a step (i.e. bigStep), its the top context |
|
938 |
(for ifs and whiles) or the sender (for regular sends). |
|
939 |
- otherwise, we came here by some signal raise, and we are interrested |
|
940 |
in the context where the raise actually occured. |
|
941 |
" |
|
942 |
exitAction == #step ifTrue:[ |
|
75 | 943 |
selection := 1. |
944 |
steppedContextAddress notNil ifTrue:[ |
|
945 |
" |
|
946 |
if we came here by a big-step, show the method where we are |
|
947 |
" |
|
948 |
(ObjectMemory addressOf:aContext) == steppedContextAddress ifTrue:[ |
|
949 |
selection := 1 |
|
950 |
] ifFalse:[ |
|
951 |
(ObjectMemory addressOf:aContext sender) == steppedContextAddress ifTrue:[ |
|
952 |
selection := 2 |
|
953 |
] |
|
954 |
]. |
|
955 |
" |
|
956 |
for bigStep, we could also be in a block below the actual method ... |
|
957 |
" |
|
958 |
(aContext home notNil and:[ |
|
959 |
(ObjectMemory addressOf:aContext home) == steppedContextAddress]) ifTrue:[ |
|
960 |
selection := 1 |
|
961 |
] ifFalse:[ |
|
962 |
(aContext sender home notNil and:[ |
|
963 |
(ObjectMemory addressOf:aContext sender home) == steppedContextAddress]) ifTrue:[ |
|
964 |
selection := 2 |
|
965 |
] |
|
966 |
]. |
|
967 |
] |
|
73 | 968 |
] ifFalse:[ |
75 | 969 |
steppedContextAddress isNil ifTrue:[ |
970 |
" |
|
971 |
preselect a more interresting context, (where halt/raise was ...) |
|
972 |
" |
|
973 |
selection := self interrestingContextFrom:aContext. |
|
974 |
] ifFalse:[ |
|
975 |
" |
|
976 |
if we came here by a big-step, show the method where we are |
|
977 |
" |
|
978 |
(ObjectMemory addressOf:aContext) == steppedContextAddress ifTrue:[ |
|
979 |
selection := 1 |
|
980 |
] ifFalse:[ |
|
981 |
(ObjectMemory addressOf:aContext sender) == steppedContextAddress ifTrue:[ |
|
982 |
selection := 2 |
|
983 |
] |
|
984 |
] |
|
985 |
] |
|
73 | 986 |
]. |
987 |
||
988 |
selection notNil ifTrue:[ |
|
75 | 989 |
self showSelection:selection. |
990 |
contextView selection:selection. |
|
991 |
selection > 1 ifTrue:[ |
|
992 |
contextView scrollToLine:(selection - 1) |
|
993 |
] |
|
73 | 994 |
]. |
995 |
||
996 |
m := contextView middleButtonMenu. |
|
997 |
m notNil ifTrue:[ |
|
75 | 998 |
canAbort := inspecting or:[Object abortSignal isHandled]. |
999 |
canAbort ifTrue:[ |
|
1000 |
abortButton enable. |
|
1001 |
m enable:#doAbort. |
|
1002 |
] ifFalse:[ |
|
1003 |
abortButton disable. |
|
1004 |
m disable:#doAbort. |
|
1005 |
]. |
|
1006 |
exclusive ifTrue:[ |
|
1007 |
terminateButton disable. |
|
1008 |
m disable:#doTerminate. |
|
1009 |
] ifFalse:[ |
|
1010 |
terminateButton enable. |
|
1011 |
m enable:#doTerminate. |
|
1012 |
] |
|
73 | 1013 |
]. |
1014 |
||
1015 |
" |
|
1016 |
drawableId is nil, if this is a new debugger. Then do a realize. |
|
1017 |
Otherwise, its probably better to do a rerealize, which shows the |
|
1018 |
view at the previous position, without a need for the user to set the |
|
1019 |
position again |
|
1020 |
" |
|
1021 |
drawableId notNil ifTrue:[ |
|
75 | 1022 |
self rerealize |
73 | 1023 |
] ifFalse:[ |
75 | 1024 |
self realize. |
73 | 1025 |
]. |
1026 |
||
1027 |
" |
|
1028 |
bring us to the top |
|
1029 |
" |
|
1030 |
self raise. |
|
105 | 1031 |
device flush. |
73 | 1032 |
|
1033 |
canContinue := true. |
|
1034 |
exitAction := nil. |
|
1035 |
||
1036 |
" |
|
1037 |
enter private event handling loop. This is left (and we come back here again) |
|
1038 |
when any button was pressed which requires continuation of the debuggee or |
|
1039 |
closedown of the debugger. |
|
1040 |
" |
|
1041 |
||
132 | 1042 |
[self controlLoop] valueOnUnwindDo:[ |
1043 |
windowGroup notNil ifTrue:[ |
|
1044 |
windowGroup setProcess:nil. |
|
1045 |
]. |
|
1046 |
self destroy |
|
1047 |
]. |
|
73 | 1048 |
|
1049 |
" |
|
1050 |
release all context stuff. |
|
1051 |
This is required to avoid keeping references to the debuggees objects |
|
1052 |
forever. (since the debugger is reused for faster startup next time) |
|
1053 |
" |
|
1054 |
contextArray := nil. |
|
1055 |
codeView acceptAction:nil. |
|
1056 |
contextView contents:nil. |
|
1057 |
receiverInspector release. |
|
1058 |
contextInspector release. |
|
1059 |
||
1060 |
(exitAction ~~ #step) ifTrue:[ |
|
75 | 1061 |
self unrealize. |
105 | 1062 |
device flush. |
73 | 1063 |
|
75 | 1064 |
(exitAction == #abort) ifTrue:[ |
1065 |
self cacheMyself. |
|
1066 |
" |
|
1067 |
have to catch errors occuring in unwind-blocks |
|
1068 |
" |
|
1069 |
Object errorSignal handle:[:ex | |
|
1070 |
'ignored error while unwinding: ' errorPrint. |
|
1071 |
ex errorString errorPrintNL. |
|
1072 |
ex proceed |
|
1073 |
] do:[ |
|
1074 |
Object abortSignal raise. |
|
1075 |
]. |
|
1076 |
'abort failed' errorPrintNL |
|
1077 |
]. |
|
61 | 1078 |
|
75 | 1079 |
(exitAction == #return) ifTrue:[ |
1080 |
selectedContext notNil ifTrue:[ |
|
1081 |
" |
|
1082 |
if there is a selection in the codeView, |
|
1083 |
evaluate it and use the result as return value |
|
1084 |
" |
|
73 | 1085 |
"/ disabled for now, there is almost always a selection (the current line) |
1086 |
"/ and that is syntactically incorrect ... |
|
1087 |
"/ ... leading to a popup warning from the codeView |
|
1088 |
"/ |
|
1089 |
"/ codeView hasSelection ifTrue:[ |
|
1090 |
"/ s := codeView selection asString. |
|
1091 |
"/ Object errorSignal handle:[:ex | |
|
1092 |
"/ 'DEBUGGER: error - returning nil' printNL. |
|
1093 |
"/ retval := nil. |
|
1094 |
"/ ex return |
|
1095 |
"/ ] do:[ |
|
1096 |
"/ retval := codeView doItAction value:s. |
|
1097 |
"/ ]. |
|
1098 |
"/ ]. |
|
1099 |
||
75 | 1100 |
con := selectedContext. |
1101 |
self cacheMyself. |
|
1102 |
" |
|
1103 |
have to catch errors occuring in unwind-blocks |
|
1104 |
" |
|
1105 |
Object errorSignal handle:[:ex | |
|
1106 |
'ignored error while unwinding: ' errorPrint. |
|
1107 |
ex errorString errorPrintNL. |
|
1108 |
ex proceed |
|
1109 |
] do:[ |
|
1110 |
con unwind:retval. |
|
1111 |
]. |
|
1112 |
'cannot return from selected context' errorPrintNL |
|
1113 |
] |
|
1114 |
]. |
|
73 | 1115 |
|
75 | 1116 |
(exitAction == #restart) ifTrue:[ |
1117 |
selectedContext notNil ifTrue:[ |
|
1118 |
con := selectedContext. |
|
1119 |
self cacheMyself. |
|
1120 |
" |
|
1121 |
have to catch errors occuring in unwind-blocks |
|
1122 |
" |
|
1123 |
Object errorSignal handle:[:ex | |
|
1124 |
'ignored error while unwinding: ' errorPrint. |
|
1125 |
ex errorString errorPrintNL. |
|
1126 |
ex proceed |
|
1127 |
] do:[ |
|
1128 |
con unwindAndRestart. |
|
1129 |
]. |
|
1130 |
'cannot restart selected context' errorPrintNL |
|
1131 |
] |
|
1132 |
]. |
|
73 | 1133 |
|
75 | 1134 |
(exitAction == #quickTerminate) ifTrue:[ |
1135 |
self cacheMyself. |
|
1136 |
Processor activeProcess terminateNoSignal |
|
1137 |
]. |
|
73 | 1138 |
|
75 | 1139 |
(exitAction == #terminate) ifTrue:[ |
1140 |
self cacheMyself. |
|
1141 |
" |
|
1142 |
have to catch errors occuring in unwind-blocks |
|
1143 |
" |
|
1144 |
Object errorSignal handle:[:ex | |
|
1145 |
'ignored error while unwinding: ' errorPrint. |
|
1146 |
ex errorString errorPrintNL. |
|
1147 |
ex proceed |
|
1148 |
] do:[ |
|
1149 |
Processor activeProcess terminate. |
|
1150 |
]. |
|
1151 |
'cannot terminate process' errorPrintNL |
|
1152 |
] |
|
73 | 1153 |
]. |
1154 |
||
1155 |
selectedContext := actualContext := nil. |
|
1156 |
||
1157 |
grabber notNil ifTrue:[ |
|
75 | 1158 |
device grabPointerInView:grabber. |
1159 |
grabber := nil. |
|
61 | 1160 |
]. |
73 | 1161 |
|
1162 |
(exitAction == #step) ifTrue:[ |
|
75 | 1163 |
" |
1164 |
schedule another stepInterrupt |
|
1165 |
- must enter myself into the collection of open debuggers, |
|
1166 |
in case the stepping process comes back again via a halt or signal |
|
1167 |
before the step is finished. In this case, the stepping debugger should |
|
1168 |
come up (instead of a new one) |
|
1169 |
- must flush caches since optimized methods not always |
|
1170 |
look for pending interrupts |
|
1171 |
" |
|
1172 |
OpenDebuggers isNil ifTrue:[ |
|
1173 |
OpenDebuggers := WeakArray with:self |
|
1174 |
] ifFalse:[ |
|
1175 |
(OpenDebuggers includes:self) ifFalse:[ |
|
1176 |
idx := OpenDebuggers identityIndexOf:nil. |
|
1177 |
idx ~~ 0 ifTrue:[ |
|
1178 |
OpenDebuggers at:idx put:self |
|
1179 |
] ifFalse:[ |
|
1180 |
OpenDebuggers := OpenDebuggers copyWith:self |
|
1181 |
] |
|
1182 |
] |
|
1183 |
]. |
|
1184 |
self label:'single stepping - please wait ...'. |
|
1185 |
stepping := true. |
|
73 | 1186 |
|
75 | 1187 |
ObjectMemory stepInterruptHandler:self. |
1188 |
ObjectMemory flushInlineCaches. |
|
1189 |
StepInterruptPending := 1. |
|
1190 |
InterruptPending := 1. |
|
1191 |
InStepInterrupt := nil |
|
73 | 1192 |
] ifFalse:[ |
75 | 1193 |
OpenDebuggers notNil ifTrue:[ |
1194 |
idx := OpenDebuggers identityIndexOf:self. |
|
1195 |
idx ~~ 0 ifTrue:[ |
|
1196 |
OpenDebuggers at:idx put:nil |
|
1197 |
] |
|
1198 |
]. |
|
1199 |
self cacheMyself. |
|
73 | 1200 |
] |
1201 |
! |
|
1202 |
||
1203 |
openOn:aProcess |
|
1204 |
"enter the debugger on a process - |
|
1205 |
in this case, we are just inspecting the context chain of the process, |
|
1206 |
not running on top of the debugged process, but as a separate |
|
1207 |
one. (think of it as an inspector showing more detail, and offering |
|
1208 |
some more control operations)" |
|
1209 |
||
127 | 1210 |
|bpanel dummy| |
73 | 1211 |
|
1212 |
busy := true. |
|
1213 |
bigStep := false. |
|
1214 |
inspecting := true. |
|
1215 |
inspectedProcess := aProcess. |
|
1216 |
nChainShown := 50. |
|
1217 |
||
1218 |
bpanel := abortButton superView. |
|
1219 |
||
1220 |
stopButton := Button new. |
|
1221 |
stopButton label:(resources at:'stop'); |
|
1222 |
action:[self doStop]. |
|
1223 |
bpanel addSubView:stopButton after:continueButton. |
|
1224 |
||
92 | 1225 |
dummy := View extent:(10 @ 5) in:bpanel. |
73 | 1226 |
dummy borderWidth:0; level:0. |
61 | 1227 |
|
73 | 1228 |
"/ stepButton destroy. |
1229 |
"/ sendButton destroy. |
|
1230 |
||
1231 |
updateButton := Button |
|
1232 |
label:(resources at:'update') |
|
1233 |
action:[self updateContext] |
|
1234 |
in:bpanel. |
|
1235 |
monitorToggle := Toggle in:bpanel. |
|
1236 |
monitorToggle label:(resources at:'monitor'). |
|
1237 |
monitorToggle pressAction:[self autoUpdateOn]. |
|
1238 |
monitorToggle releaseAction:[self autoUpdateOff]. |
|
1239 |
||
1240 |
"can only look into process - context chain is not active" |
|
1241 |
canContinue := true. |
|
1242 |
||
1243 |
terminateButton enable. |
|
1244 |
abortButton enable. |
|
1245 |
||
1246 |
sendButton disable. |
|
1247 |
stepButton disable. |
|
78 | 1248 |
nextButton disable. |
73 | 1249 |
"/ continueButton disable. |
1250 |
"/ returnButton disable. |
|
1251 |
"/ restartButton disable. |
|
1252 |
||
1253 |
aProcess isNil ifTrue:[ |
|
1254 |
terminateButton disable. |
|
1255 |
abortButton disable. |
|
1256 |
continueButton disable. |
|
1257 |
returnButton disable. |
|
1258 |
restartButton disable. |
|
1259 |
] ifFalse:[ |
|
1260 |
aProcess suspendedContext isNil ifTrue:[ |
|
1261 |
terminateButton disable. |
|
1262 |
]. |
|
1263 |
||
1264 |
self setContext:aProcess suspendedContext. |
|
1265 |
||
1266 |
catchBlock := [ |
|
1267 |
catchBlock := nil. |
|
1268 |
contextArray := nil. |
|
1269 |
selectedContext := actualContext := nil. |
|
1270 |
(exitAction == #terminate) ifTrue:[ |
|
1271 |
aProcess terminate. |
|
1272 |
]. |
|
1273 |
(exitAction == #quickTerminate) ifTrue:[ |
|
1274 |
aProcess terminateNoSignal. |
|
1275 |
]. |
|
1276 |
super destroy |
|
1277 |
]. |
|
1278 |
]. |
|
1279 |
self open |
|
1280 |
! |
|
1281 |
||
1282 |
enter |
|
1283 |
"enter the debugger - on the sending context" |
|
1284 |
||
1285 |
|where| |
|
1286 |
||
1287 |
busy := true. |
|
1288 |
||
1289 |
where := thisContext. "enter" |
|
1290 |
where := where sender. "the calling context" |
|
1291 |
where notNil ifTrue:[ |
|
1292 |
(where receiver == DebugView) ifTrue:[ |
|
1293 |
where := where sender |
|
1294 |
] |
|
1295 |
"where is now interrupted methods context" |
|
1296 |
]. |
|
1297 |
^ self enter:where |
|
0 | 1298 |
! ! |
1299 |
||
1300 |
!DebugView methodsFor:'interrupt handling'! |
|
1301 |
||
1302 |
stepInterrupt |
|
57 | 1303 |
|where here s isWrap method lastWrappedConAddr wrappedMethod inBlock left ignore| |
0 | 1304 |
|
52 | 1305 |
Processor activeProcess ~~ inspectedProcess ifTrue:[ |
1306 |
'stray step interrupt' errorPrintNL. |
|
1307 |
^ self |
|
1308 |
]. |
|
1309 |
||
29 | 1310 |
" |
57 | 1311 |
kludge to hide breakpoint wrappers in the context list: |
1312 |
check if we are in a wrapper methods hidden setup-sequence |
|
1313 |
if so, ignore the interrupt and continue single sending |
|
29 | 1314 |
" |
1315 |
here := thisContext. "stepInterrupt" |
|
1316 |
here := here sender. "the interrupted context" |
|
1317 |
||
57 | 1318 |
"/ '*******' printNL. |
29 | 1319 |
"/ 'here in ' print. |
1320 |
"/ ((ObjectMemory addressOf:here) printStringRadix:16)print. '' printNL. |
|
10 | 1321 |
|
29 | 1322 |
where := here. |
1323 |
isWrap := false. |
|
57 | 1324 |
left := false. |
1325 |
||
1326 |
inWrap ifTrue:[ |
|
1327 |
wrappedMethod := nil. |
|
58 | 1328 |
5 timesRepeat:[ |
29 | 1329 |
"/ where selector printNL. |
57 | 1330 |
(where notNil and:[where isBlockContext not]) ifTrue:[ |
1331 |
method := where method. |
|
1332 |
(method notNil and:[method isWrapped]) ifTrue:[ |
|
1333 |
" |
|
1334 |
in a wrapper method |
|
1335 |
" |
|
1336 |
wrappedMethod ~~ method ifTrue:[ |
|
1337 |
wrappedMethod := method. |
|
1338 |
lastWrappedConAddr := ObjectMemory addressOf:where. |
|
1339 |
where sender receiver == method originalMethod ifFalse:[ |
|
1340 |
isWrap := true. |
|
1341 |
] |
|
1342 |
] ifFalse:[ |
|
1343 |
(ObjectMemory addressOf:where) == steppedContextAddress ifTrue:[ |
|
1344 |
"/ 'change stepCon from: ' print. |
|
1345 |
"/ (steppedContextAddress printStringRadix:16)print. |
|
1346 |
"/ ' to: ' print. |
|
1347 |
"/ (lastWrappedConAddr printStringRadix:16)printNL. |
|
1348 |
||
1349 |
inWrap := false. |
|
1350 |
steppedContextAddress := lastWrappedConAddr |
|
1351 |
] |
|
56 | 1352 |
] |
57 | 1353 |
]. |
1354 |
where := where sender |
|
1355 |
] |
|
1356 |
]. |
|
29 | 1357 |
]. |
1358 |
||
1359 |
isWrap ifTrue:[ |
|
1360 |
"/ 'ignore wrap' printNL. |
|
57 | 1361 |
"/ ' ' printNL. |
45 | 1362 |
" |
1363 |
ignore, while in wrappers hidden setup |
|
1364 |
" |
|
1365 |
where := nil. here := nil. |
|
1366 |
ObjectMemory flushInlineCaches. |
|
58 | 1367 |
StepInterruptPending := 1. |
1368 |
InterruptPending := 1. |
|
45 | 1369 |
InStepInterrupt := nil. |
1370 |
^ nil |
|
29 | 1371 |
]. |
1372 |
||
57 | 1373 |
inBlock := false. |
1374 |
||
29 | 1375 |
" |
1376 |
is this for a send or a step ? |
|
1377 |
" |
|
1378 |
bigStep ifTrue:[ |
|
45 | 1379 |
" |
1380 |
a step - ignore all contexts below the interresting one |
|
1381 |
" |
|
1382 |
where := here. "the interrupted context" |
|
57 | 1383 |
|
1384 |
where home notNil ifTrue:[ |
|
1385 |
(ObjectMemory addressOf:where home) == steppedContextAddress ifTrue:[ |
|
1386 |
"/ '*block*' printNL. |
|
1387 |
inBlock := true |
|
1388 |
] |
|
1389 |
]. |
|
1390 |
||
45 | 1391 |
(ObjectMemory addressOf:where) == steppedContextAddress ifFalse:[ |
1392 |
where := where sender. |
|
57 | 1393 |
|
1394 |
where home notNil ifTrue:[ |
|
1395 |
(ObjectMemory addressOf:where home) == steppedContextAddress ifTrue:[ |
|
1396 |
"/ '*block*' printNL. |
|
1397 |
inBlock := true. |
|
1398 |
] |
|
1399 |
]. |
|
1400 |
||
1401 |
"/ 'looking for ' print. |
|
29 | 1402 |
"/ (steppedContextAddress printStringRadix:16)print. '' printNL. |
57 | 1403 |
|
45 | 1404 |
(ObjectMemory addressOf:where) == steppedContextAddress ifFalse:[ |
1405 |
" |
|
1406 |
check if we are in a context below steppedContext |
|
1407 |
(i.e. if steppedContext can be reached from |
|
1408 |
interrupted context. Not using context-ref but its |
|
1409 |
address to avoid creation of many useless contexts.) |
|
1410 |
" |
|
57 | 1411 |
inBlock ifFalse:[ |
1412 |
[where notNil] whileTrue:[ |
|
29 | 1413 |
"/ ((ObjectMemory addressOf:where) printStringRadix:16)print. ' ' print. |
1414 |
"/ where selector printNL. |
|
57 | 1415 |
(ObjectMemory addressOf:where) == steppedContextAddress ifTrue:[ |
1416 |
"/ 'found it - below; ignore' printNL. |
|
1417 |
" |
|
1418 |
found the interresting context somwehere up in the |
|
1419 |
chain. We seem to be still below the interresting one ... |
|
1420 |
" |
|
1421 |
tracing == true ifTrue:[ |
|
1422 |
here printString printNewline |
|
1423 |
]. |
|
1424 |
where := nil. here := nil. |
|
1425 |
" |
|
1426 |
yes, a context below |
|
1427 |
- continue and schedule another stepInterrupt. |
|
1428 |
Must flush caches since optimized methods not always |
|
1429 |
look for pending interrupts |
|
1430 |
" |
|
1431 |
ObjectMemory flushInlineCaches. |
|
58 | 1432 |
StepInterruptPending := 1. |
1433 |
InterruptPending := 1. |
|
57 | 1434 |
InStepInterrupt := nil. |
1435 |
^ nil |
|
45 | 1436 |
]. |
57 | 1437 |
where := where sender |
45 | 1438 |
]. |
57 | 1439 |
s := 'left stepped method'. |
1440 |
left := true. |
|
45 | 1441 |
]. |
1442 |
] ifTrue:[ |
|
29 | 1443 |
"/ 'found it right in sender' printNL. |
45 | 1444 |
s := 'after step' |
1445 |
]. |
|
1446 |
] ifTrue:[ |
|
29 | 1447 |
"/ 'found it right away' printNL. |
45 | 1448 |
s := 'after step' |
1449 |
]. |
|
0 | 1450 |
] ifFalse:[ |
57 | 1451 |
"/ ' send' printNL. |
45 | 1452 |
" |
1453 |
a send |
|
1454 |
" |
|
1455 |
steppedContextAddress := nil. |
|
1456 |
s := 'after send' |
|
0 | 1457 |
]. |
7 | 1458 |
|
57 | 1459 |
inBlock ifTrue:[ |
1460 |
"/ 'inBlock' printNL. |
|
1461 |
s := 'in block'. |
|
1462 |
]. |
|
1463 |
||
1464 |
"/ where notNil ifTrue:[ |
|
1465 |
"/ '(' print. steppedContextLineno print. ') ' print. |
|
1466 |
"/ where print. |
|
1467 |
"/ '[' print. where lineNumber print. ']' printNL. |
|
1468 |
"/ ]. |
|
1469 |
||
1470 |
ignore := false. |
|
78 | 1471 |
|
57 | 1472 |
(bigStep |
78 | 1473 |
and:[steppedContextLineno notNil |
57 | 1474 |
and:[where notNil |
78 | 1475 |
and:[where lineNumber == steppedContextLineno]]]) ifTrue:[ |
57 | 1476 |
"/ 'same line - ignored' printNL. |
1477 |
ignore := true |
|
1478 |
]. |
|
1479 |
||
1480 |
(left not |
|
1481 |
and:[skipLineNr notNil |
|
1482 |
and:[where lineNumber ~~ skipLineNr]]) ifTrue:[ |
|
1483 |
"/ 'skip (' print. skipLineNr print. ' unreached - ignored' printNL. |
|
1484 |
ignore := true |
|
1485 |
]. |
|
1486 |
||
1487 |
ignore ifTrue:[ |
|
1488 |
"/' ' printNL. |
|
1489 |
where := nil. here := nil. |
|
1490 |
" |
|
1491 |
yes, a context below |
|
1492 |
- continue and schedule another stepInterrupt. |
|
1493 |
Must flush caches since optimized methods not always |
|
1494 |
look for pending interrupts |
|
1495 |
" |
|
1496 |
ObjectMemory flushInlineCaches. |
|
58 | 1497 |
StepInterruptPending := 1. |
1498 |
InterruptPending := 1. |
|
57 | 1499 |
InStepInterrupt := nil. |
1500 |
^ nil |
|
1501 |
]. |
|
1502 |
||
1503 |
"/ ' ' printNL. |
|
1504 |
||
29 | 1505 |
name := Processor activeProcess nameOrId. |
7 | 1506 |
self label:(s , ' (process: ' , name , ')'). |
1507 |
||
57 | 1508 |
tracing := false. |
1509 |
bigStep := false. |
|
1510 |
||
0 | 1511 |
"release refs to context" |
1512 |
where := nil. here := nil. |
|
29 | 1513 |
self enter:thisContext sender |
0 | 1514 |
! ! |
1515 |
||
1516 |
!DebugView methodsFor:'user interaction'! |
|
1517 |
||
1518 |
showSelection:lineNr |
|
1519 |
"user clicked on a header line - show selected code in textView" |
|
1520 |
||
56 | 1521 |
|con homeContext sel method code canAccept |
105 | 1522 |
implementorClass lineNrInMethod rec m line |
124 | 1523 |
sender selSender tryVars possibleBlocks errMsg| |
0 | 1524 |
|
1525 |
contextArray notNil ifTrue:[ |
|
45 | 1526 |
lineNr <= contextArray size ifTrue:[ |
1527 |
con := contextArray at:lineNr. |
|
1528 |
]. |
|
1529 |
" |
|
1530 |
clicking on the '** ...'-line shows more ... |
|
1531 |
" |
|
1532 |
con isNil ifTrue:[ |
|
1533 |
line := contextView list at:lineNr. |
|
1534 |
(line startsWith:'**') ifTrue:[ |
|
73 | 1535 |
self showMore. |
45 | 1536 |
contextView selection:lineNr. |
1537 |
con := contextArray at:lineNr |
|
108 | 1538 |
]. |
1539 |
con isNil ifTrue:[^ self]. |
|
45 | 1540 |
]. |
105 | 1541 |
|
1542 |
" |
|
1543 |
give it to the (lower right) inspector |
|
1544 |
" |
|
1545 |
contextInspector inspect:con. |
|
1546 |
||
1547 |
" |
|
1548 |
get the home context |
|
1549 |
" |
|
45 | 1550 |
con isBlockContext ifTrue:[ |
1551 |
homeContext := con methodHome |
|
1552 |
] ifFalse:[ |
|
1553 |
homeContext := con |
|
1554 |
]. |
|
107 | 1555 |
con canReturn ifTrue:[ |
1556 |
returnButton enable. restartButton enable. |
|
1557 |
] ifFalse:[ |
|
1558 |
returnButton disable. restartButton disable. |
|
1559 |
]. |
|
105 | 1560 |
|
1561 |
lineNrInMethod := con lineNumber. |
|
1562 |
||
1563 |
canAccept := false. |
|
1564 |
||
55 | 1565 |
homeContext isNil ifTrue:[ |
1566 |
" |
|
1567 |
mhmh - an optimized block |
|
1568 |
should get the block here, and get the method from |
|
1569 |
that one ... |
|
105 | 1570 |
But in 2.10.x, there is no easy way to get to the block |
1571 |
since that one is not in the context. |
|
1572 |
Starting with 2.11, the new block calling scheme will fix this. |
|
55 | 1573 |
" |
105 | 1574 |
|
1575 |
"temporary kludge - peek into the sender context. |
|
1576 |
If its a do-like method and there is a single block variable |
|
1577 |
in the args or temporaries, that must be the one. |
|
1578 |
This helps in some cases. |
|
1579 |
" |
|
1580 |
(sender := con sender) notNil ifTrue:[ |
|
1581 |
tryVars := false. |
|
1582 |
(selSender := sender selector) notNil ifTrue:[ |
|
1583 |
(selSender endsWith:'do:') ifTrue:[ |
|
1584 |
tryVars := true. |
|
1585 |
] ifFalse:[ |
|
1586 |
(selSender endsWith:'Do:') ifTrue:[ |
|
1587 |
tryVars := true. |
|
1588 |
] |
|
1589 |
] |
|
1590 |
]. |
|
1591 |
tryVars ifTrue:[ |
|
1592 |
possibleBlocks := sender argsAndVars select:[:v | v isBlock]. |
|
1593 |
possibleBlocks := possibleBlocks select:[:b | b home isNil]. |
|
1594 |
possibleBlocks size == 1 ifTrue:[ |
|
1595 |
method := possibleBlocks first method. |
|
1596 |
]. |
|
1597 |
] |
|
1598 |
]. |
|
1599 |
||
55 | 1600 |
] ifFalse:[ |
105 | 1601 |
"fetch rec here - so we wont need context in doItAction" |
1602 |
rec := homeContext receiver. |
|
1603 |
||
45 | 1604 |
sel := homeContext selector. |
1605 |
sel notNil ifTrue:[ |
|
56 | 1606 |
canAccept := true. |
1607 |
||
55 | 1608 |
implementorClass := homeContext methodClass. |
45 | 1609 |
implementorClass isNil ifTrue:[ |
56 | 1610 |
" |
57 | 1611 |
special: look if this context was created by |
56 | 1612 |
valueWithReceiver kind of method invocation; |
1613 |
if so, grab the method from the sender and show it |
|
1614 |
" |
|
124 | 1615 |
((sender := con sender) notNil |
1616 |
and:[(sender selector startsWith:'valueWithReceiver:') |
|
1617 |
and:[sender receiver isMethod]]) ifTrue:[ |
|
1618 |
method := sender receiver. |
|
56 | 1619 |
code := method source. |
1620 |
canAccept := false. |
|
1621 |
] ifFalse:[ |
|
105 | 1622 |
(method := con method) notNil ifTrue:[ |
57 | 1623 |
code := method source. |
1624 |
canAccept := false. |
|
1625 |
] |
|
56 | 1626 |
] |
45 | 1627 |
] ifFalse:[ |
1628 |
method := implementorClass compiledMethodAt:sel. |
|
105 | 1629 |
]. |
1630 |
] |
|
1631 |
]. |
|
1632 |
||
1633 |
code isNil ifTrue:[ |
|
124 | 1634 |
errMsg := nil. |
105 | 1635 |
method notNil ifTrue:[ |
1636 |
code := method source. |
|
1637 |
code isNil ifTrue:[ |
|
1638 |
method sourceFilename notNil ifTrue:[ |
|
1639 |
codeView contents:(resources |
|
45 | 1640 |
string:'** no sourcefile: %1 **' |
52 | 1641 |
with:method sourceFilename). |
105 | 1642 |
codeView flash |
1643 |
] ifFalse:[ |
|
124 | 1644 |
errMsg := '** no source **' |
45 | 1645 |
] |
105 | 1646 |
] |
1647 |
] ifFalse:[ |
|
1648 |
homeContext isNil ifTrue:[ |
|
124 | 1649 |
errMsg := '** sorry; cannot show code of all optimized blocks (yet) **'. |
45 | 1650 |
] ifFalse:[ |
124 | 1651 |
errMsg := '** no method - no source **' |
105 | 1652 |
] |
124 | 1653 |
]. |
1654 |
errMsg notNil ifTrue:[ |
|
1655 |
self showError:errMsg |
|
45 | 1656 |
] |
1657 |
]. |
|
105 | 1658 |
|
1659 |
code isNil ifTrue:[ |
|
1660 |
canAccept := false. |
|
1661 |
] ifFalse:[ |
|
1662 |
codeView contents:code. |
|
1663 |
(lineNrInMethod notNil and:[lineNrInMethod ~~ 0]) ifTrue:[ |
|
110 | 1664 |
"/ lineNrInMethod > codeView list size ifTrue:[ |
1665 |
"/ lineNrInMethod := codeView list size + 1 |
|
1666 |
"/ ]. |
|
1667 |
"/ codeView selectLine:lineNrInMethod. |
|
1668 |
"/ codeView makeSelectionVisible |
|
132 | 1669 |
|
110 | 1670 |
lineNrInMethod <= codeView list size ifTrue:[ |
132 | 1671 |
(lineNrInMethod == 255 |
1672 |
and:[method notNil |
|
1673 |
and:[method code isNil]]) ifTrue:[ |
|
1674 |
"/ means: do not really know in interpreted methods |
|
1675 |
codeView selectFromLine:255 col:1 toLine:codeView list size + 1 col:0. |
|
1676 |
] ifFalse:[ |
|
1677 |
codeView selectLine:lineNrInMethod. |
|
1678 |
]. |
|
110 | 1679 |
codeView makeSelectionVisible |
1680 |
] |
|
105 | 1681 |
]. |
1682 |
]. |
|
1683 |
||
1684 |
canAccept ifTrue:[ |
|
1685 |
codeView acceptAction:[:code | self codeAccept:code asString] |
|
1686 |
] ifFalse:[ |
|
1687 |
codeView acceptAction:nil. |
|
1688 |
]. |
|
1689 |
||
45 | 1690 |
receiverInspector inspect:rec. |
105 | 1691 |
|
1692 |
" |
|
1693 |
the one below is wrong: currently, the |
|
1694 |
evaluator cannot handle passed contexts. |
|
1695 |
Once it does, pass con as in:-arg |
|
1696 |
" |
|
45 | 1697 |
codeView doItAction:[:theCode | |
100 | 1698 |
rec class evaluatorClass |
45 | 1699 |
evaluate:theCode |
105 | 1700 |
in:nil "/ *** con |
45 | 1701 |
receiver:rec |
1702 |
notifying:codeView |
|
1703 |
logged:true |
|
1704 |
ifFail:nil |
|
1705 |
]. |
|
1706 |
||
57 | 1707 |
selectedContext := homeContext. |
1708 |
actualContext := con |
|
0 | 1709 |
]. |
1710 |
||
105 | 1711 |
"clear out locals to prevent keeping around unneeded contexts |
1712 |
(due to the block held in codeView). |
|
1713 |
(not really needed, since stuff gets collected away sooner or later ... |
|
1714 |
... but this makes it a bit sooner) |
|
1715 |
" |
|
0 | 1716 |
con := nil. |
29 | 1717 |
homeContext := nil. |
1718 |
||
105 | 1719 |
" |
1720 |
enable/disable some menu items |
|
1721 |
" |
|
45 | 1722 |
m := contextView middleButtonMenu. |
1723 |
m notNil ifTrue:[ |
|
73 | 1724 |
m enable:#implementors. |
1725 |
m enable:#senders. |
|
1726 |
m enable:#inspectContext. |
|
99 | 1727 |
m enable:#browseClass. |
29 | 1728 |
|
45 | 1729 |
(method notNil and:[method isWrapped]) ifTrue:[ |
73 | 1730 |
m enable:#removeBreakpoint. |
45 | 1731 |
] ifFalse:[ |
73 | 1732 |
m disable:#removeBreakpoint. |
45 | 1733 |
] |
29 | 1734 |
] |
0 | 1735 |
! |
1736 |
||
73 | 1737 |
destroy |
1738 |
"closing the debugger implies an abort or continue" |
|
1739 |
||
1740 |
contextView middleButtonMenu hide. |
|
1741 |
||
1742 |
" |
|
1743 |
we manually release all private data, since the Debugger |
|
1744 |
is cached for reuse - thus the memory would not be collectable |
|
1745 |
otherwise. |
|
1746 |
" |
|
1747 |
codeView acceptAction:nil. |
|
1748 |
codeView doItAction:nil. |
|
1749 |
codeView contents:nil. |
|
1750 |
catchBlock := nil. |
|
1751 |
||
1752 |
receiverInspector release. |
|
1753 |
contextInspector release. |
|
1754 |
inspectedProcess := nil. |
|
1755 |
exitAction := nil. |
|
1756 |
contextArray := nil. |
|
1757 |
selectedContext := actualContext := nil. |
|
1758 |
grabber := nil. |
|
1759 |
self autoUpdateOff. |
|
1760 |
||
1761 |
inspecting ifFalse:[ |
|
1762 |
exclusive ifTrue:[ |
|
1763 |
CachedExclusive == self ifTrue:[ |
|
1764 |
CachedExclusive := nil. |
|
1765 |
] |
|
1766 |
] ifFalse:[ |
|
1767 |
CachedDebugger == self ifTrue:[ |
|
1768 |
CachedDebugger := nil |
|
1769 |
] |
|
1770 |
]. |
|
1771 |
||
1772 |
inspecting ifFalse:[ |
|
1773 |
canAbort ifTrue:[ |
|
1774 |
self doAbort. |
|
1775 |
] ifFalse:[ |
|
1776 |
self doContinue |
|
1777 |
] |
|
1778 |
]. |
|
1779 |
]. |
|
1780 |
super destroy "/ 1.12.94 |
|
1781 |
! |
|
1782 |
||
0 | 1783 |
codeAccept:someCode |
1784 |
"user wants some code to be recompiled - must unwind stack since everything above |
|
48 | 1785 |
and including selected method cannot be continued." |
1786 |
||
1787 |
" |
|
1788 |
actually, this is not true, since the active methods will still be |
|
1789 |
executed correctly - however, the code shown in the debugger is no |
|
1790 |
longer in sync (showing the new code) with the executed code. |
|
1791 |
Therefore, we hide those contexts to avoid confusion .... |
|
1792 |
If you dont like this behavior, remove the 'inspecting ifFalse:' check below" |
|
0 | 1793 |
|
1794 |
"walk up context chain and find highest context which is either the selected context, |
|
1795 |
or - if its a block-context - whose home is the selected context" |
|
1796 |
||
1797 |
|con top sel implementorClass method newMethod| |
|
1798 |
||
1799 |
codeView cursor:Cursor execute. |
|
1800 |
||
45 | 1801 |
" |
1802 |
find the method-home context for this one |
|
1803 |
" |
|
0 | 1804 |
con := selectedContext. |
1805 |
top := con. |
|
1806 |
[con notNil] whileTrue:[ |
|
45 | 1807 |
(con methodHome == selectedContext) ifTrue:[ |
1808 |
top := con |
|
1809 |
]. |
|
1810 |
con := con sender |
|
0 | 1811 |
]. |
48 | 1812 |
" |
1813 |
use class&selector to find the method for the compilation |
|
1814 |
and compile. |
|
1815 |
" |
|
0 | 1816 |
sel := selectedContext selector. |
55 | 1817 |
implementorClass := selectedContext methodClass. |
0 | 1818 |
method := implementorClass compiledMethodAt:sel. |
61 | 1819 |
newMethod := implementorClass compilerClass |
1820 |
compile:someCode |
|
1821 |
forClass:implementorClass |
|
1822 |
inCategory:(method category) |
|
1823 |
notifying:codeView. |
|
0 | 1824 |
|
45 | 1825 |
inspecting ifFalse:[ |
48 | 1826 |
" |
1827 |
if it worked, remove everything up to and including top |
|
1828 |
from context chain |
|
1829 |
" |
|
45 | 1830 |
(newMethod notNil and:[newMethod ~~ #Error]) ifTrue:[ |
1831 |
self setContext:(top sender). |
|
0 | 1832 |
|
48 | 1833 |
" |
1834 |
continue/step is no longer possible |
|
1835 |
" |
|
45 | 1836 |
canContinue := false. |
1837 |
self showSelection:1. |
|
1838 |
exitAction := #return |
|
1839 |
]. |
|
0 | 1840 |
]. |
1841 |
codeView cursor:Cursor normal |
|
73 | 1842 |
! ! |
1843 |
||
1844 |
!DebugView methodsFor:'menu / button actions'! |
|
1845 |
||
1846 |
doAbort |
|
1847 |
"abort - send Object>>abortSignal, which is usually cought |
|
1848 |
at save places (for example: in the event loop) and returns back |
|
1849 |
from whatever the process is doing, but does not terminate it." |
|
1850 |
||
1851 |
inspecting ifTrue:[ |
|
1852 |
inspectedProcess isDead ifTrue:[ |
|
1853 |
self showTerminated. |
|
1854 |
^ self |
|
1855 |
]. |
|
1856 |
(Object abortSignal isHandledIn:inspectedProcess suspendedContext) ifFalse:[ |
|
1857 |
self showError:'** the process does not handle the abort signal **' |
|
1858 |
] ifTrue:[ |
|
1859 |
self interruptProcessWith:[Object abortSignal raise]. |
|
1860 |
]. |
|
1861 |
^ self |
|
1862 |
]. |
|
1863 |
||
1864 |
steppedContextAddress := nil. |
|
1865 |
haveControl := false. |
|
1866 |
exitAction := #abort. |
|
1867 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
|
1868 |
"exit private event-loop" |
|
1869 |
catchBlock notNil ifTrue:[ |
|
1870 |
abortButton turnOff. |
|
1871 |
catchBlock value. |
|
1872 |
'DEBUGGER: oops, abort failed' errorPrintNL. |
|
1873 |
] |
|
1874 |
]. |
|
1875 |
^ self. |
|
1876 |
||
1877 |
"obsolete ..." |
|
1878 |
"/ Processor activeProcess id == 0 ifTrue:[ |
|
1879 |
"/ "dont allow termination of main-thread" |
|
1880 |
"/ exitAction := #abort |
|
1881 |
"/ ] ifFalse:[ |
|
1882 |
"/ exitAction := #terminate |
|
1883 |
"/ ] |
|
0 | 1884 |
! |
1885 |
||
73 | 1886 |
exit |
0 | 1887 |
"exit from menu: immediate exit from smalltalk" |
1888 |
||
132 | 1889 |
OperatingSystem exit |
0 | 1890 |
! |
1891 |
||
73 | 1892 |
removeBreakpoint |
29 | 1893 |
"remove breakpoint on the selected contexts method - if any" |
1894 |
||
1895 |
|implementorClass method| |
|
1896 |
||
52 | 1897 |
selectedContext isNil ifTrue:[ |
1898 |
^ self showError:'** select a context first **' |
|
1899 |
]. |
|
1900 |
||
55 | 1901 |
implementorClass := selectedContext methodClass. |
29 | 1902 |
implementorClass notNil ifTrue:[ |
45 | 1903 |
method := implementorClass compiledMethodAt:selectedContext selector. |
1904 |
(method notNil and:[method isWrapped]) ifTrue:[ |
|
1905 |
MessageTracer unwrapMethod:method |
|
1906 |
] |
|
29 | 1907 |
]. |
73 | 1908 |
contextView middleButtonMenu disable:#removeBreakpoint. |
29 | 1909 |
! |
1910 |
||
73 | 1911 |
removeAllBreakpoints |
48 | 1912 |
"remove all trace & breakpoints - if any" |
1913 |
||
1914 |
MessageTracer unwrapAllMethods |
|
1915 |
! |
|
1916 |
||
73 | 1917 |
browseClass |
1918 |
selectedContext isNil ifTrue:[ |
|
1919 |
^ self showError:'** select a context first **' |
|
1920 |
]. |
|
1921 |
SystemBrowser browseClass:(selectedContext method who at:1). |
|
1922 |
! |
|
1923 |
||
108 | 1924 |
browseClassHierarchy |
1925 |
selectedContext isNil ifTrue:[ |
|
1926 |
^ self showError:'** select a context first **' |
|
1927 |
]. |
|
1928 |
SystemBrowser browseClassHierarchy:(selectedContext method who at:1). |
|
1929 |
! |
|
1930 |
||
1931 |
browseFullClassProtocol |
|
1932 |
selectedContext isNil ifTrue:[ |
|
1933 |
^ self showError:'** select a context first **' |
|
1934 |
]. |
|
1935 |
SystemBrowser browseFullClassProtocol:(selectedContext method who at:1). |
|
1936 |
! |
|
1937 |
||
73 | 1938 |
autoUpdateOff |
1939 |
"stop the update process" |
|
1940 |
||
1941 |
updateProcess notNil ifTrue:[ |
|
1942 |
monitorToggle lampColor:(Color yellow). |
|
1943 |
updateProcess terminate. |
|
1944 |
updateProcess := nil |
|
1945 |
] |
|
1946 |
! |
|
1947 |
||
1948 |
senders |
|
29 | 1949 |
"open a browser on the senders" |
22 | 1950 |
|
52 | 1951 |
selectedContext isNil ifTrue:[ |
1952 |
^ self showError:'** select a context first **' |
|
1953 |
]. |
|
1954 |
SystemBrowser browseAllCallsOn:selectedContext selector. |
|
29 | 1955 |
! |
1956 |
||
73 | 1957 |
implementors |
29 | 1958 |
"open a browser on the implementors" |
1959 |
||
52 | 1960 |
selectedContext isNil ifTrue:[ |
1961 |
^ self showError:'** select a context first **' |
|
1962 |
]. |
|
1963 |
SystemBrowser browseImplementorsOf:selectedContext selector. |
|
29 | 1964 |
! |
1965 |
||
73 | 1966 |
showMore |
29 | 1967 |
"double number of contexts shown" |
1968 |
||
52 | 1969 |
|oldSelection con| |
29 | 1970 |
|
1971 |
contextArray notNil ifTrue:[ |
|
45 | 1972 |
oldSelection := contextView selection. |
1973 |
nChainShown := nChainShown * 2. |
|
52 | 1974 |
con := contextArray at:1. |
1975 |
contextArray at:1 put:nil. |
|
1976 |
self setContext:con. |
|
45 | 1977 |
contextView selection:oldSelection. |
29 | 1978 |
] |
0 | 1979 |
! |
1980 |
||
1981 |
doSend |
|
78 | 1982 |
"single send; reenter with next message send" |
0 | 1983 |
|
29 | 1984 |
inspecting ifTrue:[^ self]. |
1985 |
||
0 | 1986 |
canContinue ifTrue:[ |
45 | 1987 |
steppedContextAddress := nil. |
1988 |
haveControl := false. |
|
1989 |
exitAction := #step. |
|
1990 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
|
1991 |
"exit private event-loop" |
|
1992 |
catchBlock notNil ifTrue:[catchBlock value]. |
|
53 | 1993 |
'DEBUGGER: oops, send failed' errorPrintNL. |
1994 |
sendButton turnOff. |
|
45 | 1995 |
]. |
0 | 1996 |
] |
1997 |
! |
|
1998 |
||
53 | 1999 |
doStep:lineNr |
78 | 2000 |
"step until we pass lineNr (if nonNil) or to next line (if nil) |
2001 |
or to next send (if -1)" |
|
57 | 2002 |
|
2003 |
|con method| |
|
0 | 2004 |
|
29 | 2005 |
inspecting ifTrue:[^ self]. |
2006 |
||
0 | 2007 |
canContinue ifTrue:[ |
45 | 2008 |
selectedContext notNil ifTrue:[ |
57 | 2009 |
con := selectedContext. |
2010 |
steppedContextLineno := actualContext lineNumber. |
|
45 | 2011 |
] ifFalse:[ |
57 | 2012 |
con := contextArray at:2. |
2013 |
steppedContextLineno := con lineNumber. |
|
45 | 2014 |
]. |
78 | 2015 |
skipLineNr := lineNr. |
2016 |
||
2017 |
lineNr == -1 ifTrue:[ |
|
2018 |
steppedContextLineno := skipLineNr := nil. |
|
2019 |
]. |
|
57 | 2020 |
|
2021 |
steppedContextAddress := ObjectMemory addressOf:con. |
|
2022 |
" |
|
2023 |
if we step in a wrapped method, |
|
2024 |
prepare to skip the prolog ... |
|
2025 |
" |
|
2026 |
"/ ' step con:' print. steppedContextAddress printHex. ' ' printNL. |
|
2027 |
inWrap := false. |
|
2028 |
method := con method. |
|
2029 |
(method notNil and:[method isWrapped]) ifTrue:[ |
|
2030 |
inWrap := true |
|
2031 |
]. |
|
2032 |
||
2033 |
con := nil. |
|
45 | 2034 |
bigStep := true. |
2035 |
haveControl := false. |
|
2036 |
exitAction := #step. |
|
2037 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
|
2038 |
"exit private event-loop" |
|
2039 |
catchBlock notNil ifTrue:[catchBlock value]. |
|
53 | 2040 |
'DEBUGGER: oops, step failed' errorPrintNL. |
2041 |
stepButton turnOff. |
|
78 | 2042 |
nextButton turnOff. |
2043 |
sendButton turnOff. |
|
45 | 2044 |
]. |
0 | 2045 |
] |
2046 |
! |
|
2047 |
||
78 | 2048 |
doNext |
2049 |
"skip for next source-code line" |
|
53 | 2050 |
|
2051 |
self doStep:nil |
|
2052 |
! |
|
2053 |
||
78 | 2054 |
doStep |
2055 |
"skip for next send in selected method" |
|
53 | 2056 |
|
78 | 2057 |
self doStep:-1 |
2058 |
! |
|
2059 |
||
2060 |
skip |
|
2061 |
"skip for cursor line in selected method" |
|
2062 |
||
2063 |
self doStep:codeView cursorLine. |
|
53 | 2064 |
! |
2065 |
||
73 | 2066 |
doReturn |
2067 |
"return - the selected context will do a ^nil" |
|
0 | 2068 |
|
45 | 2069 |
inspecting ifTrue:[ |
75 | 2070 |
selectedContext isNil ifTrue:[ |
2071 |
^ self showError:'** select a context first **' |
|
2072 |
]. |
|
2073 |
self interruptProcessWith:[selectedContext unwind]. |
|
2074 |
^ self |
|
45 | 2075 |
]. |
29 | 2076 |
|
0 | 2077 |
steppedContextAddress := nil. |
2078 |
haveControl := false. |
|
73 | 2079 |
exitAction := #return. |
13 | 2080 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
75 | 2081 |
"exit private event-loop" |
2082 |
catchBlock notNil ifTrue:[catchBlock value]. |
|
2083 |
'DEBUGGER: oops, return failed' errorPrintNL. |
|
2084 |
returnButton turnOff. |
|
13 | 2085 |
]. |
0 | 2086 |
! |
2087 |
||
7 | 2088 |
doTerminate |
48 | 2089 |
"terminate - the process has a chance for cleanup" |
7 | 2090 |
|
45 | 2091 |
inspecting ifTrue:[ |
92 | 2092 |
self processPerform:#terminate. |
45 | 2093 |
^ self |
2094 |
]. |
|
2095 |
||
7 | 2096 |
steppedContextAddress := nil. |
2097 |
haveControl := false. |
|
13 | 2098 |
exitAction := #terminate. |
2099 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
|
45 | 2100 |
"exit private event-loop" |
2101 |
catchBlock notNil ifTrue:[catchBlock value]. |
|
2102 |
inspecting ifFalse:[ |
|
53 | 2103 |
'DEBUGGER: oops, terminate failed' errorPrintNL. |
45 | 2104 |
self warn:'terminate failed'. |
2105 |
]. |
|
53 | 2106 |
terminateButton turnOff. |
13 | 2107 |
]. |
7 | 2108 |
! |
2109 |
||
73 | 2110 |
doTraceStep |
2111 |
"tracestep - not implemented yet" |
|
45 | 2112 |
|
73 | 2113 |
canContinue ifTrue:[ |
2114 |
tracing := true. |
|
2115 |
self doStep |
|
2116 |
] |
|
0 | 2117 |
! |
2118 |
||
2119 |
doRestart |
|
48 | 2120 |
"restart - the selected context will be restarted" |
0 | 2121 |
|
45 | 2122 |
inspecting ifTrue:[ |
52 | 2123 |
selectedContext isNil ifTrue:[ |
2124 |
^ self showError:'** select a context first **' |
|
2125 |
]. |
|
61 | 2126 |
self interruptProcessWith:[selectedContext unwindAndRestart]. |
45 | 2127 |
^ self |
2128 |
]. |
|
29 | 2129 |
|
0 | 2130 |
steppedContextAddress := nil. |
2131 |
haveControl := false. |
|
13 | 2132 |
exitAction := #restart. |
2133 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
|
45 | 2134 |
"exit private event-loop" |
2135 |
catchBlock notNil ifTrue:[catchBlock value]. |
|
53 | 2136 |
'DEBUGGER: oops, restart failed' errorPrintNL. |
2137 |
restartButton turnOff. |
|
13 | 2138 |
]. |
0 | 2139 |
! |
2140 |
||
73 | 2141 |
quickTerminate |
2142 |
"quick terminate - the process will get no chance for cleanup actions" |
|
2143 |
||
2144 |
inspecting ifTrue:[ |
|
92 | 2145 |
self processPerform:#terminateNoSignal. |
73 | 2146 |
^ self |
2147 |
]. |
|
2148 |
||
2149 |
steppedContextAddress := nil. |
|
2150 |
haveControl := false. |
|
2151 |
exitAction := #quickTerminate. |
|
2152 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
|
2153 |
"exit private event-loop" |
|
2154 |
catchBlock notNil ifTrue:[catchBlock value]. |
|
2155 |
inspecting ifFalse:[ |
|
2156 |
'DEBUGGER: oops, terminate failed' errorPrintNL. |
|
2157 |
self warn:'terminate failed'. |
|
2158 |
]. |
|
2159 |
terminateButton turnOff. |
|
2160 |
]. |
|
2161 |
! |
|
2162 |
||
0 | 2163 |
doTrace |
22 | 2164 |
"tracing - not really implemented ..." |
2165 |
||
2166 |
self warn:'this function is not yet implemented'. |
|
2167 |
||
107 | 2168 |
"/ |v b| |
2169 |
"/ |
|
57 | 2170 |
"/ traceView isNil ifTrue:[ |
2171 |
"/ v := StandardSystemView on:Display. |
|
2172 |
"/ v label:'Debugger-Trace'. |
|
2173 |
"/ v icon:icon. |
|
2174 |
"/ |
|
2175 |
"/ b := Button label:'untrace' in:v. |
|
2176 |
"/ b origin:(0 @ 0) extent:(1.0 @ (b height)). |
|
2177 |
"/ b action:[ |
|
58 | 2178 |
"/ StepInterruptPending := nil. |
57 | 2179 |
"/ tracing := false. |
2180 |
"/ v unrealize. |
|
2181 |
"/ traceView := nil |
|
2182 |
"/ ]. |
|
2183 |
"/ traceView := ScrollableView for:TextCollector in:v. |
|
2184 |
"/ traceView origin:(0 @ (b height)) |
|
2185 |
"/ extent:[v width @ (v height - b height)] |
|
2186 |
"/ ]. |
|
2187 |
"/ v realize. |
|
2188 |
"/ |
|
2189 |
"/ tracing := true. |
|
0 | 2190 |
! |
2191 |
||
2192 |
doNoTrace |
|
2193 |
traceView notNil ifTrue:[ |
|
45 | 2194 |
traceView topView destroy. |
2195 |
traceView := nil. |
|
22 | 2196 |
]. |
2197 |
tracing := false |
|
0 | 2198 |
! |
2199 |
||
45 | 2200 |
doStop |
2201 |
"stop the process (if its running, otherwise this is a no-op)" |
|
2202 |
||
2203 |
inspecting ifTrue:[ |
|
92 | 2204 |
self processPerform:#stop. |
45 | 2205 |
^ self |
2206 |
]. |
|
2207 |
! |
|
2208 |
||
0 | 2209 |
doContinue |
2210 |
"continue from menu" |
|
2211 |
||
45 | 2212 |
inspecting ifTrue:[ |
92 | 2213 |
self processPerform:#resume. |
45 | 2214 |
^ self |
2215 |
]. |
|
0 | 2216 |
canContinue ifTrue:[ |
45 | 2217 |
steppedContextAddress := nil. |
2218 |
tracing := false. |
|
2219 |
haveControl := false. |
|
2220 |
exitAction := #continue. |
|
2221 |
ProcessorScheduler isPureEventDriven ifFalse:[ |
|
2222 |
"exit private event-loop" |
|
2223 |
catchBlock notNil ifTrue:[catchBlock value]. |
|
53 | 2224 |
'DEBUGGER: oops, continue failed' errorPrintNL. |
2225 |
continueButton turnOff. |
|
45 | 2226 |
]. |
15 | 2227 |
] ifFalse:[ |
45 | 2228 |
inspecting ifFalse:[ |
53 | 2229 |
'resuming top context' errorPrintNL. |
45 | 2230 |
self showSelection:1. |
2231 |
self doReturn |
|
2232 |
] |
|
29 | 2233 |
] |
2234 |
! |
|
2235 |
||
73 | 2236 |
inspectContext |
29 | 2237 |
"launch an inspector on the currently selected context" |
2238 |
||
45 | 2239 |
contextView selection notNil ifTrue:[ |
2240 |
(contextView selectionValue startsWith:'**') ifFalse:[ |
|
2241 |
(contextArray at:(contextView selection)) inspect. |
|
2242 |
] |
|
2243 |
] |
|
2244 |
! |
|
2245 |
||
124 | 2246 |
copyWalkbackText |
2247 |
"place the contents of the walkback view into the copy-paste buffer. |
|
2248 |
This allows pasting it into some other view for printing ..." |
|
2249 |
||
2250 |
self setTextSelection:(contextArray collect:[:con | con fullPrintString]) asStringCollection |
|
2251 |
||
2252 |
"Modified: 28.8.1995 / 15:31:59 / claus" |
|
2253 |
! |
|
2254 |
||
45 | 2255 |
autoUpdateOn |
48 | 2256 |
"fork a subprocess which updates the contextList in regular intervals" |
2257 |
||
45 | 2258 |
updateProcess isNil ifTrue:[ |
2259 |
updateProcess := |
|
2260 |
[ |
|
2261 |
[true] whileTrue:[ |
|
2262 |
monitorToggle showLamp ifTrue:[ |
|
2263 |
monitorToggle lampColor:(Color yellow). |
|
2264 |
] ifFalse:[ |
|
2265 |
monitorToggle activeForegroundColor:Color black. |
|
2266 |
]. |
|
2267 |
(Delay forSeconds:0.25) wait. |
|
2268 |
self updateContext. |
|
2269 |
monitorToggle showLamp ifTrue:[ |
|
2270 |
monitorToggle lampColor:(Color red). |
|
2271 |
] ifFalse:[ |
|
2272 |
monitorToggle activeForegroundColor:Color red. |
|
2273 |
]. |
|
2274 |
(Delay forSeconds:0.25) wait. |
|
2275 |
self updateContext. |
|
2276 |
] |
|
2277 |
] forkAt:(Processor activePriority - 1) |
|
2278 |
] |
|
2279 |
||
0 | 2280 |
! ! |