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