11 " |
11 " |
12 |
12 |
13 StandardSystemView subclass:#DebugView |
13 StandardSystemView subclass:#DebugView |
14 instanceVariableNames:'busy haveControl exitAction canContinue contextView codeView |
14 instanceVariableNames:'busy haveControl exitAction canContinue contextView codeView |
15 receiverInspector contextInspector contextArray selectedContext |
15 receiverInspector contextInspector contextArray selectedContext |
16 catchBlock grabber traceView tracing bigStep skipLineNr |
16 catchBlock grabber mayProceed traceView tracing bigStep |
17 steppedContextAddress abortButton terminateButton continueButton |
17 skipLineNr steppedContextAddress abortButton terminateButton |
18 stepButton nextButton nextOverButton nextOutButton sendButton |
18 continueButton stepButton nextButton nextOverButton nextOutButton |
19 returnButton restartButton exclusive inspecting nChainShown |
19 sendButton returnButton restartButton exclusive inspecting |
20 inspectedProcess updateProcess stopButton updateButton |
20 nChainShown inspectedProcess updateProcess stopButton |
21 monitorToggle stepping steppedContextLineno stepForReturn |
21 updateButton monitorToggle stepping steppedContextLineno |
22 actualContext inWrap stackInspector steppedContext wrapperContext |
22 stepForReturn actualContext inWrap stackInspector steppedContext |
23 verboseBacktrace firstContext stepHow cachable currentMethod' |
23 wrapperContext verboseBacktrace firstContext stepHow cachable |
|
24 currentMethod' |
24 classVariableNames:'CachedDebugger CachedExclusive OpenDebuggers MoreDebuggingDetail |
25 classVariableNames:'CachedDebugger CachedExclusive OpenDebuggers MoreDebuggingDetail |
25 DebuggingDebugger VerboseBacktraceDefault DefaultIcon |
26 DebuggingDebugger VerboseBacktraceDefault DefaultIcon |
26 InitialNCHAINShown' |
27 InitialNCHAINShown' |
27 poolDictionaries:'' |
28 poolDictionaries:'' |
28 category:'Interface-Debugger' |
29 category:'Interface-Debugger' |
94 self newDebugger |
95 self newDebugger |
95 ! ! |
96 ! ! |
96 |
97 |
97 !DebugView class methodsFor:'instance creation'! |
98 !DebugView class methodsFor:'instance creation'! |
98 |
99 |
99 enter |
100 enter:aContext withMessage:aString mayProceed:mayProceed |
100 "another way of entering the debugger" |
|
101 |
|
102 ^ self enter:(thisContext sender) withMessage:'Debugger' |
|
103 |
|
104 "Debugger enter" |
|
105 ! |
|
106 |
|
107 enter:aContext |
|
108 "enter the debugger on aContext" |
|
109 |
|
110 ^ self enter:aContext withMessage:'Debugger' |
|
111 ! |
|
112 |
|
113 enter:aContext withMessage:aString |
|
114 "enter a debugger; if this is a recursive invocation, enter |
101 "enter a debugger; if this is a recursive invocation, enter |
115 a MiniDebugger instead. |
102 a MiniDebugger instead. |
116 This is the standard way of entering the debugger; |
103 This is the standard way of entering the debugger; |
117 sent from error- and halt messages." |
104 sent from error- and halt messages." |
118 |
105 |
126 "/ condition. |
113 "/ condition. |
127 found := false. |
114 found := false. |
128 c := thisContext sender. |
115 c := thisContext sender. |
129 [found not |
116 [found not |
130 and:[c notNil |
117 and:[c notNil |
131 and:[c selector ~~ #enter:withMessage:]]] whileTrue:[ |
118 and:[c selector ~~ #enter:withMessage:mayProceed:]]] whileTrue:[ |
132 c selector == #noByteCode ifTrue:[ |
119 c selector == #noByteCode ifTrue:[ |
133 found := true |
120 found := true |
134 ]. |
121 ]. |
135 c := c sender |
122 c := c sender |
136 ]. |
123 ]. |
137 |
124 |
138 found ifFalse:[ |
125 found ifFalse:[ |
139 ('DebugView [warning]: reentered with: ', aString) errorPrintCR. |
126 ('DebugView [warning]: reentered with: ', aString) errorPrintCR. |
140 ^ MiniDebugger |
127 ^ MiniDebugger |
141 enterWithMessage:'DebugView [error]: recursive error (in debugger)'. |
128 enterWithMessage:'DebugView [error]: recursive error (in debugger)' |
|
129 mayProceed:mayProceed. |
142 ] |
130 ] |
143 ]. |
131 ]. |
144 |
132 |
145 " |
133 " |
146 well, it could be a stepping or sending debugger up there; |
134 well, it could be a stepping or sending debugger up there; |
154 (aDebugger notNil and:[aDebugger ~~ 0]) ifTrue:[ |
142 (aDebugger notNil and:[aDebugger ~~ 0]) ifTrue:[ |
155 (aDebugger inspectedProcess == active) ifTrue:[ |
143 (aDebugger inspectedProcess == active) ifTrue:[ |
156 "/ 'entering stepping debugger again' printNL. |
144 "/ 'entering stepping debugger again' printNL. |
157 aDebugger unstep. |
145 aDebugger unstep. |
158 aDebugger setLabelFor:aString in:active. |
146 aDebugger setLabelFor:aString in:active. |
|
147 aDebugger mayProceed:mayProceed. |
159 ^ aDebugger enter:aContext select:nil. |
148 ^ aDebugger enter:aContext select:nil. |
160 ] |
149 ] |
161 ] |
150 ] |
162 ] |
151 ] |
163 ]. |
152 ]. |
164 |
153 |
165 ^ self enterUnconditional:aContext withMessage:aString |
154 ^ self enterUnconditional:aContext withMessage:aString mayProceed:mayProceed |
166 |
155 |
167 "Modified: / 30.10.1997 / 21:09:12 / cg" |
156 "Modified: / 30.10.1997 / 21:09:12 / cg" |
168 ! |
157 ! |
169 |
158 |
170 enterUnconditional:aContext withMessage:aString |
159 enterUnconditional:aContext withMessage:aString mayProceed:mayProceed |
171 "enter a debugger - do not check for recursive invocation" |
160 "enter a debugger - do not check for recursive invocation" |
172 |
161 |
173 |aDebugger breakpointSignal proc| |
162 |aDebugger breakpointSignal proc| |
174 |
163 |
175 StepInterruptPending := nil. |
164 StepInterruptPending := nil. |
182 breakpointSignal handle:[:ex | |
171 breakpointSignal handle:[:ex | |
183 'DebugView [info]: breakpoint in debugger ignored' infoPrintCR. |
172 'DebugView [info]: breakpoint in debugger ignored' infoPrintCR. |
184 ex proceed |
173 ex proceed |
185 ] do:[ |
174 ] do:[ |
186 aDebugger := self new. |
175 aDebugger := self new. |
|
176 aDebugger mayProceed:mayProceed. |
187 aDebugger setLabelFor:aString in:proc. |
177 aDebugger setLabelFor:aString in:proc. |
188 aDebugger enter:aContext select:nil. |
178 aDebugger enter:aContext select:nil. |
189 ] |
179 ] |
190 ] ifFalse:[ |
180 ] ifFalse:[ |
191 aDebugger := self new. |
181 aDebugger := self new. |
|
182 aDebugger mayProceed:mayProceed. |
192 aDebugger setLabelFor:aString in:proc. |
183 aDebugger setLabelFor:aString in:proc. |
193 aDebugger enter:aContext select:nil. |
184 aDebugger enter:aContext select:nil. |
194 ]. |
185 ]. |
195 ^ nil |
186 ^ nil |
196 |
187 |
197 "nil halt" |
188 "nil halt" |
198 |
189 |
199 "Modified: / 30.10.1997 / 21:10:55 / cg" |
190 "Modified: / 30.10.1997 / 21:10:55 / cg" |
200 ! |
|
201 |
|
202 enterWithMessage:aString |
|
203 "the standard way of entering the debugger - sent from Objects |
|
204 error- and halt messages" |
|
205 |
|
206 ^ self enter:(thisContext sender) withMessage:aString |
|
207 |
|
208 "Debugger enterWithMessage:'hi there'" |
|
209 ! |
191 ! |
210 |
192 |
211 new |
193 new |
212 "return a new DebugView - return a cached debugger if it already |
194 "return a new DebugView - return a cached debugger if it already |
213 exists" |
195 exists" |
512 "Created: 7.1.1997 / 21:26:05 / cg" |
494 "Created: 7.1.1997 / 21:26:05 / cg" |
513 "Modified: 27.3.1997 / 18:24:59 / cg" |
495 "Modified: 27.3.1997 / 18:24:59 / cg" |
514 ! ! |
496 ! ! |
515 |
497 |
516 !DebugView methodsFor:'basic'! |
498 !DebugView methodsFor:'basic'! |
517 |
|
518 enter |
|
519 "enter the debugger - on the sending context" |
|
520 |
|
521 |where| |
|
522 |
|
523 busy := true. |
|
524 |
|
525 where := thisContext. "enter" |
|
526 where := where sender. "the calling context" |
|
527 where notNil ifTrue:[ |
|
528 (where receiver == DebugView) ifTrue:[ |
|
529 where := where sender |
|
530 ] |
|
531 "where is now interrupted methods context" |
|
532 ]. |
|
533 ^ self enter:where select:nil |
|
534 |
|
535 "Modified: / 30.10.1997 / 21:11:29 / cg" |
|
536 ! |
|
537 |
499 |
538 enter:aContext select:initialSelectionOrNil |
500 enter:aContext select:initialSelectionOrNil |
539 "enter the debugger - get and display the context, then start an |
501 "enter the debugger - get and display the context, then start an |
540 exclusive event loop on top of eveything else" |
502 exclusive event loop on top of eveything else" |
541 |
503 |
711 m disable:#doTerminate. |
673 m disable:#doTerminate. |
712 ] ifFalse:[ |
674 ] ifFalse:[ |
713 terminateButton enable. |
675 terminateButton enable. |
714 m enable:#doTerminate. |
676 m enable:#doTerminate. |
715 ] |
677 ] |
|
678 ]. |
|
679 |
|
680 mayProceed == false ifTrue:[ |
|
681 continueButton disable. |
|
682 m notNil ifTrue:[m disable:#doContinue]. |
|
683 ] ifFalse:[ |
|
684 continueButton enable. |
|
685 m notNil ifTrue:[m enable:#doContinue] |
716 ]. |
686 ]. |
717 |
687 |
718 " |
688 " |
719 drawableId is nil, if this is a new debugger. Then do a realize. |
689 drawableId is nil, if this is a new debugger. Then do a realize. |
720 Otherwise, its probably better to do a map, which shows the |
690 Otherwise, its probably better to do a map, which shows the |
2732 " |
2702 " |
2733 (Delay forSeconds:0.2) wait. |
2703 (Delay forSeconds:0.2) wait. |
2734 self setContext:(inspectedProcess suspendedContext). |
2704 self setContext:(inspectedProcess suspendedContext). |
2735 ! |
2705 ! |
2736 |
2706 |
|
2707 mayProceed:aBoolean |
|
2708 mayProceed := aBoolean |
|
2709 ! |
|
2710 |
2737 processPerform:aMessage |
2711 processPerform:aMessage |
2738 "do something, then update the context list" |
2712 "do something, then update the context list" |
2739 |
2713 |
2740 inspectedProcess isDead ifTrue:[ |
2714 inspectedProcess isDead ifTrue:[ |
2741 self showTerminated. |
2715 self showTerminated. |
3430 choose:('error in debugger:\' withCRs , ex errorString , '\\debug again ?' withCRs) |
3404 choose:('error in debugger:\' withCRs , ex errorString , '\\debug again ?' withCRs) |
3431 labels:#( 'proceed' 'cancel' 'debug' ) |
3405 labels:#( 'proceed' 'cancel' 'debug' ) |
3432 values:#( #proceed #cancel #debug ) |
3406 values:#( #proceed #cancel #debug ) |
3433 default:#cancel. |
3407 default:#cancel. |
3434 answer == #debug ifTrue:[ |
3408 answer == #debug ifTrue:[ |
3435 Debugger enterUnconditional:(ex suspendedContext) withMessage:'error in debugger: ' , ex errorString. |
3409 Debugger |
|
3410 enterUnconditional:(ex suspendedContext) |
|
3411 withMessage:'error in debugger: ' , ex errorString |
|
3412 mayProceed:true. |
3436 ex proceed. |
3413 ex proceed. |
3437 ]. |
3414 ]. |
3438 answer == #proceed ifTrue:[ |
3415 answer == #proceed ifTrue:[ |
3439 ex proceed. |
3416 ex proceed. |
3440 ]. |
3417 ]. |