286 |
286 |
287 defaultIcon |
287 defaultIcon |
288 ^ Image fromFile:'bitmaps/Debugger.xbm' resolution:100 |
288 ^ Image fromFile:'bitmaps/Debugger.xbm' resolution:100 |
289 |
289 |
290 "Created: 1.1.1970 / 01:00:00 / cg" |
290 "Created: 1.1.1970 / 01:00:00 / cg" |
|
291 ! ! |
|
292 |
|
293 !DebugView class methodsFor:'misc'! |
|
294 |
|
295 interestingContextFrom:aContext |
|
296 "return an interesting contexts offset, or nil. |
|
297 This is the context initially shown in the walkback. |
|
298 We move up the calling chain, skipping all intermediate Signal |
|
299 and Exception contexts, to present the context in which the error |
|
300 actually occured. |
|
301 Just for your convenience :-)" |
|
302 |
|
303 |delta con| |
|
304 |
|
305 delta := self interestingContextIndexFrom:aContext. |
|
306 con := aContext. |
|
307 [delta > 1] whileTrue:[ |
|
308 con := con sender. |
|
309 delta := delta - 1. |
|
310 ]. |
|
311 ^ con |
|
312 |
|
313 "Modified: 7.1.1997 / 21:31:05 / cg" |
|
314 ! |
|
315 |
|
316 interestingContextIndexFrom:aContext |
|
317 "return an interesting contexts offset, or nil. |
|
318 This is the context initially shown in the walkback. |
|
319 We move up the calling chain, skipping all intermediate Signal |
|
320 and Exception contexts, to present the context in which the error |
|
321 actually occured. |
|
322 Just for your convenience :-)" |
|
323 |
|
324 |c found offset sel prev ex| |
|
325 |
|
326 aContext isBlockContext ifTrue:[^ 1]. |
|
327 |
|
328 "somewhere, at the bottom, there must be a raise ..." |
|
329 |
|
330 c := aContext. |
|
331 1 to:5 do:[:i | |
|
332 c isNil ifTrue:[^ 1 "^ nil"]. |
|
333 sel := c selector. |
|
334 (sel == #raise) ifTrue:[ |
|
335 (c receiver isKindOf:Exception) ifTrue:[ |
|
336 ex := c receiver. |
|
337 offset := i. |
|
338 found := c |
|
339 ] ifFalse:[ |
|
340 (c receiver isSignal) ifTrue:[ |
|
341 offset := i. |
|
342 found := c |
|
343 ] |
|
344 ] |
|
345 ]. |
|
346 c := c sender. |
|
347 ]. |
|
348 |
|
349 " |
|
350 if this is a noHandler exception, skip forward |
|
351 to the erronous context |
|
352 " |
|
353 ex notNil ifTrue:[ |
|
354 ex signal == Signal noHandlerSignal ifTrue:[ |
|
355 c := ex suspendedContext |
|
356 ] |
|
357 ]. |
|
358 |
|
359 (c := found) isNil ifTrue:[ |
|
360 "/ this is a kludge, but convenient. |
|
361 "/ show the place where the divisionByZero happend, |
|
362 "/ not where the signal was raised. |
|
363 |
|
364 sel := aContext selector. |
|
365 (sel == #// |
|
366 or:[sel == #/ |
|
367 or:[sel == #\\]]) ifTrue:[ |
|
368 ^ 2 |
|
369 ]. |
|
370 |
|
371 ^ 1 |
|
372 ]. |
|
373 |
|
374 " |
|
375 got it; move up, skipping all intermediate Signal and |
|
376 Exception contexts |
|
377 " |
|
378 prev := nil. |
|
379 [ |
|
380 ((c receiver isSignal) |
|
381 or:[(c receiver isKindOf:Exception)]) |
|
382 ] whileTrue:[ |
|
383 prev := c. |
|
384 (c := c sender) isNil ifTrue:[^ offset]. |
|
385 offset := offset + 1. |
|
386 ]. |
|
387 |
|
388 " |
|
389 now, we are one above the raising context |
|
390 " |
|
391 |
|
392 " |
|
393 if the sender-method of the raise is one of objects error methods ... |
|
394 " |
|
395 ( #( halt halt: |
|
396 error error: |
|
397 doesNotUnderstand: |
|
398 subclassResponsibility |
|
399 primitiveFailed) includes:c selector) |
|
400 ifTrue:[ |
|
401 c selector == #doesNotUnderstand: ifTrue:[ |
|
402 " |
|
403 one more up, to get to the originating context |
|
404 " |
|
405 (c := c sender) isNil ifTrue:[^ offset]. |
|
406 offset := offset + 1. |
|
407 ]. |
|
408 (c := c sender) isNil ifTrue:[^ offset]. |
|
409 offset := offset + 1. |
|
410 ] ifFalse:[ |
|
411 " |
|
412 ok, got the raise - if its a BreakPoint, look for the sender |
|
413 " |
|
414 (MessageTracer notNil and:[prev receiver == MessageTracer breakpointSignal]) ifTrue:[ |
|
415 offset := offset + 1 |
|
416 ]. |
|
417 ]. |
|
418 |
|
419 ^ offset |
|
420 |
|
421 "Modified: 26.7.1996 / 16:34:58 / cg" |
|
422 "Created: 7.1.1997 / 21:26:05 / cg" |
291 ! ! |
423 ! ! |
292 |
424 |
293 !DebugView methodsFor:'basic'! |
425 !DebugView methodsFor:'basic'! |
294 |
426 |
295 enter |
427 enter |
2170 |
2302 |
2171 inspectedProcess |
2303 inspectedProcess |
2172 ^ inspectedProcess |
2304 ^ inspectedProcess |
2173 ! |
2305 ! |
2174 |
2306 |
2175 interestingContextFrom:aContext |
|
2176 "return an interesting contexts offset, or nil. |
|
2177 This is the context initially shown in the walkback. |
|
2178 We move up the calling chain, skipping all intermediate Signal |
|
2179 and Exception contexts, to present the context in which the error |
|
2180 actually occured. |
|
2181 Just for your convenience :-)" |
|
2182 |
|
2183 |c found offset sel prev ex| |
|
2184 |
|
2185 aContext isBlockContext ifTrue:[^ 1]. |
|
2186 |
|
2187 "somewhere, at the bottom, there must be a raise ..." |
|
2188 |
|
2189 c := aContext. |
|
2190 1 to:5 do:[:i | |
|
2191 c isNil ifTrue:[^ 1 "^ nil"]. |
|
2192 sel := c selector. |
|
2193 (sel == #raise) ifTrue:[ |
|
2194 (c receiver isKindOf:Exception) ifTrue:[ |
|
2195 ex := c receiver. |
|
2196 offset := i. |
|
2197 found := c |
|
2198 ] ifFalse:[ |
|
2199 (c receiver isSignal) ifTrue:[ |
|
2200 offset := i. |
|
2201 found := c |
|
2202 ] |
|
2203 ] |
|
2204 ]. |
|
2205 c := c sender. |
|
2206 ]. |
|
2207 |
|
2208 " |
|
2209 if this is a noHandler exception, skip forward |
|
2210 to the erronous context |
|
2211 " |
|
2212 ex notNil ifTrue:[ |
|
2213 ex signal == Signal noHandlerSignal ifTrue:[ |
|
2214 c := ex suspendedContext |
|
2215 ] |
|
2216 ]. |
|
2217 |
|
2218 (c := found) isNil ifTrue:[ |
|
2219 "/ this is a kludge, but convenient. |
|
2220 "/ show the place where the divisionByZero happend, |
|
2221 "/ not where the signal was raised. |
|
2222 |
|
2223 sel := aContext selector. |
|
2224 (sel == #// |
|
2225 or:[sel == #/ |
|
2226 or:[sel == #\\]]) ifTrue:[ |
|
2227 ^ 2 |
|
2228 ]. |
|
2229 |
|
2230 ^ 1 |
|
2231 ]. |
|
2232 |
|
2233 " |
|
2234 got it; move up, skipping all intermediate Signal and |
|
2235 Exception contexts |
|
2236 " |
|
2237 prev := nil. |
|
2238 [ |
|
2239 ((c receiver isSignal) |
|
2240 or:[(c receiver isKindOf:Exception)]) |
|
2241 ] whileTrue:[ |
|
2242 prev := c. |
|
2243 (c := c sender) isNil ifTrue:[^ offset]. |
|
2244 offset := offset + 1. |
|
2245 ]. |
|
2246 |
|
2247 " |
|
2248 now, we are one above the raising context |
|
2249 " |
|
2250 |
|
2251 " |
|
2252 if the sender-method of the raise is one of objects error methods ... |
|
2253 " |
|
2254 ( #( halt halt: |
|
2255 error error: |
|
2256 doesNotUnderstand: |
|
2257 subclassResponsibility |
|
2258 primitiveFailed) includes:c selector) |
|
2259 ifTrue:[ |
|
2260 c selector == #doesNotUnderstand: ifTrue:[ |
|
2261 " |
|
2262 one more up, to get to the originating context |
|
2263 " |
|
2264 (c := c sender) isNil ifTrue:[^ offset]. |
|
2265 offset := offset + 1. |
|
2266 ]. |
|
2267 (c := c sender) isNil ifTrue:[^ offset]. |
|
2268 offset := offset + 1. |
|
2269 ] ifFalse:[ |
|
2270 " |
|
2271 ok, got the raise - if its a BreakPoint, look for the sender |
|
2272 " |
|
2273 (MessageTracer notNil and:[prev receiver == MessageTracer breakpointSignal]) ifTrue:[ |
|
2274 offset := offset + 1 |
|
2275 ]. |
|
2276 ]. |
|
2277 |
|
2278 ^ offset |
|
2279 |
|
2280 "Created: 10.12.1995 / 13:55:21 / cg" |
|
2281 "Modified: 26.7.1996 / 16:34:58 / cg" |
|
2282 ! |
|
2283 |
|
2284 interruptProcessWith:aBlock |
2307 interruptProcessWith:aBlock |
2285 "let inspected process do something, then update the context list" |
2308 "let inspected process do something, then update the context list" |
2286 |
2309 |
2287 inspectedProcess isDead ifTrue:[ |
2310 inspectedProcess isDead ifTrue:[ |
2288 self showTerminated. |
2311 self showTerminated. |