author | Claus Gittinger <cg@exept.de> |
Wed, 03 Jul 1996 11:04:45 +0200 | |
changeset 655 | c9a1de4e627a |
parent 654 | dac2634ce5ec |
child 657 | aa1816733b59 |
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 |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
140 |
"Modified: 1.7.1996 / 12:26:18 / 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:[ |
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
622 |
"bigStep" steppedContextLineno notNil ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
623 |
Context singleStepInterruptRequest raiseWith:#next |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
624 |
] ifFalse:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
625 |
Context singleStepInterruptRequest raiseWith:#step |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
626 |
] |
529
57a78164dae5
allow different implementations of singleStep (JAVA support)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
627 |
] ifFalse:[ |
57a78164dae5
allow different implementations of singleStep (JAVA support)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
628 |
ObjectMemory flushInlineCaches. |
57a78164dae5
allow different implementations of singleStep (JAVA support)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
629 |
StepInterruptPending := 1. |
57a78164dae5
allow different implementations of singleStep (JAVA support)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
630 |
InterruptPending := 1. |
57a78164dae5
allow different implementations of singleStep (JAVA support)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
631 |
InStepInterrupt := nil |
57a78164dae5
allow different implementations of singleStep (JAVA support)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
632 |
] |
374 | 633 |
] |
73 | 634 |
] ifFalse:[ |
374 | 635 |
OpenDebuggers notNil ifTrue:[ |
636 |
idx := OpenDebuggers identityIndexOf:self. |
|
637 |
idx ~~ 0 ifTrue:[ |
|
638 |
OpenDebuggers at:idx put:nil |
|
639 |
] |
|
640 |
]. |
|
641 |
self cacheMyself. |
|
73 | 642 |
] |
210
947f9a23b06a
better error handling in modal debugger - use new SynchronousWindowSensor
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
643 |
|
947f9a23b06a
better error handling in modal debugger - use new SynchronousWindowSensor
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
644 |
"Created: 24.11.1995 / 19:52:54 / cg" |
528
a5ba1a3d0b45
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
527
diff
changeset
|
645 |
"Modified: 3.5.1996 / 23:58:16 / stefan" |
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
646 |
"Modified: 1.7.1996 / 11:57:07 / cg" |
73 | 647 |
! |
648 |
||
649 |
openOn:aProcess |
|
650 |
"enter the debugger on a process - |
|
651 |
in this case, we are just inspecting the context chain of the process, |
|
652 |
not running on top of the debugged process, but as a separate |
|
653 |
one. (think of it as an inspector showing more detail, and offering |
|
654 |
some more control operations)" |
|
655 |
||
127 | 656 |
|bpanel dummy| |
73 | 657 |
|
658 |
busy := true. |
|
659 |
bigStep := false. |
|
660 |
inspecting := true. |
|
661 |
inspectedProcess := aProcess. |
|
662 |
nChainShown := 50. |
|
663 |
||
664 |
bpanel := abortButton superView. |
|
665 |
||
666 |
stopButton := Button new. |
|
667 |
stopButton label:(resources at:'stop'); |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
668 |
action:[self doStop]. |
73 | 669 |
bpanel addSubView:stopButton after:continueButton. |
670 |
||
92 | 671 |
dummy := View extent:(10 @ 5) in:bpanel. |
73 | 672 |
dummy borderWidth:0; level:0. |
61 | 673 |
|
73 | 674 |
"/ stepButton destroy. |
675 |
"/ sendButton destroy. |
|
676 |
||
677 |
updateButton := Button |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
678 |
label:(resources at:'update') |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
679 |
action:[self updateContext] |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
680 |
in:bpanel. |
73 | 681 |
monitorToggle := Toggle in:bpanel. |
682 |
monitorToggle label:(resources at:'monitor'). |
|
683 |
monitorToggle pressAction:[self autoUpdateOn]. |
|
684 |
monitorToggle releaseAction:[self autoUpdateOff]. |
|
685 |
||
686 |
"can only look into process - context chain is not active" |
|
687 |
canContinue := true. |
|
688 |
||
689 |
terminateButton enable. |
|
690 |
abortButton enable. |
|
691 |
||
692 |
sendButton disable. |
|
693 |
stepButton disable. |
|
78 | 694 |
nextButton disable. |
73 | 695 |
"/ continueButton disable. |
696 |
"/ returnButton disable. |
|
697 |
"/ restartButton disable. |
|
698 |
||
699 |
aProcess isNil ifTrue:[ |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
700 |
terminateButton disable. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
701 |
abortButton disable. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
702 |
continueButton disable. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
703 |
returnButton disable. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
704 |
restartButton disable. |
73 | 705 |
] ifFalse:[ |
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
706 |
(aProcess suspendedContext isNil |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
707 |
or:[Processor isSystemProcess:aProcess]) ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
708 |
terminateButton disable. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
709 |
]. |
73 | 710 |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
711 |
self setContext:aProcess suspendedContext. |
316
7d529dfe8a99
disable abort & terminate for system processes
Claus Gittinger <cg@exept.de>
parents:
303
diff
changeset
|
712 |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
713 |
catchBlock := [ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
714 |
catchBlock := nil. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
715 |
contextArray := nil. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
716 |
selectedContext := actualContext := nil. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
717 |
(exitAction == #terminate) ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
718 |
aProcess terminate. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
719 |
]. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
720 |
(exitAction == #quickTerminate) ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
721 |
aProcess terminateNoSignal. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
722 |
]. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
723 |
super destroy |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
724 |
]. |
73 | 725 |
]. |
726 |
self open |
|
316
7d529dfe8a99
disable abort & terminate for system processes
Claus Gittinger <cg@exept.de>
parents:
303
diff
changeset
|
727 |
|
317
c6772be0b62f
only disable terminateButton (abort is handled and sometimes useful)
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
728 |
"Modified: 22.12.1995 / 23:30:37 / cg" |
266 | 729 |
! ! |
730 |
||
731 |
!DebugView methodsFor:'help'! |
|
732 |
||
733 |
helpTextFor:aComponent |
|
734 |
|s| |
|
735 |
||
736 |
aComponent == abortButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
737 |
s := 'HELP_ABORT' |
266 | 738 |
]. |
739 |
aComponent == terminateButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
740 |
s := 'HELP_TERMINATE' |
266 | 741 |
]. |
742 |
aComponent == continueButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
743 |
s := 'HELP_CONTINUE' |
266 | 744 |
]. |
745 |
aComponent == stepButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
746 |
s := 'HELP_STEP' |
266 | 747 |
]. |
748 |
aComponent == nextButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
749 |
s := 'HELP_NEXT' |
266 | 750 |
]. |
751 |
aComponent == stepButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
752 |
s := 'HELP_STEP' |
266 | 753 |
]. |
754 |
aComponent == sendButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
755 |
s := 'HELP_SEND' |
266 | 756 |
]. |
757 |
aComponent == returnButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
758 |
s := 'HELP_RETURN' |
266 | 759 |
]. |
760 |
aComponent == restartButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
761 |
s := 'HELP_RESTART' |
266 | 762 |
]. |
763 |
aComponent == contextView ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
764 |
s := 'HELP_WALKBACK' |
266 | 765 |
]. |
766 |
aComponent == codeView ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
767 |
s := 'HELP_CODEVIEW' |
266 | 768 |
]. |
769 |
aComponent == monitorToggle ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
770 |
s := 'HELP_MONITOR' |
266 | 771 |
]. |
772 |
aComponent == updateButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
773 |
s := 'HELP_UPDATE' |
266 | 774 |
]. |
775 |
aComponent == stopButton ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
776 |
s := 'HELP_STOP' |
266 | 777 |
]. |
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
778 |
(aComponent isComponentOf:receiverInspector) ifTrue:[ |
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
779 |
s := 'HELP_REC_INSP' |
266 | 780 |
]. |
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
781 |
(aComponent isComponentOf:contextInspector) ifTrue:[ |
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
782 |
s := 'HELP_CON_INSP' |
266 | 783 |
]. |
784 |
||
785 |
s notNil ifTrue:[ |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
786 |
^ resources string:s |
266 | 787 |
]. |
788 |
^ nil |
|
789 |
||
790 |
"Modified: 29.8.1995 / 23:38:54 / claus" |
|
612
986e371232a2
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
583
diff
changeset
|
791 |
"Modified: 5.6.1996 / 14:25:44 / cg" |
266 | 792 |
! ! |
793 |
||
794 |
!DebugView methodsFor:'initialization'! |
|
795 |
||
796 |
addToCurrentProject |
|
797 |
"ignored here" |
|
798 |
||
799 |
^ self |
|
800 |
! |
|
801 |
||
802 |
initialize |
|
803 |
|v panel hpanel bpanel separator| |
|
804 |
||
805 |
super initialize. |
|
806 |
||
807 |
font := font on:device. |
|
808 |
||
809 |
busy := false. |
|
810 |
exclusive := false. |
|
811 |
inspecting := false. |
|
812 |
exitAction := nil. |
|
813 |
bigStep := false. |
|
814 |
canContinue := false. |
|
815 |
canAbort := false. |
|
816 |
||
817 |
bpanel := HorizontalPanelView |
|
818 |
"/ origin:(0.0 @ 0.0) |
|
819 |
"/ 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
|
820 |
in:self. |
266 | 821 |
bpanel horizontalLayout:#leftSpace. |
822 |
bpanel verticalSpace:ViewSpacing // 2. |
|
823 |
||
824 |
terminateButton := Button |
|
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
825 |
label:(resources at:'terminate') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
826 |
action:[terminateButton turnOffWithoutRedraw. self doTerminate] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
827 |
in:bpanel. |
266 | 828 |
separator := View extent:(10 @ 5) in:bpanel. |
829 |
separator borderWidth:0; level:0. |
|
830 |
||
831 |
abortButton := 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:'abort') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
833 |
action:[abortButton turnOffWithoutRedraw. self doAbort] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
834 |
in:bpanel. |
266 | 835 |
returnButton := Button |
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
836 |
label:(resources at:'return') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
837 |
action:[returnButton turnOff. self doReturn] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
838 |
in:bpanel. |
266 | 839 |
|
840 |
restartButton := Button |
|
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
841 |
label:(resources at:'restart') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
842 |
action:[restartButton turnOff. self doRestart] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
843 |
in:bpanel. |
266 | 844 |
|
845 |
separator := View extent:(10 @ 5) in:bpanel. |
|
846 |
separator borderWidth:0; level:0. |
|
73 | 847 |
|
266 | 848 |
continueButton := Button |
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
849 |
label:(resources at:'continue') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
850 |
action:[continueButton turnOffWithoutRedraw. self doContinue] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
851 |
in:bpanel. |
266 | 852 |
|
853 |
separator := View extent:(10 @ 5) in:bpanel. |
|
854 |
separator borderWidth:0; level:0. |
|
855 |
||
856 |
nextButton := 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:'next') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
858 |
action:[stepButton turnOff. self doNext] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
859 |
in:bpanel. |
266 | 860 |
stepButton := 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:'step') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
862 |
action:[stepButton turnOff. self doStep] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
863 |
in:bpanel. |
266 | 864 |
sendButton := Button |
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
865 |
label:(resources at:'send') |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
866 |
action:[sendButton turnOff. self doSend] |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
867 |
in:bpanel. |
266 | 868 |
|
869 |
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
|
870 |
extent:(1.0 @ (bpanel preferredExtent y)). |
73 | 871 |
|
266 | 872 |
panel := VariableVerticalPanel |
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
873 |
origin:(0.0 @ bpanel height) |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
874 |
corner:(1.0 @ 1.0) |
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
875 |
in:self. |
266 | 876 |
|
877 |
v := ScrollableView for:SelectionInListView in:panel. |
|
878 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25). |
|
879 |
||
880 |
contextView := v scrolledView. |
|
881 |
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
|
882 |
contextView doubleClickAction:[:line | self browse]. |
266 | 883 |
|
884 |
v := ScrollableView for:CodeView in:panel. |
|
885 |
v origin:(0.0 @ 0.25) corner:(1.0 @ 0.75). |
|
886 |
||
887 |
codeView := v scrolledView. |
|
888 |
||
889 |
hpanel := VariableHorizontalPanel in:panel. |
|
890 |
hpanel origin:(0.0 @ 0.75) corner:(1.0 @ 1.0). |
|
891 |
||
892 |
receiverInspector := InspectorView |
|
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
893 |
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
|
894 |
in:hpanel. |
646
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
895 |
receiverInspector label:'receiver'. |
266 | 896 |
|
897 |
contextInspector := ContextInspectorView |
|
494
0d35a48c45bc
double click on a context line opens a browser
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
898 |
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
|
899 |
in:hpanel. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
900 |
contextInspector label:'context'. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
901 |
|
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
902 |
"Modified: 28.6.1996 / 15:31:31 / cg" |
266 | 903 |
! |
904 |
||
905 |
initializeMiddleButtonMenu |
|
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
906 |
|labels selectors m| |
266 | 907 |
|
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
908 |
exclusive ifTrue:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
909 |
labels := resources array:#( |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
910 |
'show more' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
911 |
'-' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
912 |
'remove breakpoint' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
913 |
'remove all trace & breakpoints' |
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 |
'copy walkback text' |
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 |
'quickTerminate' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
918 |
'=' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
919 |
'exit smalltalk (no confirmation)' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
920 |
). |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
921 |
selectors := #( |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
922 |
showMore |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
923 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
924 |
removeBreakpoint |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
925 |
removeAllBreakpoints |
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 |
copyWalkbackText |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
928 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
929 |
quickTerminate |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
930 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
931 |
exit |
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 |
] ifFalse:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
934 |
labels := resources array:#( |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
935 |
'show more' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
936 |
'-' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
937 |
'skip' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
938 |
'-' |
266 | 939 |
" |
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
940 |
'continue' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
941 |
'terminate' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
942 |
'abort' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
943 |
'-' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
944 |
'step' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
945 |
'send' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
946 |
'-' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
947 |
'return' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
948 |
'restart' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
949 |
'-' |
266 | 950 |
" |
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
951 |
'remove breakpoint' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
952 |
'remove all trace & breakpoints' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
953 |
'-' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
954 |
'browse' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
955 |
'browse class' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
956 |
'browse class hierarchy' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
957 |
'browse full class protocol' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
958 |
'implementors' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
959 |
'senders' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
960 |
'-' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
961 |
'inspect context' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
962 |
'copy walkback text' |
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 |
'quickTerminate' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
965 |
'=' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
966 |
'exit smalltalk (no confirmation)' |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
967 |
). |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
968 |
|
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
969 |
selectors := #( |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
970 |
showMore |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
971 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
972 |
skip |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
973 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
974 |
" |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
975 |
doContinue |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
976 |
doTerminate |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
977 |
doAbort |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
978 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
979 |
doStep |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
980 |
doSend |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
981 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
982 |
doReturn |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
983 |
doRestart |
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 |
" |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
986 |
removeBreakpoint |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
987 |
removeAllBreakpoints |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
988 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
989 |
browse |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
990 |
browseClass |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
991 |
browseClassHierarchy |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
992 |
browseFullClassProtocol |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
993 |
implementors |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
994 |
senders |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
995 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
996 |
inspectContext |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
997 |
copyWalkbackText |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
998 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
999 |
quickTerminate |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1000 |
nil |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1001 |
exit |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1002 |
). |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1003 |
]. |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1004 |
|
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1005 |
m := PopUpMenu |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1006 |
labels:labels |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1007 |
selectors:selectors |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1008 |
receiver:self |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1009 |
for:contextView. |
266 | 1010 |
|
1011 |
contextView middleButtonMenu:m. |
|
1012 |
||
1013 |
inspecting ifTrue:[ |
|
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1014 |
m notNil ifTrue:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1015 |
m disableAll:#(doTraceStep removeBreakpoint browse browseClass |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1016 |
browseClassHierarchy browseFullClassProtocol |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1017 |
implementors senders inspectContext skip). |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1018 |
]. |
266 | 1019 |
] |
1020 |
||
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
1021 |
"Modified: 27.2.1996 / 14:41:53 / cg" |
266 | 1022 |
! |
1023 |
||
1024 |
realize |
|
1025 |
super realize. |
|
1026 |
"/ exclusive ifTrue:[ |
|
1027 |
"/ windowGroup := nil |
|
1028 |
"/ ]. |
|
1029 |
||
1030 |
inspecting ifTrue:[ |
|
1031 |
inspectedProcess notNil ifTrue:[ |
|
1032 |
" |
|
1033 |
set prio somewhat higher (by 2, to allow walkBack-update process |
|
1034 |
to run between mine and the debugged processes prio) |
|
1035 |
" |
|
1036 |
Processor activeProcess |
|
1037 |
priority:(inspectedProcess priority + 2 min:16). |
|
73 | 1038 |
] |
266 | 1039 |
] |
1040 |
! |
|
1041 |
||
1042 |
setLabelFor:aMessage in:aProcess |
|
1043 |
|l nm| |
|
1044 |
||
1045 |
l := aMessage , ' ('. |
|
1046 |
nm := aProcess name. |
|
1047 |
nm notNil ifTrue:[ |
|
1048 |
l := l , (nm contractTo:17) , ''. |
|
73 | 1049 |
]. |
266 | 1050 |
l := l , '[' , aProcess id printString , '])'. |
1051 |
self label:l. |
|
0 | 1052 |
! ! |
1053 |
||
1054 |
!DebugView methodsFor:'interrupt handling'! |
|
1055 |
||
1056 |
stepInterrupt |
|
57 | 1057 |
|where here s isWrap method lastWrappedConAddr wrappedMethod inBlock left ignore| |
0 | 1058 |
|
300
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1059 |
"/ |
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1060 |
"/ should no longer happen |
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1061 |
"/ |
333 | 1062 |
stepForReturn == true ifTrue:[ |
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1063 |
'stepForreturn' printCR. |
554 | 1064 |
self enter:thisContext sender. |
1065 |
^ self |
|
300
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1066 |
]. |
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1067 |
|
52 | 1068 |
Processor activeProcess ~~ inspectedProcess ifTrue:[ |
554 | 1069 |
'stray step interrupt' errorPrintNL. |
1070 |
^ self |
|
52 | 1071 |
]. |
1072 |
||
29 | 1073 |
" |
57 | 1074 |
kludge to hide breakpoint wrappers in the context list: |
554 | 1075 |
check if we are in a wrapper methods hidden setup-sequence |
1076 |
if so, ignore the interrupt and continue single sending |
|
29 | 1077 |
" |
1078 |
here := thisContext. "stepInterrupt" |
|
1079 |
here := here sender. "the interrupted context" |
|
1080 |
||
57 | 1081 |
"/ '*******' printNL. |
29 | 1082 |
"/ 'here in ' print. |
1083 |
"/ ((ObjectMemory addressOf:here) printStringRadix:16)print. '' printNL. |
|
10 | 1084 |
|
29 | 1085 |
where := here. |
1086 |
isWrap := false. |
|
57 | 1087 |
left := false. |
1088 |
||
1089 |
inWrap ifTrue:[ |
|
554 | 1090 |
wrappedMethod := nil. |
1091 |
5 timesRepeat:[ |
|
29 | 1092 |
"/ where selector printNL. |
554 | 1093 |
(where notNil and:[where isBlockContext not]) ifTrue:[ |
1094 |
method := where method. |
|
1095 |
(method notNil and:[method isWrapped]) ifTrue:[ |
|
1096 |
" |
|
1097 |
in a wrapper method |
|
1098 |
" |
|
1099 |
wrappedMethod ~~ method ifTrue:[ |
|
1100 |
wrappedMethod := method. |
|
1101 |
lastWrappedConAddr := ObjectMemory addressOf:where. |
|
1102 |
where sender receiver == method originalMethod ifFalse:[ |
|
1103 |
isWrap := true. |
|
1104 |
] |
|
1105 |
] ifFalse:[ |
|
1106 |
(ObjectMemory addressOf:where) == steppedContextAddress ifTrue:[ |
|
57 | 1107 |
"/ 'change stepCon from: ' print. |
1108 |
"/ (steppedContextAddress printStringRadix:16)print. |
|
1109 |
"/ ' to: ' print. |
|
1110 |
"/ (lastWrappedConAddr printStringRadix:16)printNL. |
|
1111 |
||
554 | 1112 |
inWrap := false. |
1113 |
steppedContextAddress := lastWrappedConAddr |
|
1114 |
] |
|
1115 |
] |
|
1116 |
]. |
|
1117 |
where := where sender |
|
1118 |
] |
|
1119 |
]. |
|
29 | 1120 |
]. |
1121 |
||
1122 |
isWrap ifTrue:[ |
|
1123 |
"/ 'ignore wrap' printNL. |
|
57 | 1124 |
"/ ' ' printNL. |
554 | 1125 |
" |
1126 |
ignore, while in wrappers hidden setup |
|
1127 |
" |
|
1128 |
where := nil. here := nil. |
|
1129 |
ObjectMemory flushInlineCaches. |
|
1130 |
StepInterruptPending := 1. |
|
1131 |
InterruptPending := 1. |
|
1132 |
InStepInterrupt := nil. |
|
1133 |
^ nil |
|
29 | 1134 |
]. |
1135 |
||
57 | 1136 |
inBlock := false. |
1137 |
||
29 | 1138 |
" |
300
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1139 |
is this for a send or a step/next ? |
29 | 1140 |
" |
1141 |
bigStep ifTrue:[ |
|
554 | 1142 |
" |
1143 |
a step or next - ignore all contexts below the interesting one |
|
1144 |
" |
|
1145 |
where := here. "the interrupted context" |
|
57 | 1146 |
|
554 | 1147 |
where home notNil ifTrue:[ |
1148 |
"/ |
|
1149 |
"/ in a block called by 'our' context ? |
|
1150 |
"/ |
|
1151 |
(ObjectMemory addressOf:where home) == steppedContextAddress ifTrue:[ |
|
57 | 1152 |
"/ '*block*' printNL. |
554 | 1153 |
inBlock := true |
1154 |
] |
|
1155 |
]. |
|
57 | 1156 |
|
554 | 1157 |
(ObjectMemory addressOf:where) == steppedContextAddress ifFalse:[ |
1158 |
where := where sender. |
|
57 | 1159 |
|
554 | 1160 |
where home notNil ifTrue:[ |
1161 |
(ObjectMemory addressOf:where home) == steppedContextAddress ifTrue:[ |
|
57 | 1162 |
"/ '*block*' printNL. |
554 | 1163 |
inBlock := true. |
1164 |
] |
|
1165 |
]. |
|
57 | 1166 |
|
1167 |
"/ 'looking for ' print. |
|
29 | 1168 |
"/ (steppedContextAddress printStringRadix:16)print. '' printNL. |
57 | 1169 |
|
554 | 1170 |
(ObjectMemory addressOf:where) == steppedContextAddress ifFalse:[ |
1171 |
" |
|
1172 |
check if we are in a context below steppedContext |
|
1173 |
(i.e. if steppedContext can be reached from |
|
1174 |
interrupted context. Not using context-ref but its |
|
1175 |
address to avoid creation of many useless contexts.) |
|
1176 |
" |
|
1177 |
inBlock ifFalse:[ |
|
1178 |
[where notNil] whileTrue:[ |
|
29 | 1179 |
"/ ((ObjectMemory addressOf:where) printStringRadix:16)print. ' ' print. |
1180 |
"/ where selector printNL. |
|
554 | 1181 |
(ObjectMemory addressOf:where) == steppedContextAddress ifTrue:[ |
57 | 1182 |
"/ 'found it - below; ignore' printNL. |
554 | 1183 |
" |
1184 |
found the interesting context somwehere up in the |
|
1185 |
chain. We seem to be still below the interesting one ... |
|
1186 |
" |
|
1187 |
tracing == true ifTrue:[ |
|
1188 |
here printString printCR |
|
1189 |
]. |
|
1190 |
where := nil. here := nil. |
|
1191 |
" |
|
1192 |
yes, a context below |
|
1193 |
- continue and schedule another stepInterrupt. |
|
1194 |
Must flush caches since optimized methods not always |
|
1195 |
look for pending interrupts |
|
1196 |
" |
|
1197 |
ObjectMemory flushInlineCaches. |
|
1198 |
StepInterruptPending := 1. |
|
1199 |
InterruptPending := 1. |
|
1200 |
InStepInterrupt := nil. |
|
1201 |
^ nil |
|
1202 |
]. |
|
1203 |
where := where sender |
|
1204 |
]. |
|
1205 |
s := 'left stepped method'. |
|
1206 |
left := true. |
|
1207 |
]. |
|
1208 |
] ifTrue:[ |
|
29 | 1209 |
"/ 'found it right in sender' printNL. |
554 | 1210 |
s := 'after step' |
1211 |
]. |
|
1212 |
] ifTrue:[ |
|
29 | 1213 |
"/ 'found it right away' printNL. |
554 | 1214 |
s := 'after step' |
1215 |
]. |
|
0 | 1216 |
] ifFalse:[ |
57 | 1217 |
"/ ' send' printNL. |
554 | 1218 |
" |
1219 |
a send |
|
1220 |
" |
|
1221 |
steppedContextAddress := nil. |
|
1222 |
s := 'after send' |
|
0 | 1223 |
]. |
7 | 1224 |
|
57 | 1225 |
inBlock ifTrue:[ |
1226 |
"/ 'inBlock' printNL. |
|
554 | 1227 |
s := 'in block'. |
57 | 1228 |
]. |
1229 |
||
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1230 |
where notNil ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1231 |
'(' print. steppedContextLineno print. ') ' print. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1232 |
where print. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1233 |
'[' print. where lineNumber print. ']' printNL. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1234 |
]. |
57 | 1235 |
|
1236 |
ignore := false. |
|
78 | 1237 |
|
57 | 1238 |
(bigStep |
78 | 1239 |
and:[steppedContextLineno notNil |
57 | 1240 |
and:[where notNil |
78 | 1241 |
and:[where lineNumber == steppedContextLineno]]]) ifTrue:[ |
57 | 1242 |
"/ 'same line - ignored' printNL. |
554 | 1243 |
ignore := true |
57 | 1244 |
]. |
1245 |
||
1246 |
(left not |
|
1247 |
and:[skipLineNr notNil |
|
628
72e330dce4ce
compare for lineNr >= when skipping
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1248 |
and:[where lineNumber < skipLineNr]]) ifTrue:[ |
57 | 1249 |
"/ 'skip (' print. skipLineNr print. ' unreached - ignored' printNL. |
554 | 1250 |
ignore := true |
57 | 1251 |
]. |
1252 |
||
1253 |
ignore ifTrue:[ |
|
1254 |
"/' ' printNL. |
|
554 | 1255 |
where := nil. here := nil. |
1256 |
" |
|
1257 |
yes, a context below |
|
1258 |
- continue and schedule another stepInterrupt. |
|
1259 |
Must flush caches since optimized methods not always |
|
1260 |
look for pending interrupts |
|
1261 |
" |
|
1262 |
ObjectMemory flushInlineCaches. |
|
1263 |
StepInterruptPending := 1. |
|
1264 |
InterruptPending := 1. |
|
1265 |
InStepInterrupt := nil. |
|
1266 |
^ nil |
|
57 | 1267 |
]. |
1268 |
||
1269 |
"/ ' ' printNL. |
|
1270 |
||
29 | 1271 |
name := Processor activeProcess nameOrId. |
7 | 1272 |
self label:(s , ' (process: ' , name , ')'). |
1273 |
||
57 | 1274 |
tracing := false. |
1275 |
bigStep := false. |
|
1276 |
||
0 | 1277 |
"release refs to context" |
1278 |
where := nil. here := nil. |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1279 |
'enter' printCR. |
300
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1280 |
self enter:thisContext sender |
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1281 |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1282 |
"Modified: 1.7.1996 / 11:35:44 / cg" |
0 | 1283 |
! ! |
1284 |
||
266 | 1285 |
!DebugView methodsFor:'menu / button actions'! |
1286 |
||
1287 |
autoUpdateOff |
|
1288 |
"stop the update process" |
|
1289 |
||
1290 |
updateProcess notNil ifTrue:[ |
|
1291 |
monitorToggle lampColor:(Color yellow). |
|
1292 |
updateProcess terminate. |
|
1293 |
updateProcess := nil |
|
1294 |
] |
|
1295 |
! |
|
1296 |
||
1297 |
autoUpdateOn |
|
1298 |
"fork a subprocess which updates the contextList in regular intervals" |
|
1299 |
||
1300 |
updateProcess isNil ifTrue:[ |
|
1301 |
updateProcess := |
|
1302 |
[ |
|
1303 |
[true] whileTrue:[ |
|
1304 |
monitorToggle showLamp ifTrue:[ |
|
1305 |
monitorToggle lampColor:(Color yellow). |
|
1306 |
] ifFalse:[ |
|
1307 |
monitorToggle activeForegroundColor:Color black. |
|
1308 |
]. |
|
1309 |
(Delay forSeconds:0.25) wait. |
|
1310 |
self updateContext. |
|
1311 |
monitorToggle showLamp ifTrue:[ |
|
1312 |
monitorToggle lampColor:(Color red). |
|
1313 |
] ifFalse:[ |
|
1314 |
monitorToggle activeForegroundColor:Color red. |
|
1315 |
]. |
|
1316 |
(Delay forSeconds:0.25) wait. |
|
1317 |
self updateContext. |
|
1318 |
] |
|
1319 |
] forkAt:(Processor activePriority - 1) |
|
1320 |
] |
|
1321 |
||
1322 |
! |
|
1323 |
||
1324 |
browse |
|
651
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1325 |
|mthd w sel cls| |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1326 |
|
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1327 |
mthd := selectedContext method. |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1328 |
mthd notNil ifTrue:[ |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1329 |
w := selectedContext method who. |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1330 |
w notNil ifTrue:[ |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1331 |
cls := w at:1. |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1332 |
sel := w at:2. |
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 |
]. |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1335 |
cls isNil ifTrue:[ |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1336 |
"/ class not found - try receiver |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1337 |
cls := selectedContext receiver class |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1338 |
]. |
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1339 |
|
b8a14e281c24
fixed browse, if there is nothing to browse
Claus Gittinger <cg@exept.de>
parents:
646
diff
changeset
|
1340 |
cls browserClass openInClass:cls selector:sel. |
266 | 1341 |
|
1342 |
"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
|
1343 |
"Modified: 28.6.1996 / 17:33:50 / cg" |
266 | 1344 |
! |
1345 |
||
1346 |
browseClass |
|
527 | 1347 |
|w cls| |
1348 |
||
1349 |
w := selectedContext method who. |
|
1350 |
cls := w at:1. |
|
1351 |
cls browserClass browseClass:cls |
|
1352 |
||
1353 |
"Modified: 3.5.1996 / 12:37:59 / cg" |
|
266 | 1354 |
! |
1355 |
||
1356 |
browseClassHierarchy |
|
527 | 1357 |
|w cls| |
1358 |
||
1359 |
w := selectedContext method who. |
|
1360 |
cls := w at:1. |
|
1361 |
cls browserClass browseClassHierarchy:cls. |
|
1362 |
||
1363 |
"Modified: 3.5.1996 / 12:38:17 / cg" |
|
266 | 1364 |
! |
1365 |
||
1366 |
browseFullClassProtocol |
|
527 | 1367 |
|w cls| |
1368 |
||
1369 |
w := selectedContext method who. |
|
1370 |
cls := w at:1. |
|
1371 |
cls browserClass browseFullClassProtocol:cls. |
|
1372 |
||
1373 |
"Modified: 3.5.1996 / 12:38:30 / cg" |
|
266 | 1374 |
! |
1375 |
||
1376 |
copyWalkbackText |
|
1377 |
"place the contents of the walkback view into the copy-paste buffer. |
|
1378 |
This allows pasting it into some other view for printing ..." |
|
1379 |
||
1380 |
self setTextSelection:(contextArray collect:[:con | con fullPrintString]) asStringCollection |
|
1381 |
||
1382 |
"Modified: 28.8.1995 / 15:31:59 / claus" |
|
1383 |
! |
|
1384 |
||
1385 |
doAbort |
|
1386 |
"abort - send Object>>abortSignal, which is usually cought |
|
1387 |
at save places (for example: in the event loop) and returns back |
|
1388 |
from whatever the process is doing, but does not terminate it." |
|
1389 |
||
1390 |
inspecting ifTrue:[ |
|
477 | 1391 |
inspectedProcess isDead ifTrue:[ |
1392 |
self showTerminated. |
|
1393 |
^ self |
|
1394 |
]. |
|
1395 |
(Object abortSignal isHandledIn:inspectedProcess suspendedContext) ifFalse:[ |
|
1396 |
self showError:'** the process does not handle the abort signal **' |
|
1397 |
] ifTrue:[ |
|
1398 |
self interruptProcessWith:[Object abortSignal raise]. |
|
1399 |
]. |
|
1400 |
^ self |
|
266 | 1401 |
]. |
1402 |
||
1403 |
steppedContextAddress := nil. |
|
1404 |
haveControl := false. |
|
1405 |
exitAction := #abort. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1406 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1407 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1408 |
catchBlock notNil ifTrue:[ |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1409 |
abortButton turnOff. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1410 |
catchBlock value. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1411 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1412 |
"/ not reached |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1413 |
'DEBUGGER: oops, abort failed' errorPrintNL. |
266 | 1414 |
]. |
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1415 |
|
266 | 1416 |
^ self. |
1417 |
||
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1418 |
"Modified: 29.5.1996 / 13:18:39 / cg" |
266 | 1419 |
! |
1420 |
||
1421 |
doContinue |
|
1422 |
"continue from menu" |
|
1423 |
||
1424 |
inspecting ifTrue:[ |
|
477 | 1425 |
self processPerform:#resume. |
1426 |
^ self |
|
266 | 1427 |
]. |
1428 |
canContinue ifTrue:[ |
|
477 | 1429 |
steppedContextAddress := nil. |
1430 |
tracing := false. |
|
1431 |
haveControl := false. |
|
1432 |
exitAction := #continue. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1433 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1434 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1435 |
catchBlock notNil ifTrue:[catchBlock value]. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1436 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1437 |
"/ not reached. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1438 |
'DEBUGGER: oops, continue failed' errorPrintNL. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1439 |
continueButton turnOff. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1440 |
|
266 | 1441 |
] ifFalse:[ |
477 | 1442 |
inspecting ifFalse:[ |
1443 |
'resuming top context' errorPrintNL. |
|
1444 |
self showSelection:1. |
|
1445 |
self doReturn |
|
1446 |
] |
|
266 | 1447 |
] |
477 | 1448 |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1449 |
"Modified: 29.5.1996 / 13:18:29 / cg" |
266 | 1450 |
! |
1451 |
||
1452 |
doNext |
|
1453 |
"skip for next source-code line" |
|
1454 |
||
1455 |
self doStep:nil |
|
1456 |
! |
|
1457 |
||
1458 |
doNoTrace |
|
1459 |
traceView notNil ifTrue:[ |
|
1460 |
traceView topView destroy. |
|
1461 |
traceView := nil. |
|
1462 |
]. |
|
1463 |
tracing := false |
|
1464 |
! |
|
1465 |
||
1466 |
doRestart |
|
1467 |
"restart - the selected context will be restarted" |
|
1468 |
||
1469 |
inspecting ifTrue:[ |
|
477 | 1470 |
selectedContext isNil ifTrue:[ |
1471 |
^ self showError:'** select a context first **' |
|
1472 |
]. |
|
1473 |
self interruptProcessWith:[selectedContext unwindAndRestart]. |
|
1474 |
^ self |
|
266 | 1475 |
]. |
1476 |
||
1477 |
steppedContextAddress := nil. |
|
1478 |
haveControl := false. |
|
1479 |
exitAction := #restart. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1480 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1481 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1482 |
catchBlock notNil ifTrue:[catchBlock value]. |
477 | 1483 |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1484 |
"/ not reached |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1485 |
'DEBUGGER: oops, restart failed' errorPrintNL. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1486 |
restartButton turnOff. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1487 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1488 |
"Modified: 29.5.1996 / 13:18:55 / cg" |
266 | 1489 |
! |
1490 |
||
1491 |
doReturn |
|
1492 |
"return - the selected context will do a ^nil" |
|
1493 |
||
1494 |
inspecting ifTrue:[ |
|
477 | 1495 |
selectedContext isNil ifTrue:[ |
1496 |
^ self showError:'** select a context first **' |
|
1497 |
]. |
|
1498 |
self interruptProcessWith:[selectedContext unwind]. |
|
1499 |
^ self |
|
266 | 1500 |
]. |
1501 |
||
1502 |
steppedContextAddress := nil. |
|
1503 |
haveControl := false. |
|
1504 |
exitAction := #return. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1505 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1506 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1507 |
catchBlock notNil ifTrue:[catchBlock value]. |
477 | 1508 |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1509 |
"/ not reached |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1510 |
'DEBUGGER: oops, return failed' errorPrintNL. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1511 |
returnButton turnOff. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1512 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1513 |
"Modified: 29.5.1996 / 13:19:12 / cg" |
266 | 1514 |
! |
1515 |
||
1516 |
doSend |
|
1517 |
"single send; reenter with next message send" |
|
1518 |
||
1519 |
inspecting ifTrue:[^ self]. |
|
1520 |
||
1521 |
canContinue ifTrue:[ |
|
477 | 1522 |
steppedContextAddress := nil. |
1523 |
haveControl := false. |
|
1524 |
exitAction := #step. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1525 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1526 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1527 |
catchBlock notNil ifTrue:[catchBlock value]. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1528 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1529 |
"/ not reached |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1530 |
'DEBUGGER: oops, send failed' errorPrintNL. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1531 |
sendButton turnOff. |
266 | 1532 |
] |
477 | 1533 |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1534 |
"Modified: 29.5.1996 / 13:19:23 / cg" |
266 | 1535 |
! |
1536 |
||
1537 |
doStep |
|
1538 |
"skip for next send in selected method" |
|
1539 |
||
1540 |
self doStep:-1 |
|
1541 |
! |
|
1542 |
||
1543 |
doStep:lineNr |
|
1544 |
"step until we pass lineNr (if nonNil) or to next line (if nil) |
|
1545 |
or to next send (if -1)" |
|
1546 |
||
1547 |
|con method| |
|
1548 |
||
1549 |
inspecting ifTrue:[^ self]. |
|
1550 |
||
1551 |
canContinue ifTrue:[ |
|
477 | 1552 |
selectedContext notNil ifTrue:[ |
1553 |
con := selectedContext. |
|
1554 |
steppedContextLineno := actualContext lineNumber. |
|
1555 |
] ifFalse:[ |
|
1556 |
con := contextArray at:2. |
|
1557 |
steppedContextLineno := con lineNumber. |
|
1558 |
]. |
|
1559 |
skipLineNr := lineNr. |
|
266 | 1560 |
|
477 | 1561 |
lineNr == -1 ifTrue:[ |
1562 |
steppedContextLineno := skipLineNr := nil. |
|
1563 |
]. |
|
266 | 1564 |
|
477 | 1565 |
steppedContextAddress := ObjectMemory addressOf:con. |
1566 |
" |
|
1567 |
if we step in a wrapped method, |
|
1568 |
prepare to skip the prolog ... |
|
1569 |
" |
|
266 | 1570 |
"/ ' step con:' print. steppedContextAddress printHex. ' ' printNL. |
477 | 1571 |
inWrap := false. |
1572 |
method := con method. |
|
1573 |
(method notNil and:[method isWrapped]) ifTrue:[ |
|
1574 |
inWrap := true |
|
1575 |
]. |
|
266 | 1576 |
|
477 | 1577 |
con := nil. |
1578 |
bigStep := true. |
|
1579 |
haveControl := false. |
|
1580 |
exitAction := #step. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1581 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1582 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1583 |
catchBlock notNil ifTrue:[catchBlock value]. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1584 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1585 |
"/ not reached |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1586 |
'DEBUGGER: oops, step failed' errorPrintNL. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1587 |
stepButton turnOff. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1588 |
nextButton turnOff. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1589 |
sendButton turnOff. |
266 | 1590 |
] |
477 | 1591 |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1592 |
"Modified: 29.5.1996 / 13:19:38 / cg" |
266 | 1593 |
! |
1594 |
||
1595 |
doStop |
|
1596 |
"stop the process (if its running, otherwise this is a no-op)" |
|
1597 |
||
1598 |
inspecting ifTrue:[ |
|
1599 |
self processPerform:#stop. |
|
1600 |
^ self |
|
1601 |
]. |
|
1602 |
! |
|
1603 |
||
1604 |
doTerminate |
|
1605 |
"terminate - the process has a chance for cleanup" |
|
1606 |
||
1607 |
inspecting ifTrue:[ |
|
477 | 1608 |
self processPerform:#terminate. |
1609 |
^ self |
|
266 | 1610 |
]. |
1611 |
||
1612 |
steppedContextAddress := nil. |
|
1613 |
haveControl := false. |
|
1614 |
exitAction := #terminate. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1615 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1616 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1617 |
catchBlock notNil ifTrue:[catchBlock value]. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1618 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1619 |
"/ not reached (normally) |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1620 |
inspecting ifFalse:[ |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1621 |
'DEBUGGER: oops, terminate failed' errorPrintNL. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1622 |
self warn:'terminate failed'. |
266 | 1623 |
]. |
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1624 |
terminateButton turnOff. |
477 | 1625 |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1626 |
"Modified: 29.5.1996 / 13:19:57 / cg" |
266 | 1627 |
! |
1628 |
||
1629 |
doTrace |
|
1630 |
"tracing - not really implemented ..." |
|
1631 |
||
1632 |
self warn:'this function is not yet implemented'. |
|
1633 |
||
1634 |
"/ |v b| |
|
1635 |
"/ |
|
1636 |
"/ traceView isNil ifTrue:[ |
|
1637 |
"/ v := StandardSystemView on:Display. |
|
1638 |
"/ v label:'Debugger-Trace'. |
|
1639 |
"/ v icon:icon. |
|
1640 |
"/ |
|
1641 |
"/ b := Button label:'untrace' in:v. |
|
1642 |
"/ b origin:(0 @ 0) extent:(1.0 @ (b height)). |
|
1643 |
"/ b action:[ |
|
1644 |
"/ StepInterruptPending := nil. |
|
1645 |
"/ tracing := false. |
|
1646 |
"/ v unrealize. |
|
1647 |
"/ traceView := nil |
|
1648 |
"/ ]. |
|
1649 |
"/ traceView := ScrollableView for:TextCollector in:v. |
|
1650 |
"/ traceView origin:(0 @ (b height)) |
|
1651 |
"/ extent:[v width @ (v height - b height)] |
|
1652 |
"/ ]. |
|
1653 |
"/ v realize. |
|
1654 |
"/ |
|
1655 |
"/ tracing := true. |
|
1656 |
! |
|
1657 |
||
1658 |
doTraceStep |
|
1659 |
"tracestep - not implemented yet" |
|
1660 |
||
1661 |
canContinue ifTrue:[ |
|
1662 |
tracing := true. |
|
1663 |
self doStep |
|
1664 |
] |
|
1665 |
! |
|
1666 |
||
1667 |
exit |
|
1668 |
"exit from menu: immediate exit from smalltalk" |
|
1669 |
||
1670 |
OperatingSystem exit |
|
1671 |
! |
|
1672 |
||
1673 |
implementors |
|
1674 |
"open a browser on the implementors" |
|
1675 |
||
1676 |
selectedContext isNil ifTrue:[ |
|
1677 |
^ self showError:'** select a context first **' |
|
1678 |
]. |
|
1679 |
SystemBrowser browseImplementorsOf:selectedContext selector. |
|
1680 |
! |
|
1681 |
||
1682 |
inspectContext |
|
1683 |
"launch an inspector on the currently selected context" |
|
1684 |
||
1685 |
contextView selection notNil ifTrue:[ |
|
1686 |
(contextView selectionValue startsWith:'**') ifFalse:[ |
|
1687 |
(contextArray at:(contextView selection)) inspect. |
|
1688 |
] |
|
1689 |
] |
|
1690 |
! |
|
1691 |
||
1692 |
quickTerminate |
|
1693 |
"quick terminate - the process will get no chance for cleanup actions" |
|
1694 |
||
1695 |
inspecting ifTrue:[ |
|
477 | 1696 |
self processPerform:#terminateNoSignal. |
1697 |
^ self |
|
266 | 1698 |
]. |
1699 |
||
1700 |
steppedContextAddress := nil. |
|
1701 |
haveControl := false. |
|
1702 |
exitAction := #quickTerminate. |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1703 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1704 |
"exit private event-loop" |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1705 |
catchBlock notNil ifTrue:[catchBlock value]. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1706 |
|
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1707 |
"/ not reached (normally) |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1708 |
inspecting ifFalse:[ |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1709 |
'DEBUGGER: oops, terminate failed' errorPrintNL. |
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1710 |
self warn:'terminate failed'. |
266 | 1711 |
]. |
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1712 |
terminateButton turnOff. |
477 | 1713 |
|
581
d1a1ae9d49e4
removed old non-thread support
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1714 |
"Modified: 29.5.1996 / 13:20:14 / cg" |
266 | 1715 |
! |
1716 |
||
1717 |
removeAllBreakpoints |
|
1718 |
"remove all trace & breakpoints - if any" |
|
1719 |
||
1720 |
MessageTracer unwrapAllMethods |
|
1721 |
! |
|
1722 |
||
1723 |
removeBreakpoint |
|
1724 |
"remove breakpoint on the selected contexts method - if any" |
|
1725 |
||
1726 |
|implementorClass method| |
|
1727 |
||
1728 |
selectedContext isNil ifTrue:[ |
|
1729 |
^ self showError:'** select a context first **' |
|
1730 |
]. |
|
1731 |
||
1732 |
implementorClass := selectedContext methodClass. |
|
1733 |
implementorClass notNil ifTrue:[ |
|
1734 |
method := implementorClass compiledMethodAt:selectedContext selector. |
|
1735 |
(method notNil and:[method isWrapped]) ifTrue:[ |
|
1736 |
MessageTracer unwrapMethod:method |
|
1737 |
] |
|
1738 |
]. |
|
1739 |
contextView middleButtonMenu disable:#removeBreakpoint. |
|
1740 |
! |
|
1741 |
||
1742 |
senders |
|
1743 |
"open a browser on the senders" |
|
1744 |
||
1745 |
selectedContext isNil ifTrue:[ |
|
1746 |
^ self showError:'** select a context first **' |
|
1747 |
]. |
|
1748 |
SystemBrowser browseAllCallsOn:selectedContext selector. |
|
1749 |
! |
|
1750 |
||
1751 |
showMore |
|
1752 |
"double number of contexts shown" |
|
1753 |
||
1754 |
|oldSelection con| |
|
1755 |
||
1756 |
contextArray notNil ifTrue:[ |
|
563 | 1757 |
oldSelection := contextView selection. |
1758 |
nChainShown := nChainShown * 2. |
|
1759 |
con := contextArray at:1. |
|
1760 |
contextArray at:1 put:nil. |
|
1761 |
self setContext:con. |
|
1762 |
contextView setSelection:oldSelection. |
|
266 | 1763 |
] |
563 | 1764 |
|
1765 |
"Modified: 25.5.1996 / 12:26:55 / cg" |
|
266 | 1766 |
! |
1767 |
||
1768 |
skip |
|
1769 |
"skip for cursor line in selected method" |
|
1770 |
||
1771 |
self doStep:codeView cursorLine. |
|
1772 |
! ! |
|
1773 |
||
1774 |
!DebugView methodsFor:'private'! |
|
1775 |
||
1776 |
busy |
|
1777 |
^ busy |
|
1778 |
! |
|
1779 |
||
1780 |
cacheMyself |
|
1781 |
"remember myself for next debug session" |
|
1782 |
||
1783 |
"caching the last debugger will make the next debugger appear |
|
1784 |
faster, since no resources have to be allocated in the display. |
|
1785 |
We have to be careful to release all refs to the debuggee, though. |
|
1786 |
Otherwise, the GC will not be able to release it" |
|
1787 |
||
1788 |
windowGroup notNil ifTrue:[ |
|
1789 |
windowGroup setProcess:nil. |
|
1790 |
]. |
|
1791 |
||
1792 |
busy := false. |
|
1793 |
codeView acceptAction:nil. |
|
1794 |
codeView doItAction:nil. |
|
1795 |
codeView contents:nil. |
|
1796 |
receiverInspector release. |
|
1797 |
contextInspector release. |
|
1798 |
inspectedProcess := nil. |
|
1799 |
exitAction := nil. |
|
1800 |
contextArray := nil. |
|
1801 |
selectedContext := actualContext := nil. |
|
1802 |
catchBlock := nil. |
|
1803 |
grabber := nil. |
|
1804 |
self autoUpdateOff. |
|
1805 |
||
1806 |
exclusive ifTrue:[CachedExclusive := self] ifFalse:[CachedDebugger := self]. |
|
1807 |
! |
|
1808 |
||
1809 |
exclusive:aBoolean |
|
1810 |
exclusive := aBoolean |
|
1811 |
! |
|
1812 |
||
1813 |
inspectedProcess |
|
1814 |
^ inspectedProcess |
|
1815 |
! |
|
1816 |
||
303
1d94813f1977
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
1817 |
interestingContextFrom:aContext |
1d94813f1977
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
1818 |
"return an interesting contexts offset, or nil. |
266 | 1819 |
This is the context initially shown in the walkback. |
1820 |
We move up the calling chain, skipping all intermediate Signal |
|
1821 |
and Exception contexts, to present the context in which the error |
|
1822 |
actually occured. |
|
1823 |
Just for your convenience :-)" |
|
1824 |
||
1825 |
|c found offset sel prev ex| |
|
1826 |
||
1827 |
"somewhere, at the bottom, there must be a raise ..." |
|
1828 |
||
1829 |
c := aContext. |
|
1830 |
1 to:5 do:[:i | |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1831 |
c isNil ifTrue:[^ 1 "^ nil"]. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1832 |
sel := c selector. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1833 |
(sel == #raise) ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1834 |
(c receiver isKindOf:Exception) ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1835 |
ex := c receiver. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1836 |
offset := i. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1837 |
found := c |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1838 |
] ifFalse:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1839 |
(c receiver isSignal) ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1840 |
offset := i. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1841 |
found := c |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1842 |
] |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1843 |
] |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1844 |
]. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1845 |
c := c sender. |
266 | 1846 |
]. |
1847 |
||
1848 |
" |
|
1849 |
if this is a noHandler exception, skip forward |
|
1850 |
to the erronous context |
|
1851 |
" |
|
1852 |
ex notNil ifTrue:[ |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1853 |
ex signal == Signal noHandlerSignal ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1854 |
c := ex suspendedContext |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1855 |
] |
266 | 1856 |
]. |
1857 |
||
1858 |
(c := found) isNil ifTrue:[^ 1]. |
|
1859 |
||
1860 |
" |
|
1861 |
got it; move up, skipping all intermediate Signal and |
|
1862 |
Exception contexts |
|
1863 |
" |
|
1864 |
prev := nil. |
|
1865 |
[ |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1866 |
((c receiver isSignal) |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1867 |
or:[(c receiver isKindOf:Exception)]) |
266 | 1868 |
] whileTrue:[ |
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1869 |
prev := c. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1870 |
(c := c sender) isNil ifTrue:[^ offset]. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1871 |
offset := offset + 1. |
266 | 1872 |
]. |
1873 |
||
1874 |
" |
|
1875 |
now, we are one above the raise |
|
1876 |
" |
|
1877 |
||
1878 |
" |
|
269 | 1879 |
if the sender-method of the raise is one of objects error methods ... |
266 | 1880 |
" |
1881 |
( #( halt halt: |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1882 |
error error: |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1883 |
doesNotUnderstand: |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1884 |
subclassResponsibility |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1885 |
primitiveFailed) includes:c selector) |
266 | 1886 |
ifTrue:[ |
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1887 |
c selector == #doesNotUnderstand: ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1888 |
" |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1889 |
one more up, to get to the originating context |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1890 |
" |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1891 |
(c := c sender) isNil ifTrue:[^ offset]. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1892 |
offset := offset + 1. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1893 |
]. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1894 |
(c := c sender) isNil ifTrue:[^ offset]. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1895 |
offset := offset + 1. |
266 | 1896 |
] ifFalse:[ |
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1897 |
" |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1898 |
ok, got the raise - if its a BreakPoint, look for the sender |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1899 |
" |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1900 |
(MessageTracer notNil and:[prev receiver == MessageTracer breakpointSignal]) ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1901 |
offset := offset + 1 |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1902 |
]. |
266 | 1903 |
]. |
1904 |
||
1905 |
^ offset |
|
269 | 1906 |
|
1907 |
"Created: 10.12.1995 / 13:55:21 / cg" |
|
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1908 |
"Modified: 1.7.1996 / 11:01:44 / cg" |
266 | 1909 |
! |
1910 |
||
1911 |
interruptProcessWith:aBlock |
|
1912 |
"let inspected process do something, then update the context list" |
|
1913 |
||
1914 |
inspectedProcess isDead ifTrue:[ |
|
1915 |
self showTerminated. |
|
1916 |
^ self |
|
1917 |
]. |
|
1918 |
inspectedProcess interruptWith:aBlock. |
|
1919 |
" |
|
1920 |
give the process a chance to run, then update |
|
1921 |
" |
|
1922 |
(Delay forSeconds:0.2) wait. |
|
1923 |
self setContext:(inspectedProcess suspendedContext). |
|
1924 |
! |
|
1925 |
||
1926 |
processPerform:aMessage |
|
1927 |
"do something, then update the context list" |
|
1928 |
||
1929 |
inspectedProcess isDead ifTrue:[ |
|
1930 |
self showTerminated. |
|
1931 |
^ self |
|
1932 |
]. |
|
1933 |
inspectedProcess perform:aMessage. |
|
1934 |
" |
|
1935 |
give the process a chance to run, then update |
|
1936 |
" |
|
1937 |
(Delay forSeconds:0.2) wait. |
|
1938 |
self setContext:(inspectedProcess suspendedContext). |
|
1939 |
! |
|
1940 |
||
1941 |
setContext:aContext |
|
1942 |
"show calling chain from aContext in the walk-back listview" |
|
1943 |
||
641 | 1944 |
^ 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
|
1945 |
|
641 | 1946 |
"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
|
1947 |
! |
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1948 |
|
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1949 |
setContext:aContext releaseInspectors:releaseInspectors |
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
1950 |
"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
|
1951 |
|
266 | 1952 |
|con text method caller caller2 m count| |
1953 |
||
1954 |
(contextArray notNil and:[aContext == (contextArray at:1)]) ifTrue:[ |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1955 |
"no change" |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1956 |
^ false |
266 | 1957 |
]. |
1958 |
||
1959 |
m := contextView middleButtonMenu. |
|
1960 |
m notNil ifTrue:[ |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1961 |
m disable:#showMore. |
266 | 1962 |
]. |
1963 |
||
1964 |
aContext isNil ifTrue:[ |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1965 |
text := Array with:'** no context **'. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1966 |
contextArray := nil. |
266 | 1967 |
] ifFalse:[ |
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1968 |
text := OrderedCollection new:nChainShown. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1969 |
contextArray := OrderedCollection new:nChainShown. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1970 |
con := aContext. |
266 | 1971 |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1972 |
" |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1973 |
get them all |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1974 |
" |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1975 |
count := 0. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1976 |
[con notNil and:[count <= nChainShown]] whileTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1977 |
contextArray add:con. count := count + 1. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1978 |
(MoreDebuggingDetail == true) ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1979 |
text add:(((ObjectMemory addressOf:con) printStringRadix:16) , ' ' , con printString). |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1980 |
] ifFalse:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1981 |
text add:con printString. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1982 |
]. |
266 | 1983 |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1984 |
method := con method. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1985 |
(method notNil and:[method isWrapped]) ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1986 |
" |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1987 |
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
|
1988 |
" |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1989 |
caller := con sender. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1990 |
(caller notNil and:[caller receiver == method originalMethod]) ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1991 |
caller2 := caller sender. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1992 |
(caller2 notNil and:[caller2 method == method]) ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1993 |
con := caller2 |
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 |
]. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1996 |
caller := caller2 := nil |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1997 |
]. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1998 |
con := con sender |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1999 |
]. |
266 | 2000 |
|
328
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 |
did we reach the end ? |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2003 |
" |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2004 |
(con isNil or:[con sender isNil]) ifTrue:[ |
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 |
the very last one is the startup context |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2007 |
(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
|
2008 |
" |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2009 |
contextArray last selector isNil ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2010 |
contextArray removeLast. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2011 |
text removeLast |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2012 |
] |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2013 |
] ifFalse:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2014 |
m notNil ifTrue:[ |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2015 |
m enable:#showMore. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2016 |
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
|
2017 |
]. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2018 |
]. |
266 | 2019 |
]. |
2020 |
||
2021 |
contextView setList:text. |
|
300
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
2022 |
releaseInspectors ifTrue:[ |
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2023 |
receiverInspector release. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2024 |
contextInspector release. |
300
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
2025 |
]. |
266 | 2026 |
|
2027 |
m notNil ifTrue:[ |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2028 |
m disable:#removeBreakpoint. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2029 |
m disable:#implementors. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2030 |
m disable:#senders. |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2031 |
m disable:#browseClass. |
266 | 2032 |
]. |
2033 |
^ true |
|
300
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
2034 |
|
027ffcadd12d
keep context in lower-right inspector when single stepping
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
2035 |
"Created: 14.12.1995 / 19:10:31 / cg" |
266 | 2036 |
! |
2037 |
||
2038 |
showError:message |
|
2039 |
codeView contents:(resources string:message). |
|
2040 |
shown ifTrue:[ |
|
2041 |
exclusive ifTrue:[ |
|
2042 |
"/ consider this a kludge: |
|
2043 |
"/ if exclusive, cannot use flash, since it suspends |
|
2044 |
"/ (but we cannot suspend here ...) |
|
2045 |
codeView redrawInverted. device flush. |
|
2046 |
OperatingSystem millisecondDelay:200. |
|
2047 |
codeView redraw |
|
2048 |
] ifFalse:[ |
|
2049 |
codeView flash |
|
2050 |
] |
|
2051 |
] |
|
2052 |
||
2053 |
"Modified: 24.11.1995 / 22:07:30 / cg" |
|
2054 |
! |
|
2055 |
||
2056 |
showTerminated |
|
2057 |
self showError:'** the process has terminated **' |
|
2058 |
! |
|
2059 |
||
2060 |
stepping |
|
2061 |
^ stepping |
|
2062 |
! |
|
2063 |
||
2064 |
unstep |
|
2065 |
stepping := false. |
|
2066 |
bigStep := false. |
|
2067 |
steppedContextAddress := nil. |
|
2068 |
exitAction := nil |
|
2069 |
! |
|
2070 |
||
2071 |
updateContext |
|
2072 |
|oldContext idx| |
|
2073 |
||
2074 |
inspectedProcess state == #dead ifTrue:[ |
|
642
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2075 |
self showTerminated. |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2076 |
^ self |
266 | 2077 |
]. |
2078 |
||
2079 |
oldContext := selectedContext. |
|
642
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2080 |
[ |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2081 |
(self setContext:(inspectedProcess suspendedContext)) ifTrue:[ |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2082 |
oldContext notNil ifTrue:[ |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2083 |
contextArray notNil ifTrue:[ |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2084 |
idx := contextArray identityIndexOf:oldContext. |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2085 |
idx ~~ 0 ifTrue:[ |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2086 |
self showSelection:idx |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2087 |
] ifFalse:[ |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2088 |
codeView contents:('** context returned **') |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2089 |
] |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2090 |
] |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2091 |
] |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2092 |
]. |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2093 |
] valueUninterruptably. |
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2094 |
|
77e7e39f503a
update context uninterruptably
Claus Gittinger <cg@exept.de>
parents:
641
diff
changeset
|
2095 |
"Modified: 27.6.1996 / 17:19:53 / cg" |
266 | 2096 |
! ! |
2097 |
||
2098 |
!DebugView methodsFor:'private control loop'! |
|
2099 |
||
2100 |
controlLoop |
|
2101 |
"this is a kludge: |
|
2102 |
start a dispatchloop which exits when |
|
2103 |
either continue, return or step is pressed |
|
2104 |
" |
|
2105 |
||
2106 |
haveControl := true. |
|
2107 |
[haveControl] whileTrue:[ |
|
2108 |
self controlLoopCatchingErrors |
|
2109 |
]. |
|
2110 |
catchBlock := nil. |
|
2111 |
! |
|
2112 |
||
2113 |
controlLoopCatchingErrors |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2114 |
"this is the debuggers own private event handling loop; |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2115 |
errors are cought, to prevent recursive debugger-invocations." |
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2116 |
|
266 | 2117 |
"setup a self removing catch-block" |
2118 |
catchBlock := [catchBlock := nil. ^ nil]. |
|
2119 |
||
2120 |
(exclusive or:[windowGroup isNil]) ifTrue:[ |
|
448 | 2121 |
"if we do not have multiple processes or its a system process |
2122 |
we start another dispatch loop, which exits when |
|
2123 |
either continue, return or step is pressed |
|
2124 |
or (via the catchBlock) if an error occurs. |
|
2125 |
Since our display is an extra exclusive one, |
|
2126 |
all processing for normal views stops here ... |
|
2127 |
" |
|
266 | 2128 |
|
448 | 2129 |
WindowGroup setActiveGroup:windowGroup. |
2130 |
SignalSet anySignal handle:[:ex | |
|
2131 |
|signal| |
|
334 | 2132 |
|
448 | 2133 |
signal := ex signal. |
2134 |
self showError:'*** Error in modal debugger: |
|
266 | 2135 |
|
334 | 2136 |
>>>> Signal: ' , signal printString , ' |
266 | 2137 |
>>>> In: ' , ex suspendedContext printString , ' |
2138 |
>>>> Message: ' , ex errorString , ' |
|
2139 |
||
2140 |
cought & ignored.'. |
|
448 | 2141 |
ex return. |
2142 |
] do:[ |
|
2143 |
Object userNotificationSignal handle:[:ex | |
|
2144 |
(ex signal == ActivityNotificationSignal) ifTrue:[ |
|
2145 |
ex proceed |
|
2146 |
]. |
|
2147 |
self showError:ex errorString |
|
2148 |
] do:[ |
|
530 | 2149 |
device dispatchModalWhile:[Processor activeProcess state:#debug. |
2150 |
haveControl]. |
|
448 | 2151 |
] |
2152 |
]. |
|
2153 |
WindowGroup setActiveGroup:nil. |
|
266 | 2154 |
] ifFalse:[ |
448 | 2155 |
"we do have multiple processes - |
2156 |
simply enter the DebugViews-Windowgroup event loop. |
|
2157 |
effectively suspending event processing for the currently |
|
2158 |
active group. |
|
2159 |
" |
|
2160 |
SignalSet anySignal handle:[:ex | |
|
2161 |
|answer signal| |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2162 |
|
448 | 2163 |
signal := ex signal. |
266 | 2164 |
|
448 | 2165 |
"/ |
2166 |
"/ ignore recursive breakpoints |
|
2167 |
"/ |
|
2168 |
signal == MessageTracer breakpointSignal ifTrue:[ |
|
2169 |
'breakpoint in debugger ignored' errorPrintNL. |
|
2170 |
ex proceed |
|
2171 |
]. |
|
2172 |
(signal == ActivityNotificationSignal) ifTrue:[ |
|
2173 |
ex proceed |
|
2174 |
]. |
|
2175 |
signal == Exception recursiveExceptionSignal ifTrue:[ |
|
2176 |
ex parameter signal == MessageTracer breakpointSignal ifTrue:[ |
|
2177 |
'recursive breakpoint in debugger ignored' errorPrintNL. |
|
2178 |
ex proceed. |
|
2179 |
]. |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2180 |
|
448 | 2181 |
self showError:'*** Recursive error in debugger: |
266 | 2182 |
|
2183 |
>>>> Signal: ' , ex signal printString , ' |
|
448 | 2184 |
>>>> ' , ex parameter signal printString , ' |
266 | 2185 |
>>>> In: ' , ex suspendedContext printString , ' |
2186 |
>>>> Message: ' , ex errorString , ' |
|
2187 |
||
2188 |
cought & ignored.'. |
|
448 | 2189 |
ex return |
2190 |
]. |
|
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2191 |
|
448 | 2192 |
self topView raiseDeiconified. |
328
bdfe5bbd376d
ignore recursive BreakPoint invocations
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2193 |
|
448 | 2194 |
answer := Dialog |
2195 |
choose:('error in debugger: ' , ex errorString , '\\debug again ?') withCRs |
|
2196 |
labels:#('debug' 'proceed' 'cancel' ) |
|
2197 |
values:#(#debug #proceed #cancel) |
|
2198 |
default:#cancel. |
|
2199 |
answer == #debug ifTrue:[ |
|
2200 |
Debugger enterUnconditional:(ex suspendedContext) withMessage:'error in debugger: ' , ex errorString. |
|
2201 |
ex proceed. |
|
2202 |
]. |
|
2203 |
answer == #proceed ifTrue:[ |
|
2204 |
ex proceed. |
|
2205 |
]. |
|
2206 |
ex return. |
|
2207 |
] do:[ |
|
530 | 2208 |
windowGroup eventLoopWhile:[Processor activeProcess state:#debug. |
2209 |
true] onLeave:[] |
|
448 | 2210 |
]. |
266 | 2211 |
]. |
2212 |
catchBlock := nil. |
|
2213 |
||
2214 |
"Created: 24.11.1995 / 20:33:45 / cg" |
|
530 | 2215 |
"Modified: 7.5.1996 / 10:04:41 / cg" |
266 | 2216 |
! ! |
2217 |
||
0 | 2218 |
!DebugView methodsFor:'user interaction'! |
2219 |
||
266 | 2220 |
codeAccept:someCode |
2221 |
"user wants some code to be recompiled - must unwind stack since everything above |
|
2222 |
and including selected method cannot be continued." |
|
2223 |
||
2224 |
" |
|
2225 |
actually, this is not true, since the active methods will still be |
|
2226 |
executed correctly - however, the code shown in the debugger is no |
|
2227 |
longer in sync (showing the new code) with the executed code. |
|
2228 |
Therefore, we hide those contexts to avoid confusion .... |
|
2229 |
If you dont like this behavior, remove the 'inspecting ifFalse:' check below" |
|
2230 |
||
2231 |
"walk up context chain and find highest context which is either the selected context, |
|
2232 |
or - if its a block-context - whose home is the selected context" |
|
2233 |
||
2234 |
|con top sel implementorClass method newMethod| |
|
2235 |
||
2236 |
codeView cursor:Cursor execute. |
|
2237 |
||
2238 |
" |
|
2239 |
find the method-home context for this one |
|
2240 |
" |
|
2241 |
con := selectedContext. |
|
2242 |
top := con. |
|
2243 |
[con notNil] whileTrue:[ |
|
2244 |
(con methodHome == selectedContext) ifTrue:[ |
|
2245 |
top := con |
|
2246 |
]. |
|
2247 |
con := con sender |
|
2248 |
]. |
|
2249 |
" |
|
2250 |
use class&selector to find the method for the compilation |
|
2251 |
and compile. |
|
2252 |
" |
|
2253 |
sel := selectedContext selector. |
|
2254 |
implementorClass := selectedContext methodClass. |
|
2255 |
method := implementorClass compiledMethodAt:sel. |
|
2256 |
newMethod := implementorClass compilerClass |
|
2257 |
compile:someCode |
|
2258 |
forClass:implementorClass |
|
2259 |
inCategory:(method category) |
|
2260 |
notifying:codeView. |
|
2261 |
||
2262 |
inspecting ifFalse:[ |
|
2263 |
" |
|
2264 |
if it worked, remove everything up to and including top |
|
2265 |
from context chain |
|
2266 |
" |
|
2267 |
(newMethod notNil and:[newMethod ~~ #Error]) ifTrue:[ |
|
2268 |
self setContext:(top sender). |
|
2269 |
||
2270 |
" |
|
2271 |
continue/step is no longer possible |
|
2272 |
" |
|
2273 |
canContinue := false. |
|
2274 |
self showSelection:1. |
|
2275 |
exitAction := #return |
|
2276 |
]. |
|
2277 |
]. |
|
2278 |
codeView cursor:Cursor normal |
|
2279 |
! |
|
2280 |
||
2281 |
destroy |
|
2282 |
"closing the debugger implies an abort or continue" |
|
2283 |
||
2284 |
contextView middleButtonMenu hide. |
|
2285 |
||
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2286 |
inspecting ifFalse:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2287 |
CachedExclusive == self ifTrue:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2288 |
CachedExclusive := nil. |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2289 |
]. |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2290 |
CachedDebugger == self ifTrue:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2291 |
CachedDebugger := nil |
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 |
|
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2294 |
inspecting ifFalse:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2295 |
canAbort ifTrue:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2296 |
self doAbort. |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2297 |
] ifFalse:[ |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2298 |
self doContinue |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2299 |
] |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2300 |
]. |
554 | 2301 |
'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
|
2302 |
DebugView newDebugger. |
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2303 |
]. |
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2304 |
|
266 | 2305 |
" |
2306 |
we manually release all private data, since the Debugger |
|
2307 |
is cached for reuse - thus the memory would not be collectable |
|
2308 |
otherwise. |
|
2309 |
" |
|
2310 |
codeView acceptAction:nil. |
|
2311 |
codeView doItAction:nil. |
|
2312 |
codeView contents:nil. |
|
2313 |
catchBlock := nil. |
|
2314 |
||
2315 |
receiverInspector release. |
|
2316 |
contextInspector release. |
|
2317 |
inspectedProcess := nil. |
|
2318 |
exitAction := nil. |
|
2319 |
contextArray := nil. |
|
2320 |
selectedContext := actualContext := nil. |
|
2321 |
grabber := nil. |
|
2322 |
self autoUpdateOff. |
|
2323 |
||
407
cf196c7cd2e6
oops - simply closing debugger lead to corrupted leftovers
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
2324 |
super destroy "/ 1.12.94 |
266 | 2325 |
|
554 | 2326 |
"Modified: 20.5.1996 / 10:31:55 / cg" |
266 | 2327 |
! |
2328 |
||
0 | 2329 |
showSelection:lineNr |
301
cd15cb77e4b6
show wait cursor while accessing sources (may take long with CVS)
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
2330 |
"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
|
2331 |
Also sent to autoselect an interesting context on entry." |
0 | 2332 |
|
56 | 2333 |
|con homeContext sel method code canAccept |
105 | 2334 |
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
|
2335 |
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
|
2336 |
mthd cls w| |
0 | 2337 |
|
2338 |
contextArray notNil ifTrue:[ |
|
563 | 2339 |
lineNr <= contextArray size ifTrue:[ |
2340 |
con := contextArray at:lineNr. |
|
2341 |
]. |
|
2342 |
" |
|
2343 |
clicking on the '** ...'-line shows more ... |
|
2344 |
" |
|
2345 |
con isNil ifTrue:[ |
|
2346 |
line := contextView list at:lineNr. |
|
2347 |
(line startsWith:'**') ifTrue:[ |
|
2348 |
self showMore. |
|
2349 |
contextView setSelection:lineNr. |
|
2350 |
con := contextArray at:lineNr |
|
2351 |
]. |
|
2352 |
con isNil ifTrue:[^ self]. |
|
2353 |
]. |
|
105 | 2354 |
|
563 | 2355 |
self withWaitCursorDo:[ |
2356 |
" |
|
2357 |
give it to the (lower right) inspector |
|
2358 |
" |
|
2359 |
contextInspector inspect:con. |
|
105 | 2360 |
|
646
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2361 |
con hasStackToShow ifTrue:[ |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2362 |
stackInspector isNil ifTrue:[ |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2363 |
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
|
2364 |
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
|
2365 |
|
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2366 |
stackInspector := InspectorView |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2367 |
origin:(0.6 @ 0.0) corner:(1.0 @ 1.0) |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2368 |
in:contextInspector superView. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2369 |
stackInspector realize. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2370 |
stackInspector label:'stack'. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2371 |
stackInspector hideReceiver:true. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2372 |
]. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2373 |
stackInspector inspect:(con stackFrame asArray). |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2374 |
stackInspector showLast. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2375 |
] ifFalse:[ |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2376 |
stackInspector notNil ifTrue:[ |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2377 |
stackInspector destroy. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2378 |
stackInspector := nil. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2379 |
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
|
2380 |
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
|
2381 |
] |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2382 |
]. |
04dafb2560bf
added labels 'receiver' & 'context';
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2383 |
|
563 | 2384 |
" |
2385 |
get the home context |
|
2386 |
" |
|
2387 |
con isBlockContext ifTrue:[ |
|
2388 |
homeContext := con methodHome |
|
2389 |
] ifFalse:[ |
|
2390 |
homeContext := con |
|
2391 |
]. |
|
2392 |
con canReturn ifTrue:[ |
|
2393 |
returnButton enable. restartButton enable. |
|
2394 |
] ifFalse:[ |
|
2395 |
returnButton disable. restartButton disable. |
|
2396 |
]. |
|
105 | 2397 |
|
563 | 2398 |
lineNrInMethod := con lineNumber. |
105 | 2399 |
|
563 | 2400 |
canAccept := false. |
105 | 2401 |
|
563 | 2402 |
homeContext isNil ifTrue:[ |
2403 |
" |
|
2404 |
mhmh - an optimized block |
|
2405 |
should get the block here, and get the method from |
|
2406 |
that one ... |
|
2407 |
But in 2.10.x, there is no easy way to get to the block |
|
2408 |
since that one is not in the context. |
|
2409 |
Starting with 2.11, the new block calling scheme will fix this. |
|
2410 |
" |
|
105 | 2411 |
|
563 | 2412 |
"temporary kludge - peek into the sender context. |
2413 |
If its a do-like method and there is a single block variable |
|
2414 |
in the args or temporaries, that must be the one. |
|
2415 |
This helps in some cases. |
|
2416 |
" |
|
2417 |
(sender := con sender) notNil ifTrue:[ |
|
2418 |
tryVars := false. |
|
2419 |
(selSender := sender selector) notNil ifTrue:[ |
|
2420 |
(selSender endsWith:'do:') ifTrue:[ |
|
2421 |
tryVars := true. |
|
2422 |
] ifFalse:[ |
|
2423 |
(selSender endsWith:'Do:') ifTrue:[ |
|
2424 |
tryVars := true. |
|
2425 |
] |
|
2426 |
] |
|
2427 |
]. |
|
2428 |
tryVars ifTrue:[ |
|
2429 |
possibleBlocks := sender argsAndVars select:[:v | v isBlock]. |
|
2430 |
possibleBlocks := possibleBlocks select:[:b | b home isNil]. |
|
2431 |
possibleBlocks size == 1 ifTrue:[ |
|
2432 |
method := possibleBlocks first method. |
|
2433 |
]. |
|
2434 |
] |
|
2435 |
]. |
|
105 | 2436 |
|
563 | 2437 |
] ifFalse:[ |
2438 |
"fetch rec here - so we wont need context in doItAction" |
|
2439 |
rec := homeContext receiver. |
|
105 | 2440 |
|
563 | 2441 |
sel := homeContext selector. |
2442 |
sel notNil ifTrue:[ |
|
2443 |
canAccept := true. |
|
56 | 2444 |
|
563 | 2445 |
implementorClass := homeContext methodClass. |
2446 |
implementorClass isNil ifTrue:[ |
|
2447 |
" |
|
2448 |
special: look if this context was created by |
|
2449 |
valueWithReceiver kind of method invocation; |
|
2450 |
if so, grab the method from the sender and show it |
|
2451 |
" |
|
2452 |
((sender := con sender) notNil |
|
2453 |
and:[(sender selector startsWith:'valueWithReceiver:') |
|
2454 |
and:[sender receiver isMethod]]) ifTrue:[ |
|
2455 |
method := sender receiver. |
|
655
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2456 |
self sensor shiftDown ifTrue:[ |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2457 |
code := method decompiledSource |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2458 |
] ifFalse:[ |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2459 |
code := method source. |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2460 |
]. |
563 | 2461 |
canAccept := false. |
2462 |
] ifFalse:[ |
|
2463 |
(method := con method) notNil ifTrue:[ |
|
655
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2464 |
self sensor shiftDown ifTrue:[ |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2465 |
code := method decompiledSource |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2466 |
] ifFalse:[ |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2467 |
code := method source. |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2468 |
]. |
563 | 2469 |
canAccept := false. |
2470 |
] |
|
2471 |
] |
|
2472 |
] ifFalse:[ |
|
2473 |
method := implementorClass compiledMethodAt:sel. |
|
2474 |
]. |
|
2475 |
] |
|
2476 |
]. |
|
105 | 2477 |
|
563 | 2478 |
code isNil ifTrue:[ |
2479 |
errMsg := nil. |
|
2480 |
method notNil ifTrue:[ |
|
655
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2481 |
self sensor shiftDown ifTrue:[ |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2482 |
code := method decompiledSource |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2483 |
] ifFalse:[ |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2484 |
code := method source. |
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2485 |
]. |
563 | 2486 |
code isNil ifTrue:[ |
2487 |
method sourceFilename notNil ifTrue:[ |
|
2488 |
codeView contents:(resources |
|
2489 |
string:'** no sourcefile: %1 **' |
|
2490 |
with:method sourceFilename). |
|
2491 |
codeView flash |
|
2492 |
] ifFalse:[ |
|
2493 |
errMsg := '** no source **' |
|
2494 |
] |
|
2495 |
] |
|
2496 |
] ifFalse:[ |
|
2497 |
homeContext isNil ifTrue:[ |
|
2498 |
errMsg := '** sorry; cannot show code of all optimized blocks (yet) **'. |
|
2499 |
] ifFalse:[ |
|
2500 |
errMsg := '** no method - no source **' |
|
2501 |
] |
|
2502 |
]. |
|
2503 |
errMsg notNil ifTrue:[ |
|
2504 |
self showError:errMsg |
|
2505 |
] |
|
2506 |
]. |
|
105 | 2507 |
|
563 | 2508 |
code isNil ifTrue:[ |
2509 |
canAccept := false. |
|
2510 |
] ifFalse:[ |
|
2511 |
codeView contents:code. |
|
2512 |
(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
|
2513 |
"/ 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
|
2514 |
"/ 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
|
2515 |
"/ ]. |
cd15cb77e4b6
show wait cursor while accessing sources (may take long with CVS)
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
2516 |
"/ codeView selectLine:lineNrInMethod. |
cd15cb77e4b6
show wait cursor while accessing sources (may take long with CVS)
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
2517 |
"/ codeView makeSelectionVisible |
132 | 2518 |
|
563 | 2519 |
lineNrInMethod <= codeView list size ifTrue:[ |
2520 |
(lineNrInMethod == 255 |
|
2521 |
and:[method notNil |
|
2522 |
and:[method code isNil]]) ifTrue:[ |
|
2523 |
"/ means: do not really know in interpreted methods |
|
2524 |
codeView selectFromLine:255 col:1 toLine:codeView list size + 1 col:0. |
|
2525 |
] ifFalse:[ |
|
2526 |
codeView selectLine:lineNrInMethod. |
|
2527 |
]. |
|
2528 |
codeView makeSelectionVisible |
|
2529 |
] |
|
2530 |
]. |
|
2531 |
]. |
|
105 | 2532 |
|
563 | 2533 |
canAccept ifTrue:[ |
2534 |
codeView acceptAction:[:code | self codeAccept:code asString] |
|
2535 |
] ifFalse:[ |
|
2536 |
codeView acceptAction:nil. |
|
2537 |
]. |
|
105 | 2538 |
|
563 | 2539 |
receiverInspector inspect:rec. |
105 | 2540 |
|
563 | 2541 |
" |
2542 |
the one below is wrong: currently, the |
|
2543 |
evaluator cannot handle passed contexts. |
|
2544 |
Once it does, pass con as in:-arg |
|
2545 |
" |
|
2546 |
codeView doItAction:[:theCode | |
|
2547 |
rec class evaluatorClass |
|
2548 |
evaluate:theCode |
|
2549 |
in:nil "/ *** con |
|
2550 |
receiver:rec |
|
2551 |
notifying:codeView |
|
2552 |
logged:true |
|
2553 |
ifFail:nil |
|
2554 |
]. |
|
45 | 2555 |
|
563 | 2556 |
selectedContext := homeContext. |
2557 |
actualContext := con |
|
2558 |
]. |
|
0 | 2559 |
]. |
2560 |
||
654
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2561 |
con isContext ifFalse:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2562 |
sendButton disable. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2563 |
] ifTrue:[ |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2564 |
sendButton enable. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2565 |
]. |
dac2634ce5ec
better support for alien context single stepping
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2566 |
|
105 | 2567 |
"clear out locals to prevent keeping around unneeded contexts |
2568 |
(due to the block held in codeView). |
|
2569 |
(not really needed, since stuff gets collected away sooner or later ... |
|
2570 |
... but this makes it a bit sooner) |
|
2571 |
" |
|
0 | 2572 |
con := nil. |
29 | 2573 |
homeContext := nil. |
2574 |
||
105 | 2575 |
" |
2576 |
enable/disable some menu items |
|
2577 |
" |
|
45 | 2578 |
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
|
2579 |
(m notNil and:[selectedContext notNil]) ifTrue:[ |
563 | 2580 |
m enableAll:#(implementors senders inspectContext skip skipForReturn). |
29 | 2581 |
|
563 | 2582 |
(method notNil and:[method isWrapped]) ifTrue:[ |
2583 |
m enable:#removeBreakpoint. |
|
2584 |
] ifFalse:[ |
|
2585 |
m disable:#removeBreakpoint. |
|
2586 |
]. |
|
193
8d0b4658249c
added browse-menu function; disable inappropriate menu items; fixed walkback-copy
Claus Gittinger <cg@exept.de>
parents:
189
diff
changeset
|
2587 |
|
563 | 2588 |
mthd := selectedContext method. |
2589 |
mthd notNil ifTrue:[ |
|
2590 |
w := mthd who. |
|
2591 |
]. |
|
2592 |
m enable:#browseClass. |
|
2593 |
w notNil ifTrue:[ |
|
2594 |
cls := w at:1 |
|
2595 |
]. |
|
2596 |
cls notNil ifTrue:[ |
|
2597 |
m enableAll:#(browse browseClass browseClassHierarchy browseFullClassProtocol). |
|
2598 |
] ifFalse:[ |
|
2599 |
m disableAll:#(browse browseClass browseClassHierarchy browseFullClassProtocol). |
|
2600 |
]. |
|
29 | 2601 |
] |
193
8d0b4658249c
added browse-menu function; disable inappropriate menu items; fixed walkback-copy
Claus Gittinger <cg@exept.de>
parents:
189
diff
changeset
|
2602 |
|
655
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2603 |
"Modified: 3.7.1996 / 10:09:00 / cg" |
73 | 2604 |
! ! |
2605 |
||
641 | 2606 |
!DebugView class methodsFor:'documentation'! |
78 | 2607 |
|
266 | 2608 |
version |
655
c9a1de4e627a
secret feature: if shift is pressed while selecting a context,
Claus Gittinger <cg@exept.de>
parents:
654
diff
changeset
|
2609 |
^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.95 1996-07-03 09:04:45 cg Exp $' |
0 | 2610 |
! ! |