17 steppedContextAddress canAbort abortButton terminateButton |
17 steppedContextAddress canAbort abortButton terminateButton |
18 continueButton stepButton nextButton sendButton returnButton |
18 continueButton stepButton nextButton sendButton returnButton |
19 restartButton exclusive inspecting nChainShown inspectedProcess |
19 restartButton exclusive inspecting nChainShown inspectedProcess |
20 updateProcess stopButton updateButton monitorToggle stepping |
20 updateProcess stopButton updateButton monitorToggle stepping |
21 steppedContextLineno stepForReturn actualContext inWrap |
21 steppedContextLineno stepForReturn actualContext inWrap |
22 stackInspector steppedContext wrapperContext verboseBacktrace' |
22 stackInspector steppedContext wrapperContext verboseBacktrace |
|
23 firstContext' |
23 classVariableNames:'CachedDebugger CachedExclusive OpenDebuggers MoreDebuggingDetail |
24 classVariableNames:'CachedDebugger CachedExclusive OpenDebuggers MoreDebuggingDetail |
24 DebuggingDebugger VerboseBacktraceDefault' |
25 DebuggingDebugger VerboseBacktraceDefault' |
25 poolDictionaries:'' |
26 poolDictionaries:'' |
26 category:'Interface-Debugger' |
27 category:'Interface-Debugger' |
27 ! |
28 ! |
459 "enter the debugger - get and display the context, then start an |
460 "enter the debugger - get and display the context, then start an |
460 exclusive event loop on top of eveything else" |
461 exclusive event loop on top of eveything else" |
461 |
462 |
462 |con selection m idx retval enteredByInterrupt sel| |
463 |con selection m idx retval enteredByInterrupt sel| |
463 |
464 |
|
465 verboseBacktrace := VerboseBacktraceDefault ? false. |
|
466 |
464 busy := true. |
467 busy := true. |
465 inspecting := false. |
468 inspecting := false. |
466 inspectedProcess := Processor activeProcess. |
469 inspectedProcess := Processor activeProcess. |
467 stepping := false. |
470 stepping := false. |
468 bigStep := false. |
471 bigStep := false. |
499 stepButton turnOffWithoutRedraw. |
502 stepButton turnOffWithoutRedraw. |
500 sendButton turnOffWithoutRedraw. |
503 sendButton turnOffWithoutRedraw. |
501 |
504 |
502 m := contextView middleButtonMenu. |
505 m := contextView middleButtonMenu. |
503 m notNil ifTrue:[ |
506 m notNil ifTrue:[ |
504 m disableAll:#(showMore skip skipForoReturn inspectContext). |
507 m disableAll:#(showMore skip skipForReturn inspectContext). |
505 ] |
508 ]. |
|
509 verboseBacktrace |
|
510 ifTrue:[self showVerboseBacktrace] |
|
511 ifFalse:[self showDenseBacktrace]. |
506 ] ifFalse:[ |
512 ] ifFalse:[ |
507 self iconLabel:'Debugger'. |
513 self iconLabel:'Debugger'. |
508 ]. |
514 ]. |
509 |
515 |
510 windowGroup isNil ifTrue:[ |
516 windowGroup isNil ifTrue:[ |
857 self cacheMyself. |
863 self cacheMyself. |
858 ] |
864 ] |
859 |
865 |
860 "Created: 24.11.1995 / 19:52:54 / cg" |
866 "Created: 24.11.1995 / 19:52:54 / cg" |
861 "Modified: 3.5.1996 / 23:58:16 / stefan" |
867 "Modified: 3.5.1996 / 23:58:16 / stefan" |
862 "Modified: 10.1.1997 / 17:41:58 / cg" |
868 "Modified: 11.1.1997 / 13:25:07 / cg" |
863 ! |
869 ! |
864 |
870 |
865 openOn:aProcess |
871 openOn:aProcess |
866 "enter the debugger on a process - |
872 "enter the debugger on a process - |
867 in this case, we are just inspecting the context chain of the process, |
873 in this case, we are just inspecting the context chain of the process, |
868 not running on top of the debugged process, but as a separate |
874 not running on top of the debugged process, but as a separate |
869 one. (think of it as an inspector showing more detail, and offering |
875 one. (think of it as an inspector showing more detail, and offering |
870 some more control operations)" |
876 some more control operations)" |
871 |
877 |
872 |bpanel dummy| |
878 |bpanel dummy| |
|
879 |
|
880 verboseBacktrace := VerboseBacktraceDefault ? false. |
873 |
881 |
874 busy := true. |
882 busy := true. |
875 bigStep := false. |
883 bigStep := false. |
876 inspecting := true. |
884 inspecting := true. |
877 inspectedProcess := aProcess. |
885 inspectedProcess := aProcess. |
2212 terminateButton turnOff. |
2220 terminateButton turnOff. |
2213 |
2221 |
2214 "Modified: 10.1.1997 / 17:42:10 / cg" |
2222 "Modified: 10.1.1997 / 17:42:10 / cg" |
2215 ! |
2223 ! |
2216 |
2224 |
2217 redisplayBacktrace |
|
2218 |oldSelection con| |
|
2219 |
|
2220 contextArray notNil ifTrue:[ |
|
2221 oldSelection := contextView selection. |
|
2222 con := contextArray at:1. |
|
2223 contextArray at:1 put:nil. |
|
2224 self setContext:con. |
|
2225 contextView setSelection:oldSelection. |
|
2226 ] |
|
2227 |
|
2228 "Modified: 25.5.1996 / 12:26:55 / cg" |
|
2229 "Created: 10.1.1997 / 21:36:46 / cg" |
|
2230 ! |
|
2231 |
|
2232 removeAllBreakpoints |
2225 removeAllBreakpoints |
2233 "remove all trace & breakpoints - if any" |
2226 "remove all trace & breakpoints - if any" |
2234 |
2227 |
2235 MessageTracer unwrapAllMethods |
2228 MessageTracer unwrapAllMethods |
2236 ! |
2229 ! |
2383 " |
2376 " |
2384 (Delay forSeconds:0.2) wait. |
2377 (Delay forSeconds:0.2) wait. |
2385 self setContext:(inspectedProcess suspendedContext). |
2378 self setContext:(inspectedProcess suspendedContext). |
2386 ! |
2379 ! |
2387 |
2380 |
|
2381 redisplayBacktrace |
|
2382 |oldSelection oldContext con idx| |
|
2383 |
|
2384 contextArray notNil ifTrue:[ |
|
2385 oldSelection := contextView selection. |
|
2386 oldSelection notNil ifTrue:[ |
|
2387 oldContext := contextArray at:oldSelection ifAbsent:nil. |
|
2388 ]. |
|
2389 |
|
2390 con := firstContext. |
|
2391 "/ con := contextArray at:1. |
|
2392 contextArray at:1 put:nil. |
|
2393 self setContext:con. |
|
2394 |
|
2395 oldContext isNil ifTrue:[ |
|
2396 idx := oldSelection |
|
2397 ] ifFalse:[ |
|
2398 idx := contextArray identityIndexOf:oldContext ifAbsent:nil. |
|
2399 ]. |
|
2400 contextView setSelection:idx. |
|
2401 idx notNil ifTrue:[ |
|
2402 self showSelection:idx |
|
2403 ] |
|
2404 ] |
|
2405 |
|
2406 "Created: 10.1.1997 / 21:36:46 / cg" |
|
2407 "Modified: 11.1.1997 / 13:47:11 / cg" |
|
2408 ! |
|
2409 |
2388 setContext:aContext |
2410 setContext:aContext |
2389 "show calling chain from aContext in the walk-back listview" |
2411 "show calling chain from aContext in the walk-back listview" |
2390 |
2412 |
2391 ^ self setContext:aContext releaseInspectors:true |
2413 ^ self setContext:aContext releaseInspectors:true |
2392 |
2414 |
2394 ! |
2416 ! |
2395 |
2417 |
2396 setContext:aContext releaseInspectors:releaseInspectors |
2418 setContext:aContext releaseInspectors:releaseInspectors |
2397 "show calling chain from aContext in the walk-back listview" |
2419 "show calling chain from aContext in the walk-back listview" |
2398 |
2420 |
2399 |con text method caller caller2 m count showIt| |
2421 |con text method caller caller2 m count showIt c suspendContext| |
2400 |
2422 |
2401 (contextArray notNil and:[aContext == (contextArray at:1)]) ifTrue:[ |
2423 (contextArray notNil and:[aContext == (contextArray at:1)]) ifTrue:[ |
2402 "no change" |
2424 "no change" |
2403 ^ false |
2425 ^ false |
2404 ]. |
2426 ]. |
|
2427 |
|
2428 firstContext := aContext. |
2405 |
2429 |
2406 m := contextView middleButtonMenu. |
2430 m := contextView middleButtonMenu. |
2407 m notNil ifTrue:[ |
2431 m notNil ifTrue:[ |
2408 m disable:#showMore. |
2432 m disable:#showMore. |
2409 ]. |
2433 ]. |
2413 contextArray := nil. |
2437 contextArray := nil. |
2414 ] ifFalse:[ |
2438 ] ifFalse:[ |
2415 text := OrderedCollection new:nChainShown. |
2439 text := OrderedCollection new:nChainShown. |
2416 contextArray := OrderedCollection new:nChainShown. |
2440 contextArray := OrderedCollection new:nChainShown. |
2417 con := aContext. |
2441 con := aContext. |
|
2442 |
|
2443 verboseBacktrace ~~ true ifTrue:[ |
|
2444 "/ with dense backtrace, hide the ProcessorScheduler |
|
2445 "/ contexts at the top; look for a Process>>suspend |
|
2446 "/ context within the first 10 contexts |
|
2447 |
|
2448 suspendContext := nil. |
|
2449 c := con. |
|
2450 1 to:10 do:[:i | |
|
2451 ((c selector startsWith:'suspend') |
|
2452 and:[c receiver isMemberOf:Process]) ifTrue:[ |
|
2453 suspendContext := c |
|
2454 ]. |
|
2455 c := c sender. |
|
2456 ]. |
|
2457 suspendContext notNil ifTrue:[ |
|
2458 con := c. |
|
2459 ]. |
|
2460 ]. |
2418 |
2461 |
2419 " |
2462 " |
2420 get them all |
2463 get them all |
2421 " |
2464 " |
2422 count := 0. |
2465 count := 0. |
2481 m disable:#browseClass. |
2524 m disable:#browseClass. |
2482 ]. |
2525 ]. |
2483 ^ true |
2526 ^ true |
2484 |
2527 |
2485 "Created: 14.12.1995 / 19:10:31 / cg" |
2528 "Created: 14.12.1995 / 19:10:31 / cg" |
2486 "Modified: 10.1.1997 / 21:01:57 / cg" |
2529 "Modified: 11.1.1997 / 13:28:18 / cg" |
2487 ! |
2530 ! |
2488 |
2531 |
2489 setContextSkippingInterruptContexts:aContext |
2532 setContextSkippingInterruptContexts:aContext |
2490 "show calling chain from aContext in the walk-back listview. |
2533 "show calling chain from aContext in the walk-back listview. |
2491 Ignore any non-interresting interrupt-context." |
2534 Ignore any non-interresting interrupt-context." |
2527 showTerminated |
2570 showTerminated |
2528 self showError:'** the process has terminated **' |
2571 self showError:'** the process has terminated **' |
2529 ! |
2572 ! |
2530 |
2573 |
2531 showingContext:aContext |
2574 showingContext:aContext |
2532 "return false, if this context is to be skipped" |
2575 "return false, if this context is to be skipped. |
2533 |
2576 Here, we hide some wellKnown methods, which are usually |
2534 |sel rec| |
2577 not too interresting; the set of methods which are suppressed |
|
2578 is my (claus's) own choice." |
|
2579 |
|
2580 |sel rec mClass| |
2535 |
2581 |
2536 verboseBacktrace ifTrue:[^ true]. |
2582 verboseBacktrace ifTrue:[^ true]. |
2537 |
2583 |
2538 rec := aContext receiver. |
2584 rec := aContext receiver. |
2539 sel := aContext selector. |
2585 sel := aContext selector. |
2540 |
2586 mClass := aContext methodClass. |
2541 (rec isMemberOf:Block) ifTrue:[ |
2587 |
|
2588 sel == #withCursor:do: ifTrue:[ |
|
2589 (mClass == WindowGroup) ifTrue:[^ false]. |
|
2590 (mClass == TopView) ifTrue:[^ false]. |
|
2591 ]. |
|
2592 (sel == #withExecuteCursorDo: |
|
2593 or:[sel == #withWaitCursorDo:]) ifTrue:[ |
|
2594 (mClass == DisplaySurface) ifTrue:[^ false]. |
|
2595 ]. |
|
2596 |
|
2597 (mClass == Object) ifTrue:[ |
|
2598 (sel startsWith:'perform:') ifTrue:[^ false] |
|
2599 ]. |
|
2600 |
|
2601 (mClass == Method) ifTrue:[ |
|
2602 (sel startsWith:'valueWithReceiver:') ifTrue:[^ false] |
|
2603 ]. |
|
2604 |
|
2605 (mClass == Block) ifTrue:[ |
2542 sel == #valueNowOrOnUnwindDo: ifTrue:[^ false]. |
2606 sel == #valueNowOrOnUnwindDo: ifTrue:[^ false]. |
2543 sel == #valueOnUnwindDo: ifTrue:[^ false]. |
2607 sel == #valueOnUnwindDo: ifTrue:[^ false]. |
2544 |
2608 |
2545 sel == #value ifTrue:[^ false]. |
2609 sel == #value ifTrue:[^ false]. |
2546 sel == #value: ifTrue:[^ false]. |
2610 sel == #value: ifTrue:[^ false]. |
2559 "/ sel == #value:value:value:value: ifTrue:[^ false]. |
2623 "/ sel == #value:value:value:value: ifTrue:[^ false]. |
2560 "/ sel == #value:value:value:value:Value: ifTrue:[^ false]. |
2624 "/ sel == #value:value:value:value:Value: ifTrue:[^ false]. |
2561 "/ sel == #value:value:value:value:value:value: ifTrue:[^ false]. |
2625 "/ sel == #value:value:value:value:value:value: ifTrue:[^ false]. |
2562 "/ ]. |
2626 "/ ]. |
2563 |
2627 |
2564 ((rec isMemberOf:Signal) |
2628 ((mClass == Signal) |
2565 or:[(rec isMemberOf:QuerySignal) |
2629 or:[(mClass == QuerySignal) |
2566 or:[rec isMemberOf:SignalSet]] |
2630 or:[mClass == SignalSet]] |
2567 ) ifTrue:[ |
2631 ) ifTrue:[ |
2568 sel == #handle:do: ifTrue:[^ false]. |
2632 sel == #handle:do: ifTrue:[^ false]. |
2569 ]. |
2633 ]. |
2570 |
2634 |
2571 ^ true. |
2635 ^ true. |
2572 |
2636 |
2573 "Created: 10.1.1997 / 21:01:39 / cg" |
2637 "Created: 10.1.1997 / 21:01:39 / cg" |
2574 "Modified: 10.1.1997 / 21:11:32 / cg" |
2638 "Modified: 11.1.1997 / 13:44:39 / cg" |
2575 ! |
2639 ! |
2576 |
2640 |
2577 stepping |
2641 stepping |
2578 ^ stepping |
2642 ^ stepping |
2579 ! |
2643 ! |
2887 (line startsWith:'**') ifTrue:[ |
2951 (line startsWith:'**') ifTrue:[ |
2888 self showMore. |
2952 self showMore. |
2889 contextView setSelection:lineNr. |
2953 contextView setSelection:lineNr. |
2890 con := contextArray at:lineNr |
2954 con := contextArray at:lineNr |
2891 ]. |
2955 ]. |
2892 con isNil ifTrue:[^ self]. |
2956 con isNil ifTrue:[ |
|
2957 codeView contents:nil. |
|
2958 ^ self |
|
2959 ]. |
2893 ]. |
2960 ]. |
2894 |
2961 |
2895 self withWaitCursorDo:[ |
2962 self withWaitCursorDo:[ |
2896 " |
2963 " |
2897 give it to the (lower right) inspector |
2964 give it to the (lower right) inspector |
3045 ] |
3112 ] |
3046 ]. |
3113 ]. |
3047 |
3114 |
3048 code isNil ifTrue:[ |
3115 code isNil ifTrue:[ |
3049 canAccept := false. |
3116 canAccept := false. |
|
3117 codeView contents:nil. |
3050 ] ifFalse:[ |
3118 ] ifFalse:[ |
3051 codeView contents:code. |
3119 codeView contents:code. |
|
3120 |
3052 (lineNrInMethod notNil and:[lineNrInMethod ~~ 0]) ifTrue:[ |
3121 (lineNrInMethod notNil and:[lineNrInMethod ~~ 0]) ifTrue:[ |
3053 "/ lineNrInMethod > codeView list size ifTrue:[ |
3122 "/ lineNrInMethod > codeView list size ifTrue:[ |
3054 "/ lineNrInMethod := codeView list size + 1 |
3123 "/ lineNrInMethod := codeView list size + 1 |
3055 "/ ]. |
3124 "/ ]. |
3056 "/ codeView selectLine:lineNrInMethod. |
3125 "/ codeView selectLine:lineNrInMethod. |