DebugView.st
changeset 11210 83e08cc8ce48
parent 11209 202af72b0a90
child 11303 28e758994349
child 12123 4bde08cebd48
equal deleted inserted replaced
11209:202af72b0a90 11210:83e08cc8ce48
     1 "
     1 "
     2  COPYRIGHT (c) 1989 by Claus Gittinger
     2  COPYRIGHT (c) 1989 by Claus Gittinger
     3 	      All Rights Reserved
     3               All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     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
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libtool' }"
    12 "{ Package: 'stx:libtool' }"
    13 
    13 
    14 StandardSystemView subclass:#DebugView
    14 StandardSystemView subclass:#DebugView
    15 	instanceVariableNames:'busy haveControl exitAction canContinue contextView codeView
    15         instanceVariableNames:'busy haveControl exitAction canContinue contextView codeView
    16 		receiverInspector contextInspector contextArray selectedContext
    16                 receiverInspector contextInspector contextArray selectedContext
    17 		catchBlock grabber mayProceed traceView tracing bigStep
    17                 catchBlock grabber mayProceed traceView tracing bigStep
    18 		skipLineNr steppedContextAddress abortButton terminateButton
    18                 skipLineNr steppedContextAddress abortButton terminateButton
    19 		continueButton stepButton nextButton nextOverButton nextOutButton
    19                 continueButton stepButton nextButton nextOverButton nextOutButton
    20 		sendButton returnButton restartButton exclusive inspecting
    20                 sendButton returnButton restartButton exclusive inspecting
    21 		nChainShown inspectedProcess updateProcess stopButton
    21                 nChainShown inspectedProcess updateProcess stopButton
    22 		updateButton defineButton monitorToggle stepping
    22                 updateButton defineButton monitorToggle stepping
    23 		steppedContextLineno stepForReturn actualContext inWrap
    23                 steppedContextLineno stepForReturn actualContext inWrap
    24 		stackInspector steppedContext wrapperContext verboseBacktrace
    24                 stackInspector steppedContext wrapperContext verboseBacktrace
    25 		firstContext stepHow cachable currentMethod ignoreBreakpoints
    25                 firstContext stepHow cachable currentMethod ignoreBreakpoints
    26 		stepUntilEntering lastStepUntilEntering
    26                 stepUntilEntering lastStepUntilEntering
    27 		lastSelectionInReceiverInspector lastSelectionInContextInspector
    27                 lastSelectionInReceiverInspector lastSelectionInContextInspector
    28 		canShowMore exitAbort reportButton setOfHiddenCallingSelectors
    28                 canShowMore exitAbort reportButton setOfHiddenCallingSelectors
    29 		isStoppedAtHaltOrBreakPoint exceptionInfoLabel methodCodeToggle
    29                 isStoppedAtHaltOrBreakPoint exceptionInfoLabel methodCodeToggle
    30 		methodCodeToggleSelectionHolder'
    30                 methodCodeToggleSelectionHolder'
    31 	classVariableNames:'CachedDebugger CachedExclusive OpenDebuggers MoreDebuggingDetail
    31         classVariableNames:'CachedDebugger CachedExclusive OpenDebuggers MoreDebuggingDetail
    32 		DebuggingDebugger DefaultDebuggerBackgroundColor
    32                 DebuggingDebugger DefaultDebuggerBackgroundColor
    33 		InitialNChainShown IgnoredHalts ShowThreadID LastIgnoreHaltNTimes
    33                 InitialNChainShown IgnoredHalts ShowThreadID LastIgnoreHaltNTimes
    34 		LastIgnoreHaltDuration LastExtent LastOrigin'
    34                 LastIgnoreHaltDuration LastExtent LastOrigin'
    35 	poolDictionaries:''
    35         poolDictionaries:''
    36 	category:'Interface-Debugger'
    36         category:'Interface-Debugger'
    37 !
    37 !
    38 
    38 
    39 Object subclass:#IgnoredHalt
    39 Object subclass:#IgnoredHalt
    40 	instanceVariableNames:'weakMethodHolder lineNumber ignoreEndTime ignoreCount'
    40         instanceVariableNames:'weakMethodHolder lineNumber ignoreEndTime ignoreCount
    41 	classVariableNames:''
    41                 ignoreUntilShiftKeyPressed'
    42 	poolDictionaries:''
    42         classVariableNames:''
    43 	privateIn:DebugView
    43         poolDictionaries:''
       
    44         privateIn:DebugView
    44 !
    45 !
    45 
    46 
    46 !DebugView class methodsFor:'documentation'!
    47 !DebugView class methodsFor:'documentation'!
    47 
    48 
    48 copyright
    49 copyright
    49 "
    50 "
    50  COPYRIGHT (c) 1989 by Claus Gittinger
    51  COPYRIGHT (c) 1989 by Claus Gittinger
    51 	      All Rights Reserved
    52               All Rights Reserved
    52 
    53 
    53  This software is furnished under a license and may be used
    54  This software is furnished under a license and may be used
    54  only in accordance with the terms of that license and with the
    55  only in accordance with the terms of that license and with the
    55  inclusion of the above copyright notice.   This software may not
    56  inclusion of the above copyright notice.   This software may not
    56  be provided or otherwise made available to, or used by, any
    57  be provided or otherwise made available to, or used by, any
    82     to have the debugger control the debuggee (i.e. two processes)
    83     to have the debugger control the debuggee (i.e. two processes)
    83 
    84 
    84     See additional information in 'doc/misc/debugger.doc'.
    85     See additional information in 'doc/misc/debugger.doc'.
    85 
    86 
    86     Notice:
    87     Notice:
    87 	the DebugView class caches the last used debugger in a class
    88         the DebugView class caches the last used debugger in a class
    88 	variable. It may happen, that a malfunctioning debugger (for example,
    89         variable. It may happen, that a malfunctioning debugger (for example,
    89 	a halfway destroyed one) is kept there. You will notice this, if a
    90         a halfway destroyed one) is kept there. You will notice this, if a
    90 	debugger comes up without showing any contents. In this case, close
    91         debugger comes up without showing any contents. In this case, close
    91 	(or destroy) the broken debugView, and execute
    92         (or destroy) the broken debugView, and execute
    92 	    Debugger newDebugger
    93             Debugger newDebugger
    93 	which removes the cached debugger and forces creation of a new one the
    94         which removes the cached debugger and forces creation of a new one the
    94 	next time. This is a temporary workaround - the debugger will be fixed to
    95         next time. This is a temporary workaround - the debugger will be fixed to
    95 	avoid this problem.
    96         avoid this problem.
    96 	You also have to remove the cached debugger, if you change the debugger's
    97         You also have to remove the cached debugger, if you change the debugger's
    97 	initialization code (buttons, menu, etc.) and you want the new code to become
    98         initialization code (buttons, menu, etc.) and you want the new code to become
    98 	effective.
    99         effective.
    99 
   100 
   100     [author:]
   101     [author:]
   101 	Claus Gittinger
   102         Claus Gittinger
   102 
   103 
   103     [see also:]
   104     [see also:]
   104 	Exception Signal
   105         Exception Signal
   105 	Process
   106         Process
   106 "
   107 "
   107 ! !
   108 ! !
   108 
   109 
   109 !DebugView class methodsFor:'initialization'!
   110 !DebugView class methodsFor:'initialization'!
   110 
   111 
   146     CachedDebugger := nil.
   147     CachedDebugger := nil.
   147     CachedExclusive := nil.
   148     CachedExclusive := nil.
   148     OpenDebuggers := nil.
   149     OpenDebuggers := nil.
   149 
   150 
   150     (Debugger isBehavior and:[Debugger name = #DebugView]) ifTrue:[
   151     (Debugger isBehavior and:[Debugger name = #DebugView]) ifTrue:[
   151 	Debugger := self
   152         Debugger := self
   152     ].
   153     ].
   153 
   154 
   154     "
   155     "
   155      DebugView newDebugger
   156      DebugView newDebugger
   156     "
   157     "
   205     "the information (if any) about the ignore-state of a halt"
   206     "the information (if any) about the ignore-state of a halt"
   206 
   207 
   207     IgnoredHalts isNil ifTrue:[^ nil].
   208     IgnoredHalts isNil ifTrue:[^ nil].
   208 
   209 
   209     IgnoredHalts do:[:ign |
   210     IgnoredHalts do:[:ign |
   210 	(ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
   211         (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
   211 	    ^ ign
   212             ^ ign
   212 	].
   213         ].
   213     ].
   214     ].
   214     ^ nil.
   215     ^ nil.
   215 !
   216 !
   216 
   217 
   217 hasIgnoredHalts
   218 hasIgnoredHalts
   218     self removeInactiveIgnores.
   219     self removeInactiveIgnores.
   219     ^ IgnoredHalts notEmptyOrNil
   220     ^ IgnoredHalts notEmptyOrNil
   220 !
   221 !
   221 
   222 
   222 ignoreHaltIn:haltingMethod at:lineNrOfHalt forCount:countOrNil orTimeDuration:dTOrNil
   223 ignoreHaltIn:haltingMethod at:lineNrOfHalt forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
   223     "remember to ignore a halt in some method for some number of invocations
   224     "remember to ignore a halt in some method for some number of invocations
   224      or until some time has elapsed.
   225      or until some time has elapsed.
   225      With nil count and time arguments, such an ignored halt is reactivated"
   226      With nil count and time arguments, such an ignored halt is reactivated"
   226 
   227 
   227     |oldEntry ign|
   228     |oldEntry ign|
   228 
   229 
   229     IgnoredHalts notNil ifTrue:[
   230     IgnoredHalts notNil ifTrue:[
   230 	self removeInactiveIgnores.
   231         self removeInactiveIgnores.
   231 	oldEntry := IgnoredHalts
   232         oldEntry := IgnoredHalts
   232 			detect:[:ign | ign isForMethod:haltingMethod line:lineNrOfHalt]
   233                         detect:[:ign | ign isForMethod:haltingMethod line:lineNrOfHalt]
   233 			ifNone:nil.
   234                         ifNone:nil.
   234 	oldEntry notNil ifTrue:[
   235         oldEntry notNil ifTrue:[
   235 	    IgnoredHalts remove:oldEntry ifAbsent:[].
   236             IgnoredHalts remove:oldEntry ifAbsent:[].
   236 	]
   237         ]
   237     ].
   238     ].
   238 
   239 
   239     (countOrNil notNil or:[dTOrNil notNil]) ifTrue:[
   240     (countOrNil notNil or:[dTOrNil notNil or:[untilShiftKey == true]]) ifTrue:[
   240 	IgnoredHalts isNil ifTrue:[
   241         IgnoredHalts isNil ifTrue:[
   241 	    IgnoredHalts := OrderedCollection new.
   242             IgnoredHalts := OrderedCollection new.
   242 	].
   243         ].
   243 	ign := IgnoredHalt new method:haltingMethod lineNumber:lineNrOfHalt.
   244         ign := IgnoredHalt new method:haltingMethod lineNumber:lineNrOfHalt.
   244 
   245 
   245 	(countOrNil notNil and:[countOrNil > 0]) ifTrue:[
   246         (countOrNil notNil and:[countOrNil > 0]) ifTrue:[
   246 	    ign ignoreCount:countOrNil.
   247             ign ignoreCount:countOrNil.
   247 	].
   248         ].
   248 	(dTOrNil notNil) ifTrue:[
   249         (dTOrNil notNil) ifTrue:[
   249 	    ign ignoreEndTime:(Timestamp now + dTOrNil).
   250             ign ignoreEndTime:(Timestamp now + dTOrNil).
   250 	].
   251         ].
   251 	IgnoredHalts add:ign.
   252         untilShiftKey == true ifTrue:[
       
   253             ign ignoreUntilShiftKeyPressed:true.
       
   254         ].
       
   255         IgnoredHalts add:ign.
   252     ].
   256     ].
   253     Smalltalk changed:#ignoredHalts.
   257     Smalltalk changed:#ignoredHalts.
   254 
   258 
   255     "Modified: / 22-10-2010 / 13:52:02 / cg"
   259     "Created: / 27-01-2012 / 11:33:38 / cg"
   256 !
   260 !
   257 
   261 
   258 isHaltToBeIgnored
   262 isHaltToBeIgnored
   259     |c sender haltingMethod lineNrInHaltingMethod|
   263     |c sender haltingMethod lineNrInHaltingMethod|
   260 
   264 
   315     "Modified: / 27-01-2012 / 11:08:32 / cg"
   319     "Modified: / 27-01-2012 / 11:08:32 / cg"
   316 !
   320 !
   317 
   321 
   318 isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod
   322 isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod
   319     ^ self
   323     ^ self
   320 	isHaltToBeIgnoredIn:haltingMethod
   324         isHaltToBeIgnoredIn:haltingMethod
   321 	atLineNr:lineNrInHaltingMethod
   325         atLineNr:lineNrInHaltingMethod
   322 	modifyEntryCount:false
   326         modifyEntryCount:false
   323 !
   327 !
   324 
   328 
   325 isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod modifyEntryCount:modifyCount
   329 isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod modifyEntryCount:modifyCount
   326     "/ should a halt be ignored ?
   330     "/ should a halt be ignored ?
   327 
   331 
   328     IgnoredHalts isNil ifTrue:[^ false].
   332     IgnoredHalts isNil ifTrue:[^ false].
   329 
   333 
   330     "/ Transcript showCR:'halt/break in ',haltingMethod printString,' at ',lineNrInHaltingMethod printString.
   334     "/ Transcript showCR:'halt/break in ',haltingMethod printString,' at ',lineNrInHaltingMethod printString.
   331     IgnoredHalts do:[:ign |
   335     IgnoredHalts do:[:ign |
   332 	(ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
   336         (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
   333 	    Transcript showCR:'Debugger [info]: halt ignored in ', haltingMethod whoString.
   337             Transcript show:'Debugger [info]: halt ignored in ', haltingMethod whoString.
   334 	    modifyCount ifTrue:[ ign decrementIgnoreCount ].
   338             Transcript show:' ('; show:ign; showCR:')'.
   335 	    ign isHaltIgnored ifFalse:[
   339             modifyCount ifTrue:[ ign decrementIgnoreCount ].
   336 		Transcript showCR:'Debugger [info]: no longer ignore halt in ', haltingMethod whoString.
   340             ign isHaltIgnored ifFalse:[
   337 		IgnoredHalts remove:ign ifAbsent:[].
   341                 Transcript showCR:'Debugger [info]: no longer ignore halt in ', haltingMethod whoString.
   338 	    ].
   342                 IgnoredHalts remove:ign ifAbsent:[].
   339 	    ^ true.
   343             ].
   340 	].
   344             ^ true.
       
   345         ].
   341     ].
   346     ].
   342 
   347 
   343     IgnoredHalts := IgnoredHalts
   348     IgnoredHalts := IgnoredHalts
   344 	select:[:ign |
   349         select:[:ign |
   345 	    ign isActive and:[ (ign isForMethod:haltingMethod line:lineNrInHaltingMethod) not ]
   350             ign isActive and:[ (ign isForMethod:haltingMethod line:lineNrInHaltingMethod) not ]
   346 	].
   351         ].
   347     IgnoredHalts isEmpty ifTrue:[
   352     IgnoredHalts isEmpty ifTrue:[
   348 	IgnoredHalts := nil.
   353         IgnoredHalts := nil.
   349     ].
   354     ].
   350 
   355 
   351     ^ false.
   356     ^ false.
   352 
   357 
   353     "Modified: / 22-10-2010 / 13:51:45 / cg"
   358     "Modified: / 27-01-2012 / 11:41:19 / cg"
   354 !
   359 !
   355 
   360 
   356 removeInactiveIgnores
   361 removeInactiveIgnores
   357     IgnoredHalts notNil ifTrue:[
   362     IgnoredHalts notNil ifTrue:[
   358 	IgnoredHalts := IgnoredHalts select:[:i | i isActive].
   363         IgnoredHalts := IgnoredHalts select:[:i | i isActive].
   359     ].
   364     ].
   360 !
   365 !
   361 
   366 
   362 stopIgnoringHalts
   367 stopIgnoringHalts
   363     "forget about all ignored halts"
   368     "forget about all ignored halts"
   372     "enter a debugger"
   377     "enter a debugger"
   373 
   378 
   374     <context: #return>
   379     <context: #return>
   375 
   380 
   376     ^ self
   381     ^ self
   377 	enter:thisContext sender
   382         enter:thisContext sender
   378 	withMessage:'debugger entered'
   383         withMessage:'debugger entered'
   379 	mayProceed:true.
   384         mayProceed:true.
   380 !
   385 !
   381 
   386 
   382 enter:aContext withMessage:aString
   387 enter:aContext withMessage:aString
   383     "enter a debugger"
   388     "enter a debugger"
   384 
   389 
   385     <context: #return>
   390     <context: #return>
   386 
   391 
   387     ^ self
   392     ^ self
   388 	enter:aContext
   393         enter:aContext
   389 	withMessage:aString
   394         withMessage:aString
   390 	mayProceed:true
   395         mayProceed:true
   391 !
   396 !
   392 
   397 
   393 enter:aContext withMessage:aString mayProceed:mayProceed
   398 enter:aContext withMessage:aString mayProceed:mayProceed
   394     "enter a debugger; if this is a recursive invocation, enter
   399     "enter a debugger; if this is a recursive invocation, enter
   395      a MiniDebugger instead.
   400      a MiniDebugger instead.
   400 
   405 
   401     |active|
   406     |active|
   402 
   407 
   403     StepInterruptPending := nil.
   408     StepInterruptPending := nil.
   404     ControlInterrupt handle:[:ex |
   409     ControlInterrupt handle:[:ex |
   405 	'DebugView [info]: breakpoint in debugger setup ignored [enter.]' infoPrintCR.
   410         'DebugView [info]: breakpoint in debugger setup ignored [enter.]' infoPrintCR.
   406 	('DebugView [info]: breakpoint on:' , ex suspendedContext printString) infoPrintCR.
   411         ('DebugView [info]: breakpoint on:' , ex suspendedContext printString) infoPrintCR.
   407 	ex proceed
   412         ex proceed
   408     ] do:[
   413     ] do:[
   409 	"
   414         "
   410 	 well, it could be a stepping or sending debugger up there;
   415          well, it could be a stepping or sending debugger up there;
   411 	 in this case, return to it. This happens, when a stepping process
   416          in this case, return to it. This happens, when a stepping process
   412 	 runs into an error (for example, a halt). In this case, we want the
   417          runs into an error (for example, a halt). In this case, we want the
   413 	 stepping debugger to come up again instead of a new one.
   418          stepping debugger to come up again instead of a new one.
   414 	"
   419         "
   415 	OpenDebuggers notNil ifTrue:[
   420         OpenDebuggers notNil ifTrue:[
   416 	    active := Processor activeProcess.
   421             active := Processor activeProcess.
   417 	    OpenDebuggers do:[:aDebugger |
   422             OpenDebuggers do:[:aDebugger |
   418 		(aDebugger notNil and:[aDebugger ~~ 0]) ifTrue:[
   423                 (aDebugger notNil and:[aDebugger ~~ 0]) ifTrue:[
   419 		    (aDebugger inspectedProcess == active) ifTrue:[
   424                     (aDebugger inspectedProcess == active) ifTrue:[
   420 			aDebugger device isOpen ifTrue:[
   425                         aDebugger device isOpen ifTrue:[
   421 			    "/ 'entering stepping debugger again' printNL.
   426                             "/ 'entering stepping debugger again' printNL.
   422 			    aDebugger unstep.
   427                             aDebugger unstep.
   423 			    aDebugger setLabelFor:aString in:active.
   428                             aDebugger setLabelFor:aString in:active.
   424 			    aDebugger mayProceed:mayProceed.
   429                             aDebugger mayProceed:mayProceed.
   425 			    ^ aDebugger enter:aContext select:nil.
   430                             ^ aDebugger enter:aContext select:nil.
   426 			]
   431                         ]
   427 		    ]
   432                     ]
   428 		]
   433                 ]
   429 	    ]
   434             ]
   430 	].
   435         ].
   431     ].
   436     ].
   432     ^ self enterUnconditional:aContext withMessage:aString mayProceed:mayProceed
   437     ^ self enterUnconditional:aContext withMessage:aString mayProceed:mayProceed
   433 
   438 
   434     "Modified: / 18.11.2001 / 00:48:03 / cg"
   439     "Modified: / 18.11.2001 / 00:48:03 / cg"
   435 !
   440 !
   439      a MiniDebugger instead.
   444      a MiniDebugger instead.
   440      This is the standard way of entering the debugger;
   445      This is the standard way of entering the debugger;
   441      sent from error- and halt messages."
   446      sent from error- and halt messages."
   442 
   447 
   443     ^ self
   448     ^ self
   444 	enter:ex returnableSuspendedContext
   449         enter:ex returnableSuspendedContext
   445 	withMessage:ex descriptionForDebugger
   450         withMessage:ex descriptionForDebugger
   446 	mayProceed:(ex mayProceed).
   451         mayProceed:(ex mayProceed).
   447 !
   452 !
   448 
   453 
   449 enterUnconditional:aContext withMessage:aString mayProceed:mayProceed
   454 enterUnconditional:aContext withMessage:aString mayProceed:mayProceed
   450     "enter a debugger - do not check for recursive invocation"
   455     "enter a debugger - do not check for recursive invocation"
   451 
   456 
   456     StepInterruptPending := nil.
   461     StepInterruptPending := nil.
   457 
   462 
   458     "/ ignore halts & breakpoints while setting up the debugger
   463     "/ ignore halts & breakpoints while setting up the debugger
   459     "/ to avoid recursive debugging ...
   464     "/ to avoid recursive debugging ...
   460     ControlInterrupt handle:[:ex |
   465     ControlInterrupt handle:[:ex |
   461 	'DebugView [info]: breakpoint in debugger setup ignored [enterUncond.]' infoPrintCR.
   466         'DebugView [info]: breakpoint in debugger setup ignored [enterUncond.]' infoPrintCR.
   462 	('DebugView [info]: breakpoint on:' , ex suspendedContext printString) infoPrintCR.
   467         ('DebugView [info]: breakpoint on:' , ex suspendedContext printString) infoPrintCR.
   463 	ex proceed
   468         ex proceed
   464     ] do:[
   469     ] do:[
   465 	aDebugger := self new.
   470         aDebugger := self new.
   466     ].
   471     ].
   467 
   472 
   468     aDebugger isNil ifTrue:[
   473     aDebugger isNil ifTrue:[
   469 	'DebugView [error]: cannot open debugger' errorPrintCR.
   474         'DebugView [error]: cannot open debugger' errorPrintCR.
   470 	'DebugView [error]: Exception: ' errorPrint. aString errorPrintCR.
   475         'DebugView [error]: Exception: ' errorPrint. aString errorPrintCR.
   471 	mayProceed ifTrue:[
   476         mayProceed ifTrue:[
   472 	    (Dialog confirm:'Error/Breakpoint cought.\\Press Continue or Abort.' withCRs
   477             (Dialog confirm:'Error/Breakpoint cought.\\Press Continue or Abort.' withCRs
   473 		   yesLabel:'Continue' noLabel:'Abort')
   478                    yesLabel:'Continue' noLabel:'Abort')
   474 	    ifTrue:[
   479             ifTrue:[
   475 		^ nil
   480                 ^ nil
   476 	    ].
   481             ].
   477 	] ifFalse:[
   482         ] ifFalse:[
   478 	    self information:'Error cought.\\Press OK to abort the operation.' withCRs.
   483             self information:'Error cought.\\Press OK to abort the operation.' withCRs.
   479 	].
   484         ].
   480 	AbortOperationRequest raise.
   485         AbortOperationRequest raise.
   481 	"not reached"
   486         "not reached"
   482     ].
   487     ].
   483 
   488 
   484     aDebugger mayProceed:mayProceed.
   489     aDebugger mayProceed:mayProceed.
   485     aDebugger setLabelFor:aString in:Processor activeProcess.
   490     aDebugger setLabelFor:aString in:Processor activeProcess.
   486     aDebugger enter:aContext select:nil.
   491     aDebugger enter:aContext select:nil.
   487     ^ nil.
   492     ^ nil.
   488 
   493 
   489     "
   494     "
   490 	nil halt
   495         nil halt
   491     "
   496     "
   492 
   497 
   493     "Modified: / 18.11.2001 / 00:29:23 / cg"
   498     "Modified: / 18.11.2001 / 00:29:23 / cg"
   494 !
   499 !
   495 
   500 
   497     "enter a debugger"
   502     "enter a debugger"
   498 
   503 
   499     <context: #return>
   504     <context: #return>
   500 
   505 
   501     ^ self
   506     ^ self
   502 	enter:(thisContext sender)
   507         enter:(thisContext sender)
   503 	withMessage:message
   508         withMessage:message
   504 	mayProceed:true.
   509         mayProceed:true.
   505 !
   510 !
   506 
   511 
   507 new
   512 new
   508     "return a new DebugView.
   513     "return a new DebugView.
   509      - return a cached debugger if it already exists.
   514      - return a cached debugger if it already exists.
   513     |debugger currentScreen debuggerDevice|
   518     |debugger currentScreen debuggerDevice|
   514 
   519 
   515     currentScreen := Screen current.
   520     currentScreen := Screen current.
   516 
   521 
   517     currentScreen notNil ifTrue:[
   522     currentScreen notNil ifTrue:[
   518 	(currentScreen suppressDebugger) ifTrue:[
   523         (currentScreen suppressDebugger) ifTrue:[
   519 	    "/ no debuggers with that device - show an alertBox which aborts...
   524             "/ no debuggers with that device - show an alertBox which aborts...
   520 	    ^ nil.
   525             ^ nil.
   521 	].
   526         ].
   522 	(currentScreen mayOpenDebugger) ifFalse:[
   527         (currentScreen mayOpenDebugger) ifFalse:[
   523 	    "/ no debugger on that device - but on the main screen
   528             "/ no debugger on that device - but on the main screen
   524 	    currentScreen := Screen default.
   529             currentScreen := Screen default.
   525 	].
   530         ].
   526     ].
   531     ].
   527 
   532 
   528     "
   533     "
   529      need a blocking debugger if no processes or
   534      need a blocking debugger if no processes or
   530      or if its a timing/interrupt process
   535      or if its a timing/interrupt process
   531      (because otherwise we would not get any events here ...
   536      (because otherwise we would not get any events here ...
   532     "
   537     "
   533     Processor activeProcessIsSystemProcess ifTrue:[
   538     Processor activeProcessIsSystemProcess ifTrue:[
   534 	((debugger := CachedExclusive) isNil
   539         ((debugger := CachedExclusive) isNil
   535 	or:[debugger device ~~ currentScreen
   540         or:[debugger device ~~ currentScreen
   536 	or:[currentScreen isNil
   541         or:[currentScreen isNil
   537 	or:[currentScreen isOpen not]]]) ifTrue:[
   542         or:[currentScreen isOpen not]]]) ifTrue:[
   538 	    debugger := self newExclusive
   543             debugger := self newExclusive
   539 	].
   544         ].
   540 	CachedExclusive := nil.
   545         CachedExclusive := nil.
   541     ] ifFalse:[
   546     ] ifFalse:[
   542 	CachedDebugger notNil ifTrue:[
   547         CachedDebugger notNil ifTrue:[
   543 	    (CachedDebugger device ~~ currentScreen
   548             (CachedDebugger device ~~ currentScreen
   544 	    or:[currentScreen isNil
   549             or:[currentScreen isNil
   545 	    or:[currentScreen isOpen not
   550             or:[currentScreen isOpen not
   546 	    or:[CachedDebugger class ~~ self]]]) ifTrue:[
   551             or:[CachedDebugger class ~~ self]]]) ifTrue:[
   547 		CachedDebugger := nil
   552                 CachedDebugger := nil
   548 	    ]
   553             ]
   549 	].
   554         ].
   550 
   555 
   551 	(debugger := CachedDebugger) notNil ifTrue:[
   556         (debugger := CachedDebugger) notNil ifTrue:[
   552 	    CachedDebugger := nil.
   557             CachedDebugger := nil.
   553 	] ifFalse:[
   558         ] ifFalse:[
   554 	    debuggerDevice := currentScreen.
   559             debuggerDevice := currentScreen.
   555 	    debuggerDevice isNil ifTrue:[
   560             debuggerDevice isNil ifTrue:[
   556 		"/ use the default display
   561                 "/ use the default display
   557 		debuggerDevice := Screen default.
   562                 debuggerDevice := Screen default.
   558 	    ].
   563             ].
   559 	    (debuggerDevice isNil
   564             (debuggerDevice isNil
   560 	    or:[debuggerDevice isOpen not
   565             or:[debuggerDevice isOpen not
   561 	    "/ or:[debuggerDevice mayOpenDebugger not]
   566             "/ or:[debuggerDevice mayOpenDebugger not]
   562 	    ]) ifTrue:[
   567             ]) ifTrue:[
   563 		"/ no debugger
   568                 "/ no debugger
   564 		^ nil.
   569                 ^ nil.
   565 	    ].
   570             ].
   566 
   571 
   567 	    Screen currentScreenQuerySignal answer:debuggerDevice
   572             Screen currentScreenQuerySignal answer:debuggerDevice
   568 	    do:[
   573             do:[
   569 		debugger := super new.
   574                 debugger := super new.
   570 	    ].
   575             ].
   571 	    debugger label:'Debugger'.
   576             debugger label:'Debugger'.
   572 	    debugger icon:self defaultIcon.
   577             debugger icon:self defaultIcon.
   573 	]
   578         ]
   574     ].
   579     ].
   575     ^ debugger
   580     ^ debugger
   576 
   581 
   577     "Modified: 31.7.1997 / 21:20:27 / cg"
   582     "Modified: 31.7.1997 / 21:20:27 / cg"
   578 !
   583 !
   598     |aDebugger label nm|
   603     |aDebugger label nm|
   599 
   604 
   600     aDebugger := super new.
   605     aDebugger := super new.
   601     aDebugger icon:self defaultIcon.
   606     aDebugger icon:self defaultIcon.
   602     aProcess notNil ifTrue:[
   607     aProcess notNil ifTrue:[
   603 	nm := aProcess name.
   608         nm := aProcess name.
   604 	nm notNil ifTrue:[
   609         nm notNil ifTrue:[
   605 	    nm := (nm contractTo:17) , '-' , aProcess id printString
   610             nm := (nm contractTo:17) , '-' , aProcess id printString
   606 	] ifFalse:[
   611         ] ifFalse:[
   607 	    nm := aProcess id printString
   612             nm := aProcess id printString
   608 	].
   613         ].
   609 	label := 'Debugger [' , nm , ']'.
   614         label := 'Debugger [' , nm , ']'.
   610     ] ifFalse:[
   615     ] ifFalse:[
   611 	label := 'no process'
   616         label := 'no process'
   612     ].
   617     ].
   613     aDebugger label:label iconLabel:'Debugger'.
   618     aDebugger label:label iconLabel:'Debugger'.
   614     aDebugger openOn:aProcess.
   619     aDebugger openOn:aProcess.
   615     ^ nil
   620     ^ nil
   616 
   621 
   633 
   638 
   634     <resource: #menu>
   639     <resource: #menu>
   635 
   640 
   636     ^
   641     ^
   637      #(Menu
   642      #(Menu
   638 	(
   643         (
   639 	 (MenuItem
   644          (MenuItem
   640 	    label: 'File'
   645             label: 'File'
   641 	    translateLabel: true
   646             translateLabel: true
   642 	    submenu:
   647             submenu:
   643 	   (Menu
   648            (Menu
   644 	      (
   649               (
   645 	       (MenuItem
   650                (MenuItem
   646 		  enabled: canSendEmail
   651                   enabled: canSendEmail
   647 		  label: 'Report a Bug via eMail...'
   652                   label: 'Report a Bug via eMail...'
   648 		  itemValue: doOpenReportMailApp
   653                   itemValue: doOpenReportMailApp
   649 		  translateLabel: true
   654                   translateLabel: true
   650 		)
   655                 )
   651 	       (MenuItem
   656                (MenuItem
   652 		  label: '-'
   657                   label: '-'
   653 		)
   658                 )
   654 	       (MenuItem
   659                (MenuItem
   655 		  label: 'Exit'
   660                   label: 'Exit'
   656 		  itemValue: closeRequest
   661                   itemValue: closeRequest
   657 		  translateLabel: true
   662                   translateLabel: true
   658 		  isVisible: isInspecting
   663                   isVisible: isInspecting
   659 		)
   664                 )
   660 	       (MenuItem
   665                (MenuItem
   661 		  label: 'Close Debugger and Abort'
   666                   label: 'Close Debugger and Abort'
   662 		  itemValue: closeRequest
   667                   itemValue: closeRequest
   663 		  translateLabel: true
   668                   translateLabel: true
   664 		  isVisible: isNotInspecting
   669                   isVisible: isNotInspecting
   665 		)
   670                 )
   666 	       )
   671                )
   667 	      nil
   672               nil
   668 	      nil
   673               nil
   669 	    )
   674             )
   670 	  )
   675           )
   671 	 (MenuItem
   676          (MenuItem
   672 	    label: 'View'
   677             label: 'View'
   673 	    translateLabel: true
   678             translateLabel: true
   674 	    submenu:
   679             submenu:
   675 	   (Menu
   680            (Menu
   676 	      (
   681               (
   677 	       (MenuItem
   682                (MenuItem
   678 		  enabled: canShowMore
   683                   enabled: canShowMore
   679 		  label: 'Show More WalkBack'
   684                   label: 'Show More WalkBack'
   680 		  itemValue: showMore
   685                   itemValue: showMore
   681 		  translateLabel: true
   686                   translateLabel: true
   682 		)
   687                 )
   683 	       (MenuItem
   688                (MenuItem
   684 		  label: 'Show Verbose WalkBack'
   689                   label: 'Show Verbose WalkBack'
   685 		  itemValue: toggleVerboseWalkback
   690                   itemValue: toggleVerboseWalkback
   686 		  translateLabel: true
   691                   translateLabel: true
   687 		  isVisible: showingDenseWalkback
   692                   isVisible: showingDenseWalkback
   688 		)
   693                 )
   689 	       (MenuItem
   694                (MenuItem
   690 		  label: 'Show Dense WalkBack'
   695                   label: 'Show Dense WalkBack'
   691 		  itemValue: toggleVerboseWalkback
   696                   itemValue: toggleVerboseWalkback
   692 		  translateLabel: true
   697                   translateLabel: true
   693 		  isVisible: showingVerboseWalkback
   698                   isVisible: showingVerboseWalkback
   694 		)
   699                 )
   695 	       (MenuItem
   700                (MenuItem
   696 		  label: '-'
   701                   label: '-'
   697 		)
   702                 )
   698 	       (MenuItem
   703                (MenuItem
   699 		  label: 'Raise Debugger when Entering'
   704                   label: 'Raise Debugger when Entering'
   700 		  itemValue: autoRaiseView:
   705                   itemValue: autoRaiseView:
   701 		  translateLabel: true
   706                   translateLabel: true
   702 		  indication: autoRaiseView
   707                   indication: autoRaiseView
   703 		)
   708                 )
   704 	       (MenuItem
   709                (MenuItem
   705 		  label: '-'
   710                   label: '-'
   706 		)
   711                 )
   707 	       (MenuItem
   712                (MenuItem
   708 		  label: 'Settings...'
   713                   label: 'Settings...'
   709 		  itemValue: openSettingsDialog
   714                   itemValue: openSettingsDialog
   710 		  translateLabel: true
   715                   translateLabel: true
   711 		)
   716                 )
   712 	       )
   717                )
   713 	      nil
   718               nil
   714 	      nil
   719               nil
   715 	    )
   720             )
   716 	  )
   721           )
   717 	 (MenuItem
   722          (MenuItem
   718 	    label: 'Process'
   723             label: 'Process'
   719 	    translateLabel: true
   724             translateLabel: true
   720 	    submenu:
   725             submenu:
   721 	   (Menu
   726            (Menu
   722 	      (
   727               (
   723 	       (MenuItem
   728                (MenuItem
   724 		  label: 'Continue'
   729                   label: 'Continue'
   725 		  itemValue: doContinue
   730                   itemValue: doContinue
   726 		  translateLabel: true
   731                   translateLabel: true
   727 		)
   732                 )
   728 	       (MenuItem
   733                (MenuItem
   729 		  label: 'Next (Line-Step)'
   734                   label: 'Next (Line-Step)'
   730 		  itemValue: doNext
   735                   itemValue: doNext
   731 		  translateLabel: true
   736                   translateLabel: true
   732 		)
   737                 )
   733 	       (MenuItem
   738                (MenuItem
   734 		  label: 'Step'
   739                   label: 'Step'
   735 		  itemValue: doStep
   740                   itemValue: doStep
   736 		  translateLabel: true
   741                   translateLabel: true
   737 		)
   742                 )
   738 	       (MenuItem
   743                (MenuItem
   739 		  label: '-'
   744                   label: '-'
   740 		)
   745                 )
   741 	       (MenuItem
   746                (MenuItem
   742 		  label: 'Abort'
   747                   label: 'Abort'
   743 		  itemValue: doAbort
   748                   itemValue: doAbort
   744 		  translateLabel: true
   749                   translateLabel: true
   745 		)
   750                 )
   746 	       (MenuItem
   751                (MenuItem
   747 		  enabled: abortAllIsHandled
   752                   enabled: abortAllIsHandled
   748 		  label: 'Abort All'
   753                   label: 'Abort All'
   749 		  itemValue: doAbortAll
   754                   itemValue: doAbortAll
   750 		  translateLabel: true
   755                   translateLabel: true
   751 		)
   756                 )
   752 	       (MenuItem
   757                (MenuItem
   753 		  label: '-'
   758                   label: '-'
   754 		)
   759                 )
   755 	       (MenuItem
   760                (MenuItem
   756 		  label: 'Terminate'
   761                   label: 'Terminate'
   757 		  itemValue: doTerminate
   762                   itemValue: doTerminate
   758 		  translateLabel: true
   763                   translateLabel: true
   759 		)
   764                 )
   760 	       )
   765                )
   761 	      nil
   766               nil
   762 	      nil
   767               nil
   763 	    )
   768             )
   764 	  )
   769           )
   765 	 (MenuItem
   770          (MenuItem
   766 	    label: 'Context'
   771             label: 'Context'
   767 	    translateLabel: true
   772             translateLabel: true
   768 	    submenu:
   773             submenu:
   769 	   (Menu
   774            (Menu
   770 	      (
   775               (
   771 	       (MenuItem
   776                (MenuItem
   772 		  enabled: canReturn
   777                   enabled: canReturn
   773 		  label: 'Return'
   778                   label: 'Return'
   774 		  itemValue: doReturn
   779                   itemValue: doReturn
   775 		  translateLabel: true
   780                   translateLabel: true
   776 		)
   781                 )
   777 	       (MenuItem
   782                (MenuItem
   778 		  enabled: canRestart
   783                   enabled: canRestart
   779 		  label: 'Restart'
   784                   label: 'Restart'
   780 		  itemValue: doRestart
   785                   itemValue: doRestart
   781 		  translateLabel: true
   786                   translateLabel: true
   782 		)
   787                 )
   783 	       (MenuItem
   788                (MenuItem
   784 		  label: '-'
   789                   label: '-'
   785 		)
   790                 )
   786 	       (MenuItem
   791                (MenuItem
   787 		  enabled: hasContextSelected
   792                   enabled: hasContextSelected
   788 		  label: 'Inspect'
   793                   label: 'Inspect'
   789 		  itemValue: inspectContext
   794                   itemValue: inspectContext
   790 		  translateLabel: true
   795                   translateLabel: true
   791 		)
   796                 )
   792 	       (MenuItem
   797                (MenuItem
   793 		  label: 'Copy WalkBack Text'
   798                   label: 'Copy WalkBack Text'
   794 		  itemValue: copyWalkbackText
   799                   itemValue: copyWalkbackText
   795 		  translateLabel: true
   800                   translateLabel: true
   796 		)
   801                 )
   797 	       (MenuItem
   802                (MenuItem
   798 		  label: 'Bookmark Method in SystemBrowser'
   803                   label: 'Bookmark Method in SystemBrowser'
   799 		  itemValue: addBrowserBookmark
   804                   itemValue: addBrowserBookmark
   800 		  translateLabel: true
   805                   translateLabel: true
   801 		)
   806                 )
   802 	       )
   807                )
   803 	      nil
   808               nil
   804 	      nil
   809               nil
   805 	    )
   810             )
   806 	  )
   811           )
   807 	 (MenuItem
   812          (MenuItem
   808 	    label: 'Class'
   813             label: 'Class'
   809 	    translateLabel: true
   814             translateLabel: true
   810 	    submenu:
   815             submenu:
   811 	   (Menu
   816            (Menu
   812 	      (
   817               (
   813 	       (MenuItem
   818                (MenuItem
   814 		  enabled: canBrowseImplementingClass
   819                   enabled: canBrowseImplementingClass
   815 		  label: 'Browse Implementing Class'
   820                   label: 'Browse Implementing Class'
   816 		  itemValue: browseImplementingClass
   821                   itemValue: browseImplementingClass
   817 		  translateLabel: true
   822                   translateLabel: true
   818 		)
   823                 )
   819 	       (MenuItem
   824                (MenuItem
   820 		  enabled: canBrowseReceiversClass
   825                   enabled: canBrowseReceiversClass
   821 		  label: 'Browse Receivers Class'
   826                   label: 'Browse Receivers Class'
   822 		  itemValue: browseReceiversClass
   827                   itemValue: browseReceiversClass
   823 		  translateLabel: true
   828                   translateLabel: true
   824 		)
   829                 )
   825 	       (MenuItem
   830                (MenuItem
   826 		  label: '-'
   831                   label: '-'
   827 		)
   832                 )
   828 	       (MenuItem
   833                (MenuItem
   829 		  enabled: canBrowseClassHierarchy
   834                   enabled: canBrowseClassHierarchy
   830 		  label: 'Browse Receivers Class Hierarchy'
   835                   label: 'Browse Receivers Class Hierarchy'
   831 		  itemValue: browseClassHierarchy
   836                   itemValue: browseClassHierarchy
   832 		  translateLabel: true
   837                   translateLabel: true
   833 		)
   838                 )
   834 	       (MenuItem
   839                (MenuItem
   835 		  enabled: canBrowseFullClassProtocol
   840                   enabled: canBrowseFullClassProtocol
   836 		  label: 'Browse Receivers Full Protocol'
   841                   label: 'Browse Receivers Full Protocol'
   837 		  itemValue: browseFullClassProtocol
   842                   itemValue: browseFullClassProtocol
   838 		  translateLabel: true
   843                   translateLabel: true
   839 		)
   844                 )
   840 	       (MenuItem
   845                (MenuItem
   841 		  label: '-'
   846                   label: '-'
   842 		)
   847                 )
   843 	       (MenuItem
   848                (MenuItem
   844 		  enabled: canBrowseProcessesApplication
   849                   enabled: canBrowseProcessesApplication
   845 		  label: 'Browse Application Class'
   850                   label: 'Browse Application Class'
   846 		  itemValue: browseProcessesApplication
   851                   itemValue: browseProcessesApplication
   847 		  translateLabel: true
   852                   translateLabel: true
   848 		)
   853                 )
   849 	       )
   854                )
   850 	      nil
   855               nil
   851 	      nil
   856               nil
   852 	    )
   857             )
   853 	  )
   858           )
   854 	 (MenuItem
   859          (MenuItem
   855 	    label: 'Selector'
   860             label: 'Selector'
   856 	    translateLabel: true
   861             translateLabel: true
   857 	    submenu:
   862             submenu:
   858 	   (Menu
   863            (Menu
   859 	      (
   864               (
   860 	       (MenuItem
   865                (MenuItem
   861 		  label: 'Browse Implementors...'
   866                   label: 'Browse Implementors...'
   862 		  itemValue: browseImplementorsOf
   867                   itemValue: browseImplementorsOf
   863 		  translateLabel: true
   868                   translateLabel: true
   864 		)
   869                 )
   865 	       (MenuItem
   870                (MenuItem
   866 		  label: 'Browse Senders...'
   871                   label: 'Browse Senders...'
   867 		  itemValue: browseSendersOf
   872                   itemValue: browseSendersOf
   868 		  translateLabel: true
   873                   translateLabel: true
   869 		)
   874                 )
   870 	       (MenuItem
   875                (MenuItem
   871 		  label: '-'
   876                   label: '-'
   872 		)
   877                 )
   873 	       (MenuItem
   878                (MenuItem
   874 		  enabled: canDefineMethod
   879                   enabled: canDefineMethod
   875 		  label: 'Define Missing Method'
   880                   label: 'Define Missing Method'
   876 		  itemValue: doDefineMethod
   881                   itemValue: doDefineMethod
   877 		  translateLabel: true
   882                   translateLabel: true
   878 		)
   883                 )
   879 	       )
   884                )
   880 	      nil
   885               nil
   881 	      nil
   886               nil
   882 	    )
   887             )
   883 	  )
   888           )
   884 	 (MenuItem
   889          (MenuItem
   885 	    label: 'Breakpoint'
   890             label: 'Breakpoint'
   886 	    translateLabel: true
   891             translateLabel: true
   887 	    submenu:
   892             submenu:
   888 	   (Menu
   893            (Menu
   889 	      (
   894               (
   890 	       (MenuItem
   895                (MenuItem
   891 		  enabled: canRemoveBreakpoint
   896                   enabled: canRemoveBreakpoint
   892 		  label: 'Remove Breakpoint'
   897                   label: 'Remove Breakpoint'
   893 		  itemValue: removeBreakpoint
   898                   itemValue: removeBreakpoint
   894 		  translateLabel: true
   899                   translateLabel: true
   895 		)
   900                 )
   896 	       (MenuItem
   901                (MenuItem
   897 		  label: 'Remove all Breakpoints'
   902                   label: 'Remove all Breakpoints'
   898 		  itemValue: removeAllBreakpoints
   903                   itemValue: removeAllBreakpoints
   899 		  translateLabel: true
   904                   translateLabel: true
   900 		)
   905                 )
   901 	       (MenuItem
   906                (MenuItem
   902 		  label: '-'
   907                   label: '-'
   903 		)
   908                 )
   904 	       (MenuItem
   909                (MenuItem
   905 		  enabled: canAddBreakpoint
   910                   enabled: canAddBreakpoint
   906 		  label: 'Add Breakpoint'
   911                   label: 'Add Breakpoint'
   907 		  itemValue: addBreakpoint
   912                   itemValue: addBreakpoint
   908 		  translateLabel: true
   913                   translateLabel: true
   909 		)
   914                 )
   910 	       (MenuItem
   915                (MenuItem
   911 		  label: '-'
   916                   label: '-'
   912 		)
   917                 )
   913 	       (MenuItem
   918                (MenuItem
   914 		  label: 'Ignore this Halt/BreakPoint'
   919                   label: 'Ignore this Halt/BreakPoint'
   915 		  translateLabel: true
   920                   translateLabel: true
   916 		  submenu:
   921                   submenu:
   917 		 (Menu
   922                  (Menu
   918 		    (
   923                     (
   919 		     (MenuItem
   924                      (MenuItem
   920 			enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
   925                         enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
   921 			label: 'For Some Time...'
   926                         label: 'For Some Time...'
   922 			itemValue: openIgnoreHaltUntilTimeElapsedDialog
   927                         itemValue: openIgnoreHaltUntilTimeElapsedDialog
   923 			translateLabel: true
   928                         translateLabel: true
   924 		      )
   929                       )
   925 		     (MenuItem
   930                      (MenuItem
   926 			enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
   931                         enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
   927 			label: 'For the Next N Times...'
   932                         label: 'For the Next N Times...'
   928 			itemValue: openIgnoreHaltNTimesDialog
   933                         itemValue: openIgnoreHaltNTimesDialog
   929 			translateLabel: true
   934                         translateLabel: true
   930 		      )
   935                       )
   931 		     (MenuItem
   936                      (MenuItem
   932 			enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
   937                         label: 'Until Shift-Key is Pressed'
   933 			label: 'Forever (Until Ignoring is Stopped)'
   938                         itemValue: ignoreHaltUntilShiftKeyIsPressed
   934 			itemValue: ignoreHaltForever
   939                         translateLabel: true
   935 			translateLabel: true
   940                       )
   936 		      )
   941                      (MenuItem
   937 		     )
   942                         enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
   938 		    nil
   943                         label: 'Forever (Until Ignoring is Stopped)'
   939 		    nil
   944                         itemValue: ignoreHaltForever
   940 		  )
   945                         translateLabel: true
   941 		)
   946                       )
   942 	       (MenuItem
   947                      )
   943 		  label: 'Ignore all Halts/BreakPoints'
   948                     nil
   944 		  translateLabel: true
   949                     nil
   945 		  submenu:
   950                   )
   946 		 (Menu
   951                 )
   947 		    (
   952                (MenuItem
   948 		     (MenuItem
   953                   label: 'Ignore all Halts/BreakPoints'
   949 			label: 'For Some Time...'
   954                   translateLabel: true
   950 			itemValue: openIgnoreAllHaltsUntilTimeElapsedDialog
   955                   submenu:
   951 			translateLabel: true
   956                  (Menu
   952 		      )
   957                     (
   953 		     (MenuItem
   958                      (MenuItem
   954 			label: 'Forever (Until Ignoring is Stopped)'
   959                         label: 'For Some Time...'
   955 			itemValue: ignoreAllHaltsForever
   960                         itemValue: openIgnoreAllHaltsUntilTimeElapsedDialog
   956 			translateLabel: true
   961                         translateLabel: true
   957 		      )
   962                       )
   958 		     )
   963                      (MenuItem
   959 		    nil
   964                         label: 'Until Shift-Key is Pressed'
   960 		    nil
   965                         itemValue: ignoreAllHaltsUntilShiftKeyIsPressed
   961 		  )
   966                         translateLabel: true
   962 		)
   967                       )
   963 	       (MenuItem
   968                      (MenuItem
   964 		  enabled: hasHaltsToIgnore
   969                         label: 'Forever (Until Ignoring is Stopped)'
   965 		  label: 'Stop Ignoring'
   970                         itemValue: ignoreAllHaltsForever
   966 		  itemValue: stopIgnoringHalts
   971                         translateLabel: true
   967 		  translateLabel: true
   972                       )
   968 		)
   973                      )
   969 	       (MenuItem
   974                     nil
   970 		  label: '-'
   975                     nil
   971 		)
   976                   )
   972 	       (MenuItem
   977                 )
   973 		  label: 'Manage Breakpoints'
   978                (MenuItem
   974 		  itemValue: openBreakPointBrowser
   979                   enabled: hasHaltsToIgnore
   975 		  translateLabel: true
   980                   label: 'Stop Ignoring'
   976 		)
   981                   itemValue: stopIgnoringHalts
   977 	       (MenuItem
   982                   translateLabel: true
   978 		  label: 'Allow Breakpoints in Debugger'
   983                 )
   979 		  itemValue: allowBreakPointsInDebugger:
   984                (MenuItem
   980 		  translateLabel: true
   985                   label: '-'
   981 		  indication: allowBreakPointsInDebugger
   986                 )
   982 		)
   987                (MenuItem
   983 	       )
   988                   label: 'Manage Breakpoints'
   984 	      nil
   989                   itemValue: openBreakPointBrowser
   985 	      nil
   990                   translateLabel: true
   986 	    )
   991                 )
   987 	  )
   992                (MenuItem
   988 	 (MenuItem
   993                   label: 'Allow Breakpoints in Debugger'
   989 	    label: 'Help'
   994                   itemValue: allowBreakPointsInDebugger:
   990 	    translateLabel: true
   995                   translateLabel: true
   991 	    startGroup: right
   996                   indication: allowBreakPointsInDebugger
   992 	    submenu:
   997                 )
   993 	   (Menu
   998                )
   994 	      (
   999               nil
   995 	       (MenuItem
  1000               nil
   996 		  label: 'Debuggers Documentation'
  1001             )
   997 		  itemValue: openHTMLDocument:
  1002           )
   998 		  translateLabel: true
  1003          (MenuItem
   999 		  argument: 'tools/debugger/TOP.html'
  1004             label: 'Help'
  1000 		)
  1005             translateLabel: true
  1001 	       (MenuItem
  1006             startGroup: right
  1002 		  label: '-'
  1007             submenu:
  1003 		)
  1008            (Menu
  1004 	       (MenuItem
  1009               (
  1005 		  label: 'About DebugView...'
  1010                (MenuItem
  1006 		  itemValue: openAboutThisApplication
  1011                   label: 'Debuggers Documentation'
  1007 		  translateLabel: true
  1012                   itemValue: openHTMLDocument:
  1008 		)
  1013                   translateLabel: true
  1009 	       )
  1014                   argument: 'tools/debugger/TOP.html'
  1010 	      nil
  1015                 )
  1011 	      nil
  1016                (MenuItem
  1012 	    )
  1017                   label: '-'
  1013 	  )
  1018                 )
  1014 	 )
  1019                (MenuItem
  1015 	nil
  1020                   label: 'About DebugView...'
  1016 	nil
  1021                   itemValue: openAboutThisApplication
       
  1022                   translateLabel: true
       
  1023                 )
       
  1024                )
       
  1025               nil
       
  1026               nil
       
  1027             )
       
  1028           )
       
  1029          )
       
  1030         nil
       
  1031         nil
  1017       )
  1032       )
       
  1033 
       
  1034     "Modified: / 27-01-2012 / 11:29:45 / cg"
  1018 ! !
  1035 ! !
  1019 
  1036 
  1020 !DebugView class methodsFor:'misc'!
  1037 !DebugView class methodsFor:'misc'!
  1021 
  1038 
  1022 interestingContextFrom:aContext
  1039 interestingContextFrom:aContext
  1030 
  1047 
  1031     someContexts := Array new:25.
  1048     someContexts := Array new:25.
  1032     con := aContext.
  1049     con := aContext.
  1033     idx := 1.
  1050     idx := 1.
  1034     [(idx <= someContexts size) and:[con notNil]] whileTrue:[
  1051     [(idx <= someContexts size) and:[con notNil]] whileTrue:[
  1035 	someContexts at:idx put:con.
  1052         someContexts at:idx put:con.
  1036 	con := con sender.
  1053         con := con sender.
  1037 	idx := idx + 1.
  1054         idx := idx + 1.
  1038     ].
  1055     ].
  1039     idx := self interestingContextIndexIn:someContexts.
  1056     idx := self interestingContextIndexIn:someContexts.
  1040     ^ someContexts at:idx.
  1057     ^ someContexts at:idx.
  1041 !
  1058 !
  1042 
  1059 
  1282 enableDisableActions
  1299 enableDisableActions
  1283     |m|
  1300     |m|
  1284 
  1301 
  1285     m := contextView middleButtonMenu.
  1302     m := contextView middleButtonMenu.
  1286     m notNil ifTrue:[
  1303     m notNil ifTrue:[
  1287 	self updateMenuItems.
  1304         self updateMenuItems.
  1288 
  1305 
  1289 	(inspecting or:[AbortOperationRequest isHandled]) ifTrue:[
  1306         (inspecting or:[AbortOperationRequest isHandled]) ifTrue:[
  1290 	    abortButton enable.
  1307             abortButton enable.
  1291 	    m enable:#doAbort.
  1308             m enable:#doAbort.
  1292 	] ifFalse:[
  1309         ] ifFalse:[
  1293 	    abortButton disable.
  1310             abortButton disable.
  1294 	    m disable:#doAbort.
  1311             m disable:#doAbort.
  1295 	].
  1312         ].
  1296 	exclusive ifTrue:[
  1313         exclusive ifTrue:[
  1297 	    terminateButton disable.
  1314             terminateButton disable.
  1298 	    m disable:#doTerminate.
  1315             m disable:#doTerminate.
  1299 	] ifFalse:[
  1316         ] ifFalse:[
  1300 	    terminateButton enable.
  1317             terminateButton enable.
  1301 	    m enable:#doTerminate.
  1318             m enable:#doTerminate.
  1302 	]
  1319         ]
  1303     ].
  1320     ].
  1304 
  1321 
  1305     mayProceed == false ifTrue:[
  1322     mayProceed == false ifTrue:[
  1306 	continueButton disable.
  1323         continueButton disable.
  1307 	m notNil ifTrue:[m disable:#doContinue].
  1324         m notNil ifTrue:[m disable:#doContinue].
  1308     ] ifFalse:[
  1325     ] ifFalse:[
  1309 	continueButton enable.
  1326         continueButton enable.
  1310 	m notNil ifTrue:[m enable:#doContinue]
  1327         m notNil ifTrue:[m enable:#doContinue]
  1311     ].
  1328     ].
  1312 
  1329 
  1313     "Created: / 16.11.2001 / 17:40:51 / cg"
  1330     "Created: / 16.11.2001 / 17:40:51 / cg"
  1314 !
  1331 !
  1315 
  1332 
  1320     <context: #return>
  1337     <context: #return>
  1321 
  1338 
  1322     |con m enteredByInterrupt sel iAmNew foundNoByteCodeContext foundExitContext c|
  1339     |con m enteredByInterrupt sel iAmNew foundNoByteCodeContext foundExitContext c|
  1323 
  1340 
  1324     DebuggingDebugger == true ifTrue:[
  1341     DebuggingDebugger == true ifTrue:[
  1325 	'==> enter: (' print. aContext print.
  1342         '==> enter: (' print. aContext print.
  1326 	') select: ' print. initialSelectionOrNil printCR.
  1343         ') select: ' print. initialSelectionOrNil printCR.
  1327     ].
  1344     ].
  1328     thisContext isRecursive ifTrue:[
  1345     thisContext isRecursive ifTrue:[
  1329 	"/ care for the special case, were the Debugger was autoloaded.
  1346         "/ care for the special case, were the Debugger was autoloaded.
  1330 	"/ in this case, thisContext IS recursive, but thats no error
  1347         "/ in this case, thisContext IS recursive, but thats no error
  1331 	"/ condition.
  1348         "/ condition.
  1332 	foundNoByteCodeContext := false.
  1349         foundNoByteCodeContext := false.
  1333 	foundExitContext := false.
  1350         foundExitContext := false.
  1334 
  1351 
  1335 	c := thisContext findNextContextWithSelector:#enter:withMessage:mayProceed: or:#noByteCode or:#exit_unwindThenDo:.
  1352         c := thisContext findNextContextWithSelector:#enter:withMessage:mayProceed: or:#noByteCode or:#exit_unwindThenDo:.
  1336 	[
  1353         [
  1337 	 foundNoByteCodeContext not
  1354          foundNoByteCodeContext not
  1338 	 and:[ foundExitContext not
  1355          and:[ foundExitContext not
  1339 	 and:[c notNil
  1356          and:[c notNil
  1340 	 and:[c selector ~~ #enter:withMessage:mayProceed:
  1357          and:[c selector ~~ #enter:withMessage:mayProceed:
  1341 	]]]]
  1358         ]]]]
  1342 	whileTrue:[
  1359         whileTrue:[
  1343 	    c selector == #exit_unwindThenDo: ifTrue:[
  1360             c selector == #exit_unwindThenDo: ifTrue:[
  1344 		foundExitContext := true
  1361                 foundExitContext := true
  1345 	    ].
  1362             ].
  1346 	    c selector == #noByteCode ifTrue:[
  1363             c selector == #noByteCode ifTrue:[
  1347 		foundNoByteCodeContext := true
  1364                 foundNoByteCodeContext := true
  1348 	    ].
  1365             ].
  1349 	    c := c findNextContextWithSelector:#enter:withMessage:mayProceed: or:#noByteCode or:#exit_unwindThenDo:.
  1366             c := c findNextContextWithSelector:#enter:withMessage:mayProceed: or:#noByteCode or:#exit_unwindThenDo:.
  1350 	].
  1367         ].
  1351 
  1368 
  1352 	(foundNoByteCodeContext not
  1369         (foundNoByteCodeContext not
  1353 	and:[ foundExitContext not]) ifFalse:[
  1370         and:[ foundExitContext not]) ifFalse:[
  1354 	    ('DebugView [warning]: reentered') errorPrintCR.
  1371             ('DebugView [warning]: reentered') errorPrintCR.
  1355 
  1372 
  1356 	    ^ MiniDebugger
  1373             ^ MiniDebugger
  1357 		enter:aContext
  1374                 enter:aContext
  1358 		withMessage:'DebugView [error]: recursive error (in debugger)'
  1375                 withMessage:'DebugView [error]: recursive error (in debugger)'
  1359 		mayProceed:mayProceed.
  1376                 mayProceed:mayProceed.
  1360 	].
  1377         ].
  1361 	foundExitContext ifTrue:[
  1378         foundExitContext ifTrue:[
  1362 	    'DebugView [error]: recursive error (in debugger) ignored' printCR.
  1379             'DebugView [error]: recursive error (in debugger) ignored' printCR.
  1363 	    ^ self.
  1380             ^ self.
  1364 	].
  1381         ].
  1365     ].
  1382     ].
  1366 
  1383 
  1367     "/'entering: ' print. aContext printCR.
  1384     "/'entering: ' print. aContext printCR.
  1368     "/'initial: ' print. initialSelectionOrNil printCR.
  1385     "/'initial: ' print. initialSelectionOrNil printCR.
  1369     thisContext sender fixAllLineNumbers. "/ _CONTEXTLINENOS(s)
  1386     thisContext sender fixAllLineNumbers. "/ _CONTEXTLINENOS(s)
  1370 
  1387 
  1371     self class isHaltToBeIgnored ifTrue:[
  1388     self class isHaltToBeIgnored ifTrue:[
  1372 	^ self.
  1389         ^ self.
  1373     ].
  1390     ].
  1374 
  1391 
  1375     iAmNew := drawableId isNil.
  1392     iAmNew := drawableId isNil.
  1376 
  1393 
  1377     verboseBacktrace := UserPreferences current verboseBacktraceInDebugger.
  1394     verboseBacktrace := UserPreferences current verboseBacktraceInDebugger.
  1390     "/ On a multiUser system, ungrab all of them ...
  1407     "/ On a multiUser system, ungrab all of them ...
  1391     "/ Q: this is good for multi-screen apps (where an error should not happen),
  1408     "/ Q: this is good for multi-screen apps (where an error should not happen),
  1392     "/    but not for multi-user development, where the debugger is entered often.
  1409     "/    but not for multi-user development, where the debugger is entered often.
  1393     "/    What is a good solution to this dilemma ?
  1410     "/    What is a good solution to this dilemma ?
  1394     Screen allScreens do:[:aScreen |
  1411     Screen allScreens do:[:aScreen |
  1395 	aScreen ungrabPointer.
  1412         aScreen ungrabPointer.
  1396 	aScreen ungrabKeyboard.
  1413         aScreen ungrabKeyboard.
  1397     ].
  1414     ].
  1398 
  1415 
  1399     ("inspectedProcess suspendedContext isNil
  1416     ("inspectedProcess suspendedContext isNil
  1400     or:["inspectedProcess isSystemProcess"]") ifTrue:[
  1417     or:["inspectedProcess isSystemProcess"]") ifTrue:[
  1401 	terminateButton disable.
  1418         terminateButton disable.
  1402     ] ifFalse:[
  1419     ] ifFalse:[
  1403 	terminateButton enable.
  1420         terminateButton enable.
  1404 	abortButton enable.
  1421         abortButton enable.
  1405     ].
  1422     ].
  1406 
  1423 
  1407     iAmNew ifFalse:[
  1424     iAmNew ifFalse:[
  1408 	"/ not the first time - disable buttons & menus
  1425         "/ not the first time - disable buttons & menus
  1409 	"/ from the previous life
  1426         "/ from the previous life
  1410 	self turnOffAllButtons.
  1427         self turnOffAllButtons.
  1411 
  1428 
  1412 	m := contextView middleButtonMenu.
  1429         m := contextView middleButtonMenu.
  1413 	m notNil ifTrue:[
  1430         m notNil ifTrue:[
  1414 	    m disableAll:#(showMore "skip skipForReturn" inspectContext).
  1431             m disableAll:#(showMore "skip skipForReturn" inspectContext).
  1415 	].
  1432         ].
  1416 	verboseBacktrace
  1433         verboseBacktrace
  1417 	    ifTrue:[self showVerboseWalkback]
  1434             ifTrue:[self showVerboseWalkback]
  1418 	    ifFalse:[self showDenseWalkback].
  1435             ifFalse:[self showDenseWalkback].
  1419     ].
  1436     ].
  1420     self iconLabel:'Debugger'.
  1437     self iconLabel:'Debugger'.
  1421 
  1438 
  1422     windowGroup isNil ifTrue:[
  1439     windowGroup isNil ifTrue:[
  1423 	self windowGroup: WindowGroup new.
  1440         self windowGroup: WindowGroup new.
  1424 	windowGroup addTopView:self.
  1441         windowGroup addTopView:self.
  1425     ].
  1442     ].
  1426     exclusive ifFalse:[
  1443     exclusive ifFalse:[
  1427 	"/ create a (modal) windowGroup for myself
  1444         "/ create a (modal) windowGroup for myself
  1428 
  1445 
  1429 	windowGroup setModal:true.
  1446         windowGroup setModal:true.
  1430     ] ifTrue:[
  1447     ] ifTrue:[
  1431 	"/ create a windowGroup with a synchronous sensor for me
  1448         "/ create a windowGroup with a synchronous sensor for me
  1432 
  1449 
  1433 	windowGroup beSynchronous.
  1450         windowGroup beSynchronous.
  1434     ].
  1451     ].
  1435     windowGroup setProcess:Processor activeProcess.
  1452     windowGroup setProcess:Processor activeProcess.
  1436     "
  1453     "
  1437      get the walkback list; clear inspectors if we did not come here by single stepping)
  1454      get the walkback list; clear inspectors if we did not come here by single stepping)
  1438     "
  1455     "
  1448      Otherwise, its probably better to do a map, which shows the
  1465      Otherwise, its probably better to do a map, which shows the
  1449      view at the previous position, without a need for the user to set the
  1466      view at the previous position, without a need for the user to set the
  1450      position again
  1467      position again
  1451     "
  1468     "
  1452     iAmNew ifFalse:[
  1469     iAmNew ifFalse:[
  1453 	self remap.
  1470         self remap.
  1454     ] ifTrue:[
  1471     ] ifTrue:[
  1455 	self realize.
  1472         self realize.
  1456     ].
  1473     ].
  1457     self setForegroundWindow.
  1474     self setForegroundWindow.
  1458 
  1475 
  1459     exclusive ifTrue:[
  1476     exclusive ifTrue:[
  1460 	self showError:'
  1477         self showError:'
  1461 Debugging system process `' , (inspectedProcess nameOrId) printString , '''.
  1478 Debugging system process `' , (inspectedProcess nameOrId) printString , '''.
  1462 
  1479 
  1463 This is a modal debugger - all event processing is stopped..
  1480 This is a modal debugger - all event processing is stopped..
  1464 Therefore, you cannot interact with other views or
  1481 Therefore, you cannot interact with other views or
  1465 open any other tools while this debugger is active.
  1482 open any other tools while this debugger is active.
  1466 
  1483 
  1467 Also, there is no event processing (redraw) for other views.'
  1484 Also, there is no event processing (redraw) for other views.'
  1468     ].
  1485     ].
  1469 
  1486 
  1470     self autoRaiseView ifTrue:[
  1487     self autoRaiseView ifTrue:[
  1471 	"/ self raise.
  1488         "/ self raise.
  1472 	self raiseDeiconified.
  1489         self raiseDeiconified.
  1473 	self topView activate; setForegroundWindow; activate.
  1490         self topView activate; setForegroundWindow; activate.
  1474     ].
  1491     ].
  1475 
  1492 
  1476     canContinue := true.
  1493     canContinue := true.
  1477     exitAction := nil.
  1494     exitAction := nil.
  1478 
  1495 
  1479     "/ enter private event handling loop. This is left (and we come back here again)
  1496     "/ enter private event handling loop. This is left (and we come back here again)
  1480     "/ when any button was pressed which requires continuation of the debuggee or
  1497     "/ when any button was pressed which requires continuation of the debuggee or
  1481     "/ closedown of the debugger.
  1498     "/ closedown of the debugger.
  1482     [self controlLoop] ifCurtailed:[
  1499     [self controlLoop] ifCurtailed:[
  1483 	windowGroup notNil ifTrue:[
  1500         windowGroup notNil ifTrue:[
  1484 	    windowGroup setProcess:nil.
  1501             windowGroup setProcess:nil.
  1485 	].
  1502         ].
  1486 	self destroy
  1503         self destroy
  1487     ].
  1504     ].
  1488 
  1505 
  1489     "/ here after my own control loop is finished.
  1506     "/ here after my own control loop is finished.
  1490 
  1507 
  1491     "/ release all context stuff.
  1508     "/ release all context stuff.
  1495 
  1512 
  1496     codeView acceptAction:nil.
  1513     codeView acceptAction:nil.
  1497     codeView doItAction:nil.
  1514     codeView doItAction:nil.
  1498 
  1515 
  1499     ObjectMemory stepInterruptHandler == self ifTrue:[
  1516     ObjectMemory stepInterruptHandler == self ifTrue:[
  1500 	ObjectMemory stepInterruptHandler:nil.
  1517         ObjectMemory stepInterruptHandler:nil.
  1501     ].
  1518     ].
  1502 
  1519 
  1503     (exitAction ~~ #step) ifTrue:[
  1520     (exitAction ~~ #step) ifTrue:[
  1504 	"/ not stepping - close window
  1521         "/ not stepping - close window
  1505 	lastSelectionInReceiverInspector := receiverInspector selectedKeyName.
  1522         lastSelectionInReceiverInspector := receiverInspector selectedKeyName.
  1506 	lastSelectionInContextInspector := contextInspector selectedKeyName.
  1523         lastSelectionInContextInspector := contextInspector selectedKeyName.
  1507 	receiverInspector release.
  1524         receiverInspector release.
  1508 	contextInspector release.
  1525         contextInspector release.
  1509 
  1526 
  1510 	self unmap.
  1527         self unmap.
  1511 	device flush.
  1528         device flush.
  1512 
  1529 
  1513 	(exitAction == #abort) ifTrue:[ self exit_abort. "does not return" ].
  1530         (exitAction == #abort) ifTrue:[ self exit_abort. "does not return" ].
  1514 	(exitAction == #abortAll) ifTrue:[ self exit_abortAll. "does not return" ].
  1531         (exitAction == #abortAll) ifTrue:[ self exit_abortAll. "does not return" ].
  1515 	(exitAction == #return) ifTrue:[ self exit_return. "does not return" ].
  1532         (exitAction == #return) ifTrue:[ self exit_return. "does not return" ].
  1516 	(exitAction == #restart) ifTrue:[ self exit_restart. "does not return" ].
  1533         (exitAction == #restart) ifTrue:[ self exit_restart. "does not return" ].
  1517 	(exitAction == #quickTerminate) ifTrue:[ self exit_quickTerminate. "does not return" ].
  1534         (exitAction == #quickTerminate) ifTrue:[ self exit_quickTerminate. "does not return" ].
  1518 	(exitAction == #terminate) ifTrue:[ self exit_terminate. "does not return" ].
  1535         (exitAction == #terminate) ifTrue:[ self exit_terminate. "does not return" ].
  1519 	exitAction isBlock ifTrue:[
  1536         exitAction isBlock ifTrue:[
  1520 	    self exit_unwindThenDo:exitAction.
  1537             self exit_unwindThenDo:exitAction.
  1521 	    "does not return"
  1538             "does not return"
  1522 	].
  1539         ].
  1523 	"not reached"
  1540         "not reached"
  1524 	^ self
  1541         ^ self
  1525     ].
  1542     ].
  1526 
  1543 
  1527     "/ stepping - window stays open
  1544     "/ stepping - window stays open
  1528     selectedContext := actualContext := firstContext := nil.
  1545     selectedContext := actualContext := firstContext := nil.
  1529 
  1546 
  1530     "/ restore the previous pointer grab
  1547     "/ restore the previous pointer grab
  1531     grabber notNil ifTrue:[
  1548     grabber notNil ifTrue:[
  1532 	device grabPointerInView:grabber.
  1549         device grabPointerInView:grabber.
  1533 	grabber := nil.
  1550         grabber := nil.
  1534     ].
  1551     ].
  1535 
  1552 
  1536     (exitAction == #step) ifTrue:[
  1553     (exitAction == #step) ifTrue:[
  1537 	"
  1554         "
  1538 	 schedule another stepInterrupt
  1555          schedule another stepInterrupt
  1539 	 - must enter myself into the collection of open debuggers,
  1556          - must enter myself into the collection of open debuggers,
  1540 	   in case the stepping process comes back again via a halt or signal
  1557            in case the stepping process comes back again via a halt or signal
  1541 	   before the step is finished. In this case, the stepping debugger should
  1558            before the step is finished. In this case, the stepping debugger should
  1542 	   come up (instead of a new one)
  1559            come up (instead of a new one)
  1543 	 - must flush caches since optimized methods not always
  1560          - must flush caches since optimized methods not always
  1544 	   look for pending interrupts
  1561            look for pending interrupts
  1545 	"
  1562         "
  1546 
  1563 
  1547 	"/
  1564         "/
  1548 	"/ also must care for stepping into a return
  1565         "/ also must care for stepping into a return
  1549 	"/
  1566         "/
  1550 	steppedContext notNil ifTrue:[
  1567         steppedContext notNil ifTrue:[
  1551 	    Processor activeProcess forceInterruptOnReturnOf:steppedContext.
  1568             Processor activeProcess forceInterruptOnReturnOf:steppedContext.
  1552 	].
  1569         ].
  1553 
  1570 
  1554 	OpenDebuggers isNil ifTrue:[
  1571         OpenDebuggers isNil ifTrue:[
  1555 	    OpenDebuggers := WeakIdentitySet new.
  1572             OpenDebuggers := WeakIdentitySet new.
  1556 	].
  1573         ].
  1557 	OpenDebuggers add:self.
  1574         OpenDebuggers add:self.
  1558 
  1575 
  1559 	self label:'single stepping - please wait ...'.
  1576         self label:'single stepping - please wait ...'.
  1560 	stepping := true.
  1577         stepping := true.
  1561 
  1578 
  1562 	ObjectMemory stepInterruptHandler:self.
  1579         ObjectMemory stepInterruptHandler:self.
  1563 	Processor activeProcess stepInterruptHandler:self.
  1580         Processor activeProcess stepInterruptHandler:self.
  1564 	ObjectMemory flushCaches.
  1581         ObjectMemory flushCaches.
  1565 
  1582 
  1566 	Context singleStepInterruptRequest isHandled ifTrue:[
  1583         Context singleStepInterruptRequest isHandled ifTrue:[
  1567 	    Context singleStepInterruptRequest
  1584             Context singleStepInterruptRequest
  1568 		raiseWith:
  1585                 raiseWith:
  1569 		    (("bigStep" steppedContextLineno notNil)
  1586                     (("bigStep" steppedContextLineno notNil)
  1570 			ifTrue:[#next]
  1587                         ifTrue:[#next]
  1571 			ifFalse:[#step])
  1588                         ifFalse:[#step])
  1572 	] ifFalse:[
  1589         ] ifFalse:[
  1573 	    "/ see if we came here through an interrupt-action
  1590             "/ see if we came here through an interrupt-action
  1574 	    "/ (i.e. aProcess interruptWith:...)
  1591             "/ (i.e. aProcess interruptWith:...)
  1575 
  1592 
  1576 	    enteredByInterrupt := false.
  1593             enteredByInterrupt := false.
  1577 	    con := thisContext findNextContextWithSelector:#timerInterrupt or:#ioInterrupt or:nil.
  1594             con := thisContext findNextContextWithSelector:#timerInterrupt or:#ioInterrupt or:nil.
  1578 	    [enteredByInterrupt not
  1595             [enteredByInterrupt not
  1579 	     and:[con notNil
  1596              and:[con notNil
  1580 	     and:[con ~~ aContext]]] whileTrue:[
  1597              and:[con ~~ aContext]]] whileTrue:[
  1581 		((sel := con selector) == #timerInterrupt
  1598                 ((sel := con selector) == #timerInterrupt
  1582 		or:[sel == #ioInterrupt]) ifTrue:[
  1599                 or:[sel == #ioInterrupt]) ifTrue:[
  1583 		    enteredByInterrupt := true.
  1600                     enteredByInterrupt := true.
  1584 		] ifFalse:[
  1601                 ] ifFalse:[
  1585 		    con := con findNextContextWithSelector:#timerInterrupt or:#ioInterrupt or:nil.
  1602                     con := con findNextContextWithSelector:#timerInterrupt or:#ioInterrupt or:nil.
  1586 		].
  1603                 ].
  1587 	    ].
  1604             ].
  1588 
  1605 
  1589 	    ObjectMemory flushInlineCaches.
  1606             ObjectMemory flushInlineCaches.
  1590 
  1607 
  1591 	    DebuggingDebugger == true ifTrue:[
  1608             DebuggingDebugger == true ifTrue:[
  1592 		enteredByInterrupt printCR.
  1609                 enteredByInterrupt printCR.
  1593 	    ].
  1610             ].
  1594 	    enteredByInterrupt ifTrue:[
  1611             enteredByInterrupt ifTrue:[
  1595 		"/ dont want to step through all intermediate
  1612                 "/ dont want to step through all intermediate
  1596 		"/ (scheduler-) contexts; place a return-trap on the
  1613                 "/ (scheduler-) contexts; place a return-trap on the
  1597 		"/ one right below the interesting one
  1614                 "/ one right below the interesting one
  1598 
  1615 
  1599 "/                'special unwind return' printCR.
  1616 "/                'special unwind return' printCR.
  1600 		con unwindThenDo:[
  1617                 con unwindThenDo:[
  1601 				  Processor activeProcess stepInterruptHandler:self.
  1618                                   Processor activeProcess stepInterruptHandler:self.
  1602 				  ObjectMemory stepInterruptHandler:self.
  1619                                   ObjectMemory stepInterruptHandler:self.
  1603 				  InStepInterrupt := nil.
  1620                                   InStepInterrupt := nil.
  1604 				  StepInterruptPending := 1.
  1621                                   StepInterruptPending := 1.
  1605 				  InterruptPending := 1].
  1622                                   InterruptPending := 1].
  1606 	    ] ifFalse:[
  1623             ] ifFalse:[
  1607 "/                'normal step return' printCR.
  1624 "/                'normal step return' printCR.
  1608 		skipLineNr ~~ #return ifTrue:[
  1625                 skipLineNr ~~ #return ifTrue:[
  1609 		    StepInterruptPending := 1.
  1626                     StepInterruptPending := 1.
  1610 		    InterruptPending := 1.
  1627                     InterruptPending := 1.
  1611 		] ifFalse:[
  1628                 ] ifFalse:[
  1612 "/                    'step for return' printCR.
  1629 "/                    'step for return' printCR.
  1613 		]
  1630                 ]
  1614 	    ].
  1631             ].
  1615 	    InStepInterrupt := nil
  1632             InStepInterrupt := nil
  1616 	]
  1633         ]
  1617     ] ifFalse:[
  1634     ] ifFalse:[
  1618 	OpenDebuggers notNil ifTrue:[
  1635         OpenDebuggers notNil ifTrue:[
  1619 	    OpenDebuggers remove:self ifAbsent:[].
  1636             OpenDebuggers remove:self ifAbsent:[].
  1620 	].
  1637         ].
  1621 	self cacheMyself.
  1638         self cacheMyself.
  1622     ]
  1639     ]
  1623 
  1640 
  1624     "Modified: / 17-04-1997 / 13:01:32 / stefan"
  1641     "Modified: / 17-04-1997 / 13:01:32 / stefan"
  1625     "Created: / 30-10-1997 / 21:08:18 / cg"
  1642     "Created: / 30-10-1997 / 21:08:18 / cg"
  1626     "Modified: / 13-10-1998 / 19:56:59 / ps"
  1643     "Modified: / 13-10-1998 / 19:56:59 / ps"
  1661 
  1678 
  1662 exit_restart
  1679 exit_restart
  1663     |con|
  1680     |con|
  1664 
  1681 
  1665     selectedContext notNil ifTrue:[
  1682     selectedContext notNil ifTrue:[
  1666 	con := selectedContext.
  1683         con := selectedContext.
  1667 	self cacheMyself.
  1684         self cacheMyself.
  1668 	"
  1685         "
  1669 	 have to catch errors occuring in unwind-blocks
  1686          have to catch errors occuring in unwind-blocks
  1670 	"
  1687         "
  1671 	Error handle:[:ex |
  1688         Error handle:[:ex |
  1672 	    'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1689             'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1673 	    ex description infoPrintCR.
  1690             ex description infoPrintCR.
  1674 	    ex proceed
  1691             ex proceed
  1675 	] do:[
  1692         ] do:[
  1676 	    con unwindAndRestart.
  1693             con unwindAndRestart.
  1677 	].
  1694         ].
  1678 	'DebugView [warning]: cannot restart selected context' errorPrintCR
  1695         'DebugView [warning]: cannot restart selected context' errorPrintCR
  1679     ]
  1696     ]
  1680 
  1697 
  1681     "Created: / 16.11.2001 / 17:23:17 / cg"
  1698     "Created: / 16.11.2001 / 17:23:17 / cg"
  1682     "Modified: / 17.11.2001 / 23:37:09 / cg"
  1699     "Modified: / 17.11.2001 / 23:37:09 / cg"
  1683 !
  1700 !
  1684 
  1701 
  1685 exit_return
  1702 exit_return
  1686     |con retVal|
  1703     |con retVal|
  1687 
  1704 
  1688     selectedContext notNil ifTrue:[
  1705     selectedContext notNil ifTrue:[
  1689 	"
  1706         "
  1690 	 if there is a selection in the codeView,
  1707          if there is a selection in the codeView,
  1691 	 evaluate it and use the result as return value
  1708          evaluate it and use the result as return value
  1692 	"
  1709         "
  1693 "/ disabled for now, there is almost always a selection (the current line)
  1710 "/ disabled for now, there is almost always a selection (the current line)
  1694 "/ and that is syntactically incorrect ...
  1711 "/ and that is syntactically incorrect ...
  1695 "/ ... leading to a popup warning from the codeView
  1712 "/ ... leading to a popup warning from the codeView
  1696 "/
  1713 "/
  1697 "/                codeView hasSelection ifTrue:[
  1714 "/                codeView hasSelection ifTrue:[
  1705 "/                        s := codeView selection asString.
  1722 "/                        s := codeView selection asString.
  1706 "/                        retVal := codeView doItAction value:s.
  1723 "/                        retVal := codeView doItAction value:s.
  1707 "/                    ].
  1724 "/                    ].
  1708 "/                ].
  1725 "/                ].
  1709 
  1726 
  1710 	con := selectedContext.
  1727         con := selectedContext.
  1711 	self cacheMyself.
  1728         self cacheMyself.
  1712 	"
  1729         "
  1713 	 have to catch errors occuring in unwind-blocks
  1730          have to catch errors occuring in unwind-blocks
  1714 	"
  1731         "
  1715 	Error handle:[:ex |
  1732         Error handle:[:ex |
  1716 	    'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1733             'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1717 	    ex description infoPrintCR.
  1734             ex description infoPrintCR.
  1718 	    ex proceed
  1735             ex proceed
  1719 	] do:[
  1736         ] do:[
  1720 	    con unwind:retVal.
  1737             con unwind:retVal.
  1721 	].
  1738         ].
  1722 	'DebugView [warning]: cannot return from selected context' errorPrintCR
  1739         'DebugView [warning]: cannot return from selected context' errorPrintCR
  1723     ]
  1740     ]
  1724 
  1741 
  1725     "Created: / 16.11.2001 / 17:22:24 / cg"
  1742     "Created: / 16.11.2001 / 17:22:24 / cg"
  1726     "Modified: / 17.11.2001 / 23:20:21 / cg"
  1743     "Modified: / 17.11.2001 / 23:20:21 / cg"
  1727 !
  1744 !
  1730 
  1747 
  1731     "
  1748     "
  1732      have to catch errors occuring in unwind-blocks
  1749      have to catch errors occuring in unwind-blocks
  1733     "
  1750     "
  1734     Error handle:[:ex |
  1751     Error handle:[:ex |
  1735 	'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1752         'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1736 	ex description infoPrintCR.
  1753         ex description infoPrintCR.
  1737 	ex proceed
  1754         ex proceed
  1738     ] do:[
  1755     ] do:[
  1739 	self cacheMyself.
  1756         self cacheMyself.
  1740 	Processor activeProcess terminate.
  1757         Processor activeProcess terminate.
  1741     ].
  1758     ].
  1742     'DebugView [warning]: cannot terminate process' errorPrintCR
  1759     'DebugView [warning]: cannot terminate process' errorPrintCR
  1743 
  1760 
  1744     "Created: / 16.11.2001 / 17:24:20 / cg"
  1761     "Created: / 16.11.2001 / 17:24:20 / cg"
  1745     "Modified: / 17.11.2001 / 23:20:27 / cg"
  1762     "Modified: / 17.11.2001 / 23:20:27 / cg"
  1760      have to catch errors occuring in unwind-blocks
  1777      have to catch errors occuring in unwind-blocks
  1761     "
  1778     "
  1762     self cacheMyself.
  1779     self cacheMyself.
  1763 
  1780 
  1764     Error handle:[:ex |
  1781     Error handle:[:ex |
  1765 	'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1782         'DebugView [info]: ignored error while unwinding: ' infoPrint.
  1766 	ex description infoPrintCR.
  1783         ex description infoPrintCR.
  1767 
  1784 
  1768 	ex proceed
  1785         ex proceed
  1769     ] do:[
  1786     ] do:[
  1770 	"/ find the enter:select context.
  1787         "/ find the enter:select context.
  1771 	con := thisContext sender.
  1788         con := thisContext sender.
  1772 	[
  1789         [
  1773 	    (con selector == #enter:select:)
  1790             (con selector == #enter:select:)
  1774 	    and:[con receiver == self]
  1791             and:[con receiver == self]
  1775 	]
  1792         ]
  1776 	whileFalse:[ con := con sender ].
  1793         whileFalse:[ con := con sender ].
  1777 
  1794 
  1778 	"/ must skip over its caller (because this one has a ControlInterrupt handler too)
  1795         "/ must skip over its caller (because this one has a ControlInterrupt handler too)
  1779 	con sender receiver == self class ifTrue:[
  1796         con sender receiver == self class ifTrue:[
  1780 	    con := con sender.
  1797             con := con sender.
  1781 	    con sender receiver == self class ifTrue:[
  1798             con sender receiver == self class ifTrue:[
  1782 		con := con sender.
  1799                 con := con sender.
  1783 		con isBlockContext ifTrue:[
  1800                 con isBlockContext ifTrue:[
  1784 		    con := con methodHome.
  1801                     con := con methodHome.
  1785 		]
  1802                 ]
  1786 	    ].
  1803             ].
  1787 	].
  1804         ].
  1788 
  1805 
  1789 	con unwindThenDo:aBlock.
  1806         con unwindThenDo:aBlock.
  1790     ].
  1807     ].
  1791     'DebugView [warning]: abort failed' errorPrintCR
  1808     'DebugView [warning]: abort failed' errorPrintCR
  1792 
  1809 
  1793     "Created: / 16.11.2001 / 17:20:45 / cg"
  1810     "Created: / 16.11.2001 / 17:20:45 / cg"
  1794     "Modified: / 18.11.2001 / 00:58:14 / cg"
  1811     "Modified: / 18.11.2001 / 00:58:14 / cg"
  1796 
  1813 
  1797 initialSelectionOnEntry:initialSelectionOrNil context:aContext
  1814 initialSelectionOnEntry:initialSelectionOrNil context:aContext
  1798     |selection con1 con2 h|
  1815     |selection con1 con2 h|
  1799 
  1816 
  1800     initialSelectionOrNil notNil ifTrue:[
  1817     initialSelectionOrNil notNil ifTrue:[
  1801 	^ initialSelectionOrNil
  1818         ^ initialSelectionOrNil
  1802     ].
  1819     ].
  1803 
  1820 
  1804     "
  1821     "
  1805      and find the one context to show initially
  1822      and find the one context to show initially
  1806      - if we came here by a send (single step), its the top context;
  1823      - if we came here by a send (single step), its the top context;
  1811     "
  1828     "
  1812     con1 := (contextArray at:1 ifAbsent:nil).
  1829     con1 := (contextArray at:1 ifAbsent:nil).
  1813     con2 := (contextArray at:2 ifAbsent:nil).
  1830     con2 := (contextArray at:2 ifAbsent:nil).
  1814 
  1831 
  1815     exitAction == #step ifTrue:[
  1832     exitAction == #step ifTrue:[
  1816 	selection := 1.
  1833         selection := 1.
  1817 	steppedContext notNil ifTrue:[
  1834         steppedContext notNil ifTrue:[
  1818 
  1835 
  1819 	    "
  1836             "
  1820 	     if we came here by a big-step, show the method where we are
  1837              if we came here by a big-step, show the method where we are
  1821 	    "
  1838             "
  1822 	    con1 == steppedContext ifTrue:[
  1839             con1 == steppedContext ifTrue:[
  1823 		selection := 1
  1840                 selection := 1
  1824 	    ] ifFalse:[
  1841             ] ifFalse:[
  1825 		con2 == steppedContext ifTrue:[
  1842                 con2 == steppedContext ifTrue:[
  1826 		    selection := 2
  1843                     selection := 2
  1827 		]
  1844                 ]
  1828 	    ].
  1845             ].
  1829 	    "
  1846             "
  1830 	     for bigStep, we could also be in a block below the actual method ...
  1847              for bigStep, we could also be in a block below the actual method ...
  1831 	    "
  1848             "
  1832 	    ((h := con1 home) notNil
  1849             ((h := con1 home) notNil
  1833 	     and:[h == steppedContext]) ifTrue:[
  1850              and:[h == steppedContext]) ifTrue:[
  1834 		selection := 1
  1851                 selection := 1
  1835 	    ] ifFalse:[
  1852             ] ifFalse:[
  1836 		(con2 notNil
  1853                 (con2 notNil
  1837 		and:[(h := con2 home) notNil
  1854                 and:[(h := con2 home) notNil
  1838 		and:[h == steppedContext]]) ifTrue:[
  1855                 and:[h == steppedContext]]) ifTrue:[
  1839 		    selection := 2
  1856                     selection := 2
  1840 		]
  1857                 ]
  1841 	    ].
  1858             ].
  1842 	    h := nil.
  1859             h := nil.
  1843 	]
  1860         ]
  1844     ] ifFalse:[
  1861     ] ifFalse:[
  1845 	steppedContext isNil ifTrue:[
  1862         steppedContext isNil ifTrue:[
  1846 	    "
  1863             "
  1847 	     preselect a more interesting context, (where halt/raise was ...)
  1864              preselect a more interesting context, (where halt/raise was ...)
  1848 	    "
  1865             "
  1849 	    "/ selection := self class interestingContextIndexFrom:aContext.
  1866             "/ selection := self class interestingContextIndexFrom:aContext.
  1850 	    selection := self class interestingContextIndexIn:contextArray.
  1867             selection := self class interestingContextIndexIn:contextArray.
  1851 	    selection := selection min:(contextArray size).
  1868             selection := selection min:(contextArray size).
  1852 	] ifFalse:[
  1869         ] ifFalse:[
  1853 	    "
  1870             "
  1854 	     if we came here by a big-step, show the method where we are
  1871              if we came here by a big-step, show the method where we are
  1855 	    "
  1872             "
  1856 	    con1 == steppedContext ifTrue:[
  1873             con1 == steppedContext ifTrue:[
  1857 		selection := 1
  1874                 selection := 1
  1858 	    ] ifFalse:[
  1875             ] ifFalse:[
  1859 		con2 == steppedContext ifTrue:[
  1876                 con2 == steppedContext ifTrue:[
  1860 		    selection := 2.
  1877                     selection := 2.
  1861 		]
  1878                 ]
  1862 	    ]
  1879             ]
  1863 	]
  1880         ]
  1864     ].
  1881     ].
  1865     ^ selection
  1882     ^ selection
  1866 
  1883 
  1867     "Created: / 17.11.2001 / 20:26:26 / cg"
  1884     "Created: / 17.11.2001 / 20:26:26 / cg"
  1868     "Modified: / 17.11.2001 / 22:51:46 / cg"
  1885     "Modified: / 17.11.2001 / 22:51:46 / cg"
  1903     continueButton label:(resources string:'Stop').
  1920     continueButton label:(resources string:'Stop').
  1904     w := w max:(continueButton preferredWidth).
  1921     w := w max:(continueButton preferredWidth).
  1905     continueButton preferredExtent:(w @ continueButton preferredHeight).
  1922     continueButton preferredExtent:(w @ continueButton preferredHeight).
  1906 
  1923 
  1907     aProcess state == #run ifTrue:[
  1924     aProcess state == #run ifTrue:[
  1908 	device hasColors ifTrue:[
  1925         device hasColors ifTrue:[
  1909 	    continueButton foregroundColor:Color red darkened.
  1926             continueButton foregroundColor:Color red darkened.
  1910 	].
  1927         ].
  1911 	continueButton label:(resources string:'Stop').
  1928         continueButton label:(resources string:'Stop').
  1912 	continueButton action:[self doStop].
  1929         continueButton action:[self doStop].
  1913     ] ifFalse:[
  1930     ] ifFalse:[
  1914 	device hasColors ifTrue:[
  1931         device hasColors ifTrue:[
  1915 	    continueButton foregroundColor:Color green darkened darkened.
  1932             continueButton foregroundColor:Color green darkened darkened.
  1916 	].
  1933         ].
  1917 	continueButton label:(resources string:'Continue').
  1934         continueButton label:(resources string:'Continue').
  1918 	continueButton action:[self doContinue].
  1935         continueButton action:[self doContinue].
  1919     ].
  1936     ].
  1920     continueButton preferredExtent:(w @ continueButton preferredHeight).
  1937     continueButton preferredExtent:(w @ continueButton preferredHeight).
  1921 
  1938 
  1922     returnButton disable.
  1939     returnButton disable.
  1923     restartButton disable.
  1940     restartButton disable.
  1927 
  1944 
  1928 "/    stepButton destroy.
  1945 "/    stepButton destroy.
  1929 "/    sendButton destroy.
  1946 "/    sendButton destroy.
  1930 
  1947 
  1931     updateButton := Button
  1948     updateButton := Button
  1932 			label:(resources string:'Update')
  1949                         label:(resources string:'Update')
  1933 			action:[self updateContext]
  1950                         action:[self updateContext]
  1934 			in:bpanel.
  1951                         in:bpanel.
  1935     monitorToggle := Toggle in:bpanel.
  1952     monitorToggle := Toggle in:bpanel.
  1936     monitorToggle label:(resources string:'Monitor').
  1953     monitorToggle label:(resources string:'Monitor').
  1937     monitorToggle pressAction:[self autoUpdateOn].
  1954     monitorToggle pressAction:[self autoUpdateOn].
  1938     monitorToggle releaseAction:[self autoUpdateOff].
  1955     monitorToggle releaseAction:[self autoUpdateOff].
  1939 
  1956 
  1948     nextButton disable; beInvisible.
  1965     nextButton disable; beInvisible.
  1949     nextOverButton notNil ifTrue:[nextOverButton disable; beInvisible].
  1966     nextOverButton notNil ifTrue:[nextOverButton disable; beInvisible].
  1950     nextOutButton notNil ifTrue:[nextOutButton disable; beInvisible].
  1967     nextOutButton notNil ifTrue:[nextOutButton disable; beInvisible].
  1951 
  1968 
  1952     aProcess isNil ifTrue:[
  1969     aProcess isNil ifTrue:[
  1953 	terminateButton disable.
  1970         terminateButton disable.
  1954 	abortButton disable.
  1971         abortButton disable.
  1955 	continueButton disable.
  1972         continueButton disable.
  1956 	returnButton disable.
  1973         returnButton disable.
  1957 	restartButton disable.
  1974         restartButton disable.
  1958     ] ifFalse:[
  1975     ] ifFalse:[
  1959 	(aProcess suspendedContext isNil
  1976         (aProcess suspendedContext isNil
  1960 	or:[aProcess isSystemProcess]) ifTrue:[
  1977         or:[aProcess isSystemProcess]) ifTrue:[
  1961 	    terminateButton disable.
  1978             terminateButton disable.
  1962 	].
  1979         ].
  1963 
  1980 
  1964 	self setContextSkippingInterruptContexts:aProcess suspendedContext.
  1981         self setContextSkippingInterruptContexts:aProcess suspendedContext.
  1965 
  1982 
  1966 	catchBlock := [
  1983         catchBlock := [
  1967 	    catchBlock := nil.
  1984             catchBlock := nil.
  1968 	    contextArray := nil.
  1985             contextArray := nil.
  1969 	    selectedContext := actualContext := firstContext := nil.
  1986             selectedContext := actualContext := firstContext := nil.
  1970 	    steppedContext := wrapperContext := nil.
  1987             steppedContext := wrapperContext := nil.
  1971 
  1988 
  1972 	    (exitAction == #terminate) ifTrue:[
  1989             (exitAction == #terminate) ifTrue:[
  1973 		aProcess terminate.
  1990                 aProcess terminate.
  1974 	    ].
  1991             ].
  1975 	    (exitAction == #quickTerminate) ifTrue:[
  1992             (exitAction == #quickTerminate) ifTrue:[
  1976 		aProcess terminateNoSignal.
  1993                 aProcess terminateNoSignal.
  1977 	    ].
  1994             ].
  1978 	    super destroy
  1995             super destroy
  1979 	].
  1996         ].
  1980     ].
  1997     ].
  1981     self open
  1998     self open
  1982 
  1999 
  1983     "Modified: 20.3.1997 / 16:53:56 / cg"
  2000     "Modified: 20.3.1997 / 16:53:56 / cg"
  1984     "Modified: 17.4.1997 / 13:01:57 / stefan"
  2001     "Modified: 17.4.1997 / 13:01:57 / stefan"
  1987 setInitialSelectionOnEntry:initialSelectionOrNil context:aContext
  2004 setInitialSelectionOnEntry:initialSelectionOrNil context:aContext
  1988     |selection|
  2005     |selection|
  1989 
  2006 
  1990     selection := self initialSelectionOnEntry:initialSelectionOrNil context:aContext.
  2007     selection := self initialSelectionOnEntry:initialSelectionOrNil context:aContext.
  1991     selection notNil ifTrue:[
  2008     selection notNil ifTrue:[
  1992 	self showSelection:selection.
  2009         self showSelection:selection.
  1993 	contextView setSelection:selection.
  2010         contextView setSelection:selection.
  1994 	selection > 1 ifTrue:[
  2011         selection > 1 ifTrue:[
  1995 	    contextView scrollToLine:(selection - 1)
  2012             contextView scrollToLine:(selection - 1)
  1996 	]
  2013         ]
  1997     ].
  2014     ].
  1998 
  2015 
  1999     "Created: / 16.11.2001 / 17:28:07 / cg"
  2016     "Created: / 16.11.2001 / 17:28:07 / cg"
  2000     "Modified: / 17.11.2001 / 20:27:21 / cg"
  2017     "Modified: / 17.11.2001 / 20:27:21 / cg"
  2001 !
  2018 !
  2024 
  2041 
  2025 flyByHelpTextFor:aComponent
  2042 flyByHelpTextFor:aComponent
  2026     |s|
  2043     |s|
  2027 
  2044 
  2028     aComponent == abortButton ifTrue:[
  2045     aComponent == abortButton ifTrue:[
  2029 	s := 'Abort (unwind to eventLoop)'
  2046         s := 'Abort (unwind to eventLoop)'
  2030     ].
  2047     ].
  2031     aComponent == terminateButton ifTrue:[
  2048     aComponent == terminateButton ifTrue:[
  2032 	s := 'Terminate process (close view)'
  2049         s := 'Terminate process (close view)'
  2033     ].
  2050     ].
  2034     aComponent == continueButton ifTrue:[
  2051     aComponent == continueButton ifTrue:[
  2035 	continueButton label = (resources string:'Stop') ifTrue:[
  2052         continueButton label = (resources string:'Stop') ifTrue:[
  2036 	    s := 'Stop'
  2053             s := 'Stop'
  2037 	] ifFalse:[
  2054         ] ifFalse:[
  2038 	    s := 'Continue execution'
  2055             s := 'Continue execution'
  2039 	]
  2056         ]
  2040     ].
  2057     ].
  2041     aComponent == stepButton ifTrue:[
  2058     aComponent == stepButton ifTrue:[
  2042 	s := 'Step to next send (don''t enter into called methods)'
  2059         s := 'Step to next send (don''t enter into called methods)'
  2043     ].
  2060     ].
  2044     aComponent == nextButton ifTrue:[
  2061     aComponent == nextButton ifTrue:[
  2045 	s := 'Step to next line (don''t enter into called methods)'
  2062         s := 'Step to next line (don''t enter into called methods)'
  2046     ].
  2063     ].
  2047     aComponent == nextOverButton ifTrue:[
  2064     aComponent == nextOverButton ifTrue:[
  2048 	s := 'Step over to cursor-line'
  2065         s := 'Step over to cursor-line'
  2049     ].
  2066     ].
  2050     aComponent == nextOutButton ifTrue:[
  2067     aComponent == nextOutButton ifTrue:[
  2051 	s := 'Step out to caller'
  2068         s := 'Step out to caller'
  2052     ].
  2069     ].
  2053     aComponent == sendButton ifTrue:[
  2070     aComponent == sendButton ifTrue:[
  2054 	s := 'Send next message (enter into called methods)'
  2071         s := 'Send next message (enter into called methods)'
  2055     ].
  2072     ].
  2056     aComponent == returnButton ifTrue:[
  2073     aComponent == returnButton ifTrue:[
  2057 	s := 'Return from selected method'
  2074         s := 'Return from selected method'
  2058     ].
  2075     ].
  2059     aComponent == restartButton ifTrue:[
  2076     aComponent == restartButton ifTrue:[
  2060 	s := 'Restart selected method'
  2077         s := 'Restart selected method'
  2061     ].
  2078     ].
  2062     aComponent == monitorToggle ifTrue:[
  2079     aComponent == monitorToggle ifTrue:[
  2063 	s := 'Toggle monitoring'
  2080         s := 'Toggle monitoring'
  2064     ].
  2081     ].
  2065     aComponent == updateButton ifTrue:[
  2082     aComponent == updateButton ifTrue:[
  2066 	s := 'Update'
  2083         s := 'Update'
  2067     ].
  2084     ].
  2068     aComponent == reportButton ifTrue:[
  2085     aComponent == reportButton ifTrue:[
  2069 	s := 'Send a defect report via eMail'
  2086         s := 'Send a defect report via eMail'
  2070     ].
  2087     ].
  2071     s notNil ifTrue:[
  2088     s notNil ifTrue:[
  2072 	^ resources string:s
  2089         ^ resources string:s
  2073     ].
  2090     ].
  2074     ^ nil
  2091     ^ nil
  2075 
  2092 
  2076     "Modified: / 29-08-1995 / 23:38:54 / claus"
  2093     "Modified: / 29-08-1995 / 23:38:54 / claus"
  2077     "Modified: / 18-06-2010 / 11:34:51 / cg"
  2094     "Modified: / 18-06-2010 / 11:34:51 / cg"
  2090 
  2107 
  2091     pos := codeView characterPositionOfLine:line col:col.
  2108     pos := codeView characterPositionOfLine:line col:col.
  2092     interval := pos to:pos.
  2109     interval := pos to:pos.
  2093 
  2110 
  2094     self
  2111     self
  2095 	withNodeValueAtInterval:interval
  2112         withNodeValueAtInterval:interval
  2096 	do:[:value :description |
  2113         do:[:value :description |
  2097 	    |valueClassOrSizeString valueString|
  2114             |valueClassOrSizeString valueString|
  2098 
  2115 
  2099 	    valueClassOrSizeString := valueString := ''.
  2116             valueClassOrSizeString := valueString := ''.
  2100 
  2117 
  2101 	    "/ some heuristics as when to show the class name (a purely subjective preference)
  2118             "/ some heuristics as when to show the class name (a purely subjective preference)
  2102 	    value isString ifTrue:[
  2119             value isString ifTrue:[
  2103 		value isText ifTrue:[
  2120                 value isText ifTrue:[
  2104 		    valueString := '"',(value contractTo:80),'"'.
  2121                     valueString := '"',(value contractTo:80),'"'.
  2105 		] ifFalse:[
  2122                 ] ifFalse:[
  2106 		    valueString := value storeString contractTo:80.
  2123                     valueString := value storeString contractTo:80.
  2107 		].
  2124                 ].
  2108 	    ] ifFalse:[
  2125             ] ifFalse:[
  2109 		(value isBoolean
  2126                 (value isBoolean
  2110 		or:[ value isInteger
  2127                 or:[ value isInteger
  2111 		or:[ value isSymbol ]]) ifTrue:[
  2128                 or:[ value isSymbol ]]) ifTrue:[
  2112 		    valueString := value printString.
  2129                     valueString := value printString.
  2113 		] ifFalse:[
  2130                 ] ifFalse:[
  2114 		    valueClassOrSizeString := ' (',value class name,')'.
  2131                     valueClassOrSizeString := ' (',value class name,')'.
  2115 
  2132 
  2116 		    (value isArray
  2133                     (value isArray
  2117 		    or:[ value isOrderedCollection ]) ifTrue:[
  2134                     or:[ value isOrderedCollection ]) ifTrue:[
  2118 			valueClassOrSizeString := ' (size=',value size printString,')'.
  2135                         valueClassOrSizeString := ' (size=',value size printString,')'.
  2119 		    ].
  2136                     ].
  2120 
  2137 
  2121 		    Error handle:[:ex |
  2138                     Error handle:[:ex |
  2122 			valueString := '??? (',ex description,')'
  2139                         valueString := '??? (',ex description,')'
  2123 		    ] do:[
  2140                     ] do:[
  2124 			[
  2141                         [
  2125 			    valueString := value printString contractTo:80.
  2142                             valueString := value printString contractTo:80.
  2126 			] valueWithWatchDog:[ valueString := value classNameWithArticle ] afterMilliseconds:30.
  2143                         ] valueWithWatchDog:[ valueString := value classNameWithArticle ] afterMilliseconds:30.
  2127 		    ]
  2144                     ]
  2128 		]
  2145                 ]
  2129 	    ].
  2146             ].
  2130 	    description isEmptyOrNil ifTrue:[
  2147             description isEmptyOrNil ifTrue:[
  2131 		s := valueString , valueClassOrSizeString
  2148                 s := valueString , valueClassOrSizeString
  2132 	    ] ifFalse:[
  2149             ] ifFalse:[
  2133 		s := description , ': ', valueString, valueClassOrSizeString
  2150                 s := description , ': ', valueString, valueClassOrSizeString
  2134 	    ].
  2151             ].
  2135 	].
  2152         ].
  2136     "/ Transcript showCR:s.
  2153     "/ Transcript showCR:s.
  2137     ^ s
  2154     ^ s
  2138 
  2155 
  2139     "Modified: / 27-04-2010 / 17:51:53 / cg"
  2156     "Modified: / 27-04-2010 / 17:51:53 / cg"
  2140 !
  2157 !
  2141 
  2158 
  2142 helpTextFor:aComponent
  2159 helpTextFor:aComponent
  2143     |s|
  2160     |s|
  2144 
  2161 
  2145     aComponent == abortButton ifTrue:[
  2162     aComponent == abortButton ifTrue:[
  2146 	s := 'HELP_ABORT'
  2163         s := 'HELP_ABORT'
  2147     ].
  2164     ].
  2148     aComponent == terminateButton ifTrue:[
  2165     aComponent == terminateButton ifTrue:[
  2149 	s := 'HELP_TERMINATE'
  2166         s := 'HELP_TERMINATE'
  2150     ].
  2167     ].
  2151     aComponent == continueButton ifTrue:[
  2168     aComponent == continueButton ifTrue:[
  2152 	continueButton label = (resources string:'Stop') ifTrue:[
  2169         continueButton label = (resources string:'Stop') ifTrue:[
  2153 	    s := 'HELP_STOP'
  2170             s := 'HELP_STOP'
  2154 	] ifFalse:[
  2171         ] ifFalse:[
  2155 	    s := 'HELP_CONTINUE'
  2172             s := 'HELP_CONTINUE'
  2156 	]
  2173         ]
  2157     ].
  2174     ].
  2158     aComponent == stepButton ifTrue:[
  2175     aComponent == stepButton ifTrue:[
  2159 	s := 'HELP_STEP'
  2176         s := 'HELP_STEP'
  2160     ].
  2177     ].
  2161     aComponent == nextButton ifTrue:[
  2178     aComponent == nextButton ifTrue:[
  2162 	s := 'HELP_NEXT'
  2179         s := 'HELP_NEXT'
  2163     ].
  2180     ].
  2164     aComponent == nextOverButton ifTrue:[
  2181     aComponent == nextOverButton ifTrue:[
  2165 	s := 'HELP_NEXTOVER'
  2182         s := 'HELP_NEXTOVER'
  2166     ].
  2183     ].
  2167     aComponent == nextOutButton ifTrue:[
  2184     aComponent == nextOutButton ifTrue:[
  2168 	s := 'HELP_NEXTOUT'
  2185         s := 'HELP_NEXTOUT'
  2169     ].
  2186     ].
  2170     aComponent == stepButton ifTrue:[
  2187     aComponent == stepButton ifTrue:[
  2171 	s := 'HELP_STEP'
  2188         s := 'HELP_STEP'
  2172     ].
  2189     ].
  2173     aComponent == sendButton ifTrue:[
  2190     aComponent == sendButton ifTrue:[
  2174 	s := 'HELP_SEND'
  2191         s := 'HELP_SEND'
  2175     ].
  2192     ].
  2176     aComponent == returnButton ifTrue:[
  2193     aComponent == returnButton ifTrue:[
  2177 	s := 'HELP_RETURN'
  2194         s := 'HELP_RETURN'
  2178     ].
  2195     ].
  2179     aComponent == restartButton ifTrue:[
  2196     aComponent == restartButton ifTrue:[
  2180 	s := 'HELP_RESTART'
  2197         s := 'HELP_RESTART'
  2181     ].
  2198     ].
  2182     aComponent == contextView ifTrue:[
  2199     aComponent == contextView ifTrue:[
  2183 	s := 'HELP_WALKBACK'
  2200         s := 'HELP_WALKBACK'
  2184     ].
  2201     ].
  2185     aComponent == codeView ifTrue:[
  2202     aComponent == codeView ifTrue:[
  2186 	s := 'HELP_CODEVIEW'
  2203         s := 'HELP_CODEVIEW'
  2187     ].
  2204     ].
  2188     aComponent == monitorToggle ifTrue:[
  2205     aComponent == monitorToggle ifTrue:[
  2189 	s := 'HELP_MONITOR'
  2206         s := 'HELP_MONITOR'
  2190     ].
  2207     ].
  2191     aComponent == updateButton ifTrue:[
  2208     aComponent == updateButton ifTrue:[
  2192 	s := 'HELP_UPDATE'
  2209         s := 'HELP_UPDATE'
  2193     ].
  2210     ].
  2194 "/    aComponent == stopButton ifTrue:[
  2211 "/    aComponent == stopButton ifTrue:[
  2195 "/        s := 'HELP_STOP'
  2212 "/        s := 'HELP_STOP'
  2196 "/    ].
  2213 "/    ].
  2197     (aComponent isComponentOf:receiverInspector) ifTrue:[
  2214     (aComponent isComponentOf:receiverInspector) ifTrue:[
  2198 	s := 'HELP_REC_INSP'
  2215         s := 'HELP_REC_INSP'
  2199     ].
  2216     ].
  2200     (aComponent isComponentOf:contextInspector) ifTrue:[
  2217     (aComponent isComponentOf:contextInspector) ifTrue:[
  2201 	s := 'HELP_CON_INSP'
  2218         s := 'HELP_CON_INSP'
  2202     ].
  2219     ].
  2203 
  2220 
  2204     s notNil ifTrue:[
  2221     s notNil ifTrue:[
  2205 	^ resources string:s
  2222         ^ resources string:s
  2206     ].
  2223     ].
  2207     ^ nil
  2224     ^ nil
  2208 
  2225 
  2209     "Modified: 29.8.1995 / 23:38:54 / claus"
  2226     "Modified: 29.8.1995 / 23:38:54 / claus"
  2210     "Modified: 4.3.1997 / 01:54:03 / cg"
  2227     "Modified: 4.3.1997 / 01:54:03 / cg"
  2222     "closing the debugger implies an abort or continue"
  2239     "closing the debugger implies an abort or continue"
  2223 
  2240 
  2224     |m|
  2241     |m|
  2225 
  2242 
  2226     self checkIfCodeIsReallyModified ifTrue:[
  2243     self checkIfCodeIsReallyModified ifTrue:[
  2227 	(self confirm:('Code modified - exit anyway ?'))
  2244         (self confirm:('Code modified - exit anyway ?'))
  2228 	ifFalse:[
  2245         ifFalse:[
  2229 	    ^ self
  2246             ^ self
  2230 	]
  2247         ]
  2231     ].
  2248     ].
  2232 
  2249 
  2233     self autoUpdateOff.
  2250     self autoUpdateOff.
  2234 
  2251 
  2235     (m := contextView middleButtonMenu) notNil ifTrue:[m hide].
  2252     (m := contextView middleButtonMenu) notNil ifTrue:[m hide].
  2236     inspecting ifFalse:[
  2253     inspecting ifFalse:[
  2237 	"I am running on top of a process, abort or continue it"
  2254         "I am running on top of a process, abort or continue it"
  2238 
  2255 
  2239 	windowGroup notNil ifTrue:[
  2256         windowGroup notNil ifTrue:[
  2240 	    windowGroup setProcess:nil.
  2257             windowGroup setProcess:nil.
  2241 	].
  2258         ].
  2242 	self uncacheMyself.
  2259         self uncacheMyself.
  2243 
  2260 
  2244 	"/
  2261         "/
  2245 	"/ catch invalid return;
  2262         "/ catch invalid return;
  2246 	"/ this happens, when my process has somehow died (quickterminate)
  2263         "/ this happens, when my process has somehow died (quickterminate)
  2247 	"/ and I am a leftOver view, which gets terminated via the launchers
  2264         "/ and I am a leftOver view, which gets terminated via the launchers
  2248 	"/ #destroy-window function.
  2265         "/ #destroy-window function.
  2249 	"/
  2266         "/
  2250 	Context cannotReturnSignal handle:[:ex |
  2267         Context cannotReturnSignal handle:[:ex |
  2251 	    'DebugView [info]: OOPS - non regular debugView closing(1)' infoPrintCR.
  2268             'DebugView [info]: OOPS - non regular debugView closing(1)' infoPrintCR.
  2252 	    self uncacheMyself.
  2269             self uncacheMyself.
  2253 	    Debugger newDebugger.
  2270             Debugger newDebugger.
  2254 	    ex return.
  2271             ex return.
  2255 	] do:[
  2272         ] do:[
  2256 	    AbortOperationRequest isHandled ifTrue:[
  2273             AbortOperationRequest isHandled ifTrue:[
  2257 		self doAbort.
  2274                 self doAbort.
  2258 	    ] ifFalse:[
  2275             ] ifFalse:[
  2259 		self doContinue
  2276                 self doContinue
  2260 	    ]
  2277             ]
  2261 	].
  2278         ].
  2262 	"/ We don't reach this point normally
  2279         "/ We don't reach this point normally
  2263 	'DebugView [info]: OOPS - non regular debugView closing(2)' infoPrintCR.
  2280         'DebugView [info]: OOPS - non regular debugView closing(2)' infoPrintCR.
  2264 	Debugger newDebugger.
  2281         Debugger newDebugger.
  2265 	self uncacheMyself.
  2282         self uncacheMyself.
  2266     ].
  2283     ].
  2267 
  2284 
  2268     Debugger newDebugger.
  2285     Debugger newDebugger.
  2269     "/ since I am going to be destroyed, remove me from the cache
  2286     "/ since I am going to be destroyed, remove me from the cache
  2270     self uncacheMyself.
  2287     self uncacheMyself.
  2282 
  2299 
  2283     font := font onDevice:device.
  2300     font := font onDevice:device.
  2284 
  2301 
  2285     verboseBacktrace := UserPreferences current verboseBacktraceInDebugger.
  2302     verboseBacktrace := UserPreferences current verboseBacktraceInDebugger.
  2286     ignoreBreakpoints := true.    "/ ignore halts/breakpoints in doIts of
  2303     ignoreBreakpoints := true.    "/ ignore halts/breakpoints in doIts of
  2287 				  "/ the debugger
  2304                                   "/ the debugger
  2288 
  2305 
  2289     busy := false.
  2306     busy := false.
  2290     exclusive := false.
  2307     exclusive := false.
  2291     inspecting := false.
  2308     inspecting := false.
  2292     exitAction := nil.
  2309     exitAction := nil.
  2306     mH := menuPanel preferredHeight.
  2323     mH := menuPanel preferredHeight.
  2307     menuPanel origin:(0.0 @ 0.0) corner:(1.0 @ (mH)).
  2324     menuPanel origin:(0.0 @ 0.0) corner:(1.0 @ (mH)).
  2308 
  2325 
  2309     newLayout := UserPreferences current useNewLayoutInDebugger.
  2326     newLayout := UserPreferences current useNewLayoutInDebugger.
  2310     newLayout ifFalse:[
  2327     newLayout ifFalse:[
  2311 	bpanel := HorizontalPanelView in:self.
  2328         bpanel := HorizontalPanelView in:self.
  2312 
  2329 
  2313 	self initializeButtonsIn:bpanel.
  2330         self initializeButtonsIn:bpanel.
  2314 
  2331 
  2315 	bH := bpanel preferredHeight + 5.
  2332         bH := bpanel preferredHeight + 5.
  2316 	bpanel origin:(0.0 @ mH)
  2333         bpanel origin:(0.0 @ mH)
  2317 	       extent:(1.0 @ bH).
  2334                extent:(1.0 @ bH).
  2318 	panel := VariableVerticalPanel
  2335         panel := VariableVerticalPanel
  2319 			    origin:(0.0 @ (mH + bH))
  2336                             origin:(0.0 @ (mH + bH))
  2320 			    corner:(1.0 @ 1.0)
  2337                             corner:(1.0 @ 1.0)
  2321 			    in:self.
  2338                             in:self.
  2322 
  2339 
  2323 	v := self initializeContextListViewIn:panel.
  2340         v := self initializeContextListViewIn:panel.
  2324 	v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25).
  2341         v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25).
  2325 
  2342 
  2326 	codePanel := View in:panel.
  2343         codePanel := View in:panel.
  2327 	v := self initializeCodeViewIn:codePanel.
  2344         v := self initializeCodeViewIn:codePanel.
  2328 	v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
  2345         v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
  2329 	codePanel origin:(0.0 @ 0.25) corner:(1.0 @ 0.75).
  2346         codePanel origin:(0.0 @ 0.25) corner:(1.0 @ 0.75).
  2330 
  2347 
  2331 	v := self initializeInspectorViewsIn:panel.
  2348         v := self initializeInspectorViewsIn:panel.
  2332 	v origin:(0.0 @ 0.75) corner:(1.0 @ 1.0).
  2349         v origin:(0.0 @ 0.75) corner:(1.0 @ 1.0).
  2333 
  2350 
  2334     ] ifTrue:[
  2351     ] ifTrue:[
  2335 	bpanel1 := HorizontalPanelView in:self.
  2352         bpanel1 := HorizontalPanelView in:self.
  2336 	self initializeButtons1In:bpanel1.
  2353         self initializeButtons1In:bpanel1.
  2337 
  2354 
  2338 	bH1 := bpanel1 preferredHeight + 5.
  2355         bH1 := bpanel1 preferredHeight + 5.
  2339 	bpanel1 origin:(0.0 @ mH)
  2356         bpanel1 origin:(0.0 @ mH)
  2340 		extent:(1.0 @ bH1).
  2357                 extent:(1.0 @ bH1).
  2341 	panel := VariableVerticalPanel
  2358         panel := VariableVerticalPanel
  2342 			    origin:(0.0 @ (mH + bH1))
  2359                             origin:(0.0 @ (mH + bH1))
  2343 			    corner:(1.0 @ 1.0)
  2360                             corner:(1.0 @ 1.0)
  2344 				in:self.
  2361                                 in:self.
  2345 	"/ panel showHandle:true.
  2362         "/ panel showHandle:true.
  2346 	"/ panel handlePosition:#left.
  2363         "/ panel handlePosition:#left.
  2347 
  2364 
  2348 	v := self initializeContextListViewIn:panel.
  2365         v := self initializeContextListViewIn:panel.
  2349 	v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25).
  2366         v origin:(0.0 @ 0.0) corner:(1.0 @ 0.25).
  2350 
  2367 
  2351 	codePanel := View in:panel.
  2368         codePanel := View in:panel.
  2352 	bpanel2 := HorizontalPanelView in:codePanel.
  2369         bpanel2 := HorizontalPanelView in:codePanel.
  2353 	self initializeButtons2In:bpanel2.
  2370         self initializeButtons2In:bpanel2.
  2354 
  2371 
  2355 	bH2 := bpanel2 preferredHeight + 5.
  2372         bH2 := bpanel2 preferredHeight + 5.
  2356 	bpanel2 origin:(0.0 @ 0.0)
  2373         bpanel2 origin:(0.0 @ 0.0)
  2357 		extent:(1.0 @ bH2).
  2374                 extent:(1.0 @ bH2).
  2358 
  2375 
  2359 	exceptionInfoLabel := Label label:''.
  2376         exceptionInfoLabel := Label label:''.
  2360 	exceptionInfoLabel adjust:#left.
  2377         exceptionInfoLabel adjust:#left.
  2361 
  2378 
  2362 	exceptionAndTogglePanel := HorizontalPanelView in:codePanel.
  2379         exceptionAndTogglePanel := HorizontalPanelView in:codePanel.
  2363 	exceptionAndTogglePanel horizontalLayout:#left.
  2380         exceptionAndTogglePanel horizontalLayout:#left.
  2364 	exceptionAndTogglePanel
  2381         exceptionAndTogglePanel
  2365 	    geometryLayout:
  2382             geometryLayout:
  2366 		((LayoutFrame
  2383                 ((LayoutFrame
  2367 		    origin:(0.0 @ 0.0)
  2384                     origin:(0.0 @ 0.0)
  2368 		    corner:(1.0 @ 0.0))
  2385                     corner:(1.0 @ 0.0))
  2369 			topOffset:bH2;
  2386                         topOffset:bH2;
  2370 			bottomOffset:(bH2 + exceptionInfoLabel preferredHeight + 6);
  2387                         bottomOffset:(bH2 + exceptionInfoLabel preferredHeight + 6);
  2371 			rightOffset:-2).
  2388                         rightOffset:-2).
  2372 
  2389 
  2373 	methodCodeToggleSelectionHolder := 1 asValue.
  2390         methodCodeToggleSelectionHolder := 1 asValue.
  2374 	methodCodeToggleSelectionHolder onChangeSend:#methodCodeToggleChanged to:self.
  2391         methodCodeToggleSelectionHolder onChangeSend:#methodCodeToggleChanged to:self.
  2375 	methodCodeToggle := PopUpList label:(resources string:'Original Code (Executed)') in:exceptionAndTogglePanel.
  2392         methodCodeToggle := PopUpList label:(resources string:'Original Code (Executed)') in:exceptionAndTogglePanel.
  2376 	methodCodeToggle list:(resources array:#( 'Original Code (Executed)' 'Current Code')).
  2393         methodCodeToggle list:(resources array:#( 'Original Code (Executed)' 'Current Code')).
  2377 	methodCodeToggle useIndex:true.
  2394         methodCodeToggle useIndex:true.
  2378 	methodCodeToggle model:methodCodeToggleSelectionHolder.
  2395         methodCodeToggle model:methodCodeToggleSelectionHolder.
  2379 	methodCodeToggle beInvisible.
  2396         methodCodeToggle beInvisible.
  2380 
  2397 
  2381 	exceptionAndTogglePanel add:exceptionInfoLabel.
  2398         exceptionAndTogglePanel add:exceptionInfoLabel.
  2382 
  2399 
  2383 	v := self initializeCodeViewIn:codePanel.
  2400         v := self initializeCodeViewIn:codePanel.
  2384 	v origin:(0.0 @ (bH2+exceptionInfoLabel preferredHeight+6)) corner:(1.0 @ 1.0).
  2401         v origin:(0.0 @ (bH2+exceptionInfoLabel preferredHeight+6)) corner:(1.0 @ 1.0).
  2385 	codePanel origin:(0.0 @ 0.25) corner:(1.0 @ 0.75).
  2402         codePanel origin:(0.0 @ 0.25) corner:(1.0 @ 0.75).
  2386 
  2403 
  2387 	v := self initializeInspectorViewsIn:panel.
  2404         v := self initializeInspectorViewsIn:panel.
  2388 	v origin:(0.0 @ 0.75) corner:(1.0 @ 1.0).
  2405         v origin:(0.0 @ 0.75) corner:(1.0 @ 1.0).
  2389     ].
  2406     ].
  2390 
  2407 
  2391     DefaultDebuggerBackgroundColor notNil ifTrue:[
  2408     DefaultDebuggerBackgroundColor notNil ifTrue:[
  2392 	self allViewBackground:DefaultDebuggerBackgroundColor.
  2409         self allViewBackground:DefaultDebuggerBackgroundColor.
  2393     ].
  2410     ].
  2394     LastExtent notNil ifTrue:[
  2411     LastExtent notNil ifTrue:[
  2395 	self extent:LastExtent.
  2412         self extent:LastExtent.
  2396     ].
  2413     ].
  2397     LastOrigin notNil ifTrue:[
  2414     LastOrigin notNil ifTrue:[
  2398 	self origin:LastOrigin.
  2415         self origin:LastOrigin.
  2399     ].
  2416     ].
  2400 
  2417 
  2401     "
  2418     "
  2402      Debugger newDebugger
  2419      Debugger newDebugger
  2403     "
  2420     "
  2405     "Modified: / 10-11-2010 / 10:09:34 / cg"
  2422     "Modified: / 10-11-2010 / 10:09:34 / cg"
  2406 !
  2423 !
  2407 
  2424 
  2408 initializeAbortButtonIn:bpanel
  2425 initializeAbortButtonIn:bpanel
  2409     abortButton := Button
  2426     abortButton := Button
  2410 		label:(resources string:'Abort')
  2427                 label:(resources string:'Abort')
  2411 		action:[
  2428                 action:[
  2412 		    abortButton turnOffWithoutRedraw.
  2429                     abortButton turnOffWithoutRedraw.
  2413 		    self doAbort
  2430                     self doAbort
  2414 		]
  2431                 ]
  2415 		in:bpanel.
  2432                 in:bpanel.
  2416 
  2433 
  2417     "Created: / 17.11.2001 / 20:56:47 / cg"
  2434     "Created: / 17.11.2001 / 20:56:47 / cg"
  2418     "Modified: / 17.11.2001 / 20:57:17 / cg"
  2435     "Modified: / 17.11.2001 / 20:57:17 / cg"
  2419 !
  2436 !
  2420 
  2437 
  2443     separator := View extent:(50 @ 5) in:bpanel.
  2460     separator := View extent:(50 @ 5) in:bpanel.
  2444     separator borderWidth:0; level:0.
  2461     separator borderWidth:0; level:0.
  2445 
  2462 
  2446     self initializeDefineButtonIn:bpanel.
  2463     self initializeDefineButtonIn:bpanel.
  2447     (UserPreferences current allowSendMailFromDebugger and:[SendMailTool notNil]) ifTrue:[
  2464     (UserPreferences current allowSendMailFromDebugger and:[SendMailTool notNil]) ifTrue:[
  2448 	separator := View extent:(10 @ 5) in:bpanel.
  2465         separator := View extent:(10 @ 5) in:bpanel.
  2449 	separator borderWidth:0; level:0.
  2466         separator borderWidth:0; level:0.
  2450 	self initializeReportButtonIn:bpanel.
  2467         self initializeReportButtonIn:bpanel.
  2451     ].
  2468     ].
  2452     "Modified: / 17.11.2001 / 21:02:59 / cg"
  2469     "Modified: / 17.11.2001 / 21:02:59 / cg"
  2453 !
  2470 !
  2454 
  2471 
  2455 initializeButtons2In:bpanel
  2472 initializeButtons2In:bpanel
  2583     separator := View extent:(30 @ 5) in:bpanel.
  2600     separator := View extent:(30 @ 5) in:bpanel.
  2584     separator borderWidth:0; level:0.
  2601     separator borderWidth:0; level:0.
  2585 
  2602 
  2586     self initializeDefineButtonIn:bpanel.
  2603     self initializeDefineButtonIn:bpanel.
  2587     (UserPreferences current allowSendMailFromDebugger and:[SendMailTool notNil]) ifTrue:[
  2604     (UserPreferences current allowSendMailFromDebugger and:[SendMailTool notNil]) ifTrue:[
  2588 	self initializeReportButtonIn:bpanel.
  2605         self initializeReportButtonIn:bpanel.
  2589     ].
  2606     ].
  2590 
  2607 
  2591 
  2608 
  2592     "Created: / 17.11.2001 / 20:56:20 / cg"
  2609     "Created: / 17.11.2001 / 20:56:20 / cg"
  2593     "Modified: / 17.11.2001 / 21:03:18 / cg"
  2610     "Modified: / 17.11.2001 / 21:03:18 / cg"
  2620 
  2637 
  2621 initializeContextListViewIn:panel
  2638 initializeContextListViewIn:panel
  2622     |v|
  2639     |v|
  2623 
  2640 
  2624     v := HVScrollableView
  2641     v := HVScrollableView
  2625 		for:SelectionInListView
  2642                 for:SelectionInListView
  2626 		miniScrollerH:true
  2643                 miniScrollerH:true
  2627 		miniScrollerV:false
  2644                 miniScrollerV:false
  2628 		in:panel.
  2645                 in:panel.
  2629     v autoHideHorizontalScrollBar:true.
  2646     v autoHideHorizontalScrollBar:true.
  2630 
  2647 
  2631     contextView := v scrolledView.
  2648     contextView := v scrolledView.
  2632     contextView action:[:lineNr | self showSelection:lineNr].
  2649     contextView action:[:lineNr | self showSelection:lineNr].
  2633     contextView doubleClickAction:[:line | self browseImplementingClass].
  2650     contextView doubleClickAction:[:line | self browseImplementingClass].
  2644     contextView middleButtonMenu:(self middleButtonMenu).
  2661     contextView middleButtonMenu:(self middleButtonMenu).
  2645 !
  2662 !
  2646 
  2663 
  2647 initializeContinueButtonIn:bpanel
  2664 initializeContinueButtonIn:bpanel
  2648     continueButton := Button
  2665     continueButton := Button
  2649 		label:(resources string:'Continue')
  2666                 label:(resources string:'Continue')
  2650 		action:[
  2667                 action:[
  2651 		    continueButton turnOffWithoutRedraw.
  2668                     continueButton turnOffWithoutRedraw.
  2652 		    self doContinue
  2669                     self doContinue
  2653 		]
  2670                 ]
  2654 		in:bpanel.
  2671                 in:bpanel.
  2655 
  2672 
  2656     "Created: / 17.11.2001 / 20:57:34 / cg"
  2673     "Created: / 17.11.2001 / 20:57:34 / cg"
  2657 !
  2674 !
  2658 
  2675 
  2659 initializeDefineButtonIn:bpanel
  2676 initializeDefineButtonIn:bpanel
  2660     defineButton := Button
  2677     defineButton := Button
  2661 		label:(resources string:'Define')
  2678                 label:(resources string:'Define')
  2662 		action:[
  2679                 action:[
  2663 		    defineButton turnOffWithoutRedraw.
  2680                     defineButton turnOffWithoutRedraw.
  2664 		    self doDefine
  2681                     self doDefine
  2665 		]
  2682                 ]
  2666 		in:bpanel.
  2683                 in:bpanel.
  2667     defineButton beInvisible
  2684     defineButton beInvisible
  2668 
  2685 
  2669     "Created: / 17.11.2001 / 21:02:48 / cg"
  2686     "Created: / 17.11.2001 / 21:02:48 / cg"
  2670 !
  2687 !
  2671 
  2688 
  2673     |hpanel|
  2690     |hpanel|
  2674 
  2691 
  2675     hpanel := VariableHorizontalPanel in:panel.
  2692     hpanel := VariableHorizontalPanel in:panel.
  2676 
  2693 
  2677     receiverInspector := InspectorView
  2694     receiverInspector := InspectorView
  2678 				origin:(0.0 @ 0.0) corner:(0.5 @ 1.0)
  2695                                 origin:(0.0 @ 0.0) corner:(0.5 @ 1.0)
  2679 				    in:hpanel.
  2696                                     in:hpanel.
  2680     receiverInspector fieldListLabel:'Receiver'.
  2697     receiverInspector fieldListLabel:'Receiver'.
  2681 
  2698 
  2682     contextInspector := ContextInspectorView
  2699     contextInspector := ContextInspectorView
  2683 				origin:(0.5 @ 0.0) corner:(1.0 @ 1.0)
  2700                                 origin:(0.5 @ 0.0) corner:(1.0 @ 1.0)
  2684 				    in:hpanel.
  2701                                     in:hpanel.
  2685     contextInspector fieldListLabel:'Context'.
  2702     contextInspector fieldListLabel:'Context'.
  2686 
  2703 
  2687     ^ hpanel
  2704     ^ hpanel
  2688 !
  2705 !
  2689 
  2706 
  2690 initializeNextButtonIn:bpanel
  2707 initializeNextButtonIn:bpanel
  2691     nextButton := Button
  2708     nextButton := Button
  2692 		label:(resources string:'Debug_Next')
  2709                 label:(resources string:'Debug_Next')
  2693 		action:[
  2710                 action:[
  2694 		    stepButton turnOff.
  2711                     stepButton turnOff.
  2695 		    self doNext
  2712                     self doNext
  2696 		]
  2713                 ]
  2697 		in:bpanel.
  2714                 in:bpanel.
  2698 
  2715 
  2699     "Created: / 17.11.2001 / 20:59:38 / cg"
  2716     "Created: / 17.11.2001 / 20:59:38 / cg"
  2700 !
  2717 !
  2701 
  2718 
  2702 initializeReportButtonIn:bpanel
  2719 initializeReportButtonIn:bpanel
  2703     reportButton := Button
  2720     reportButton := Button
  2704 		label:(resources string:'Report by Mail...')
  2721                 label:(resources string:'Report by Mail...')
  2705 		action:[
  2722                 action:[
  2706 		    reportButton turnOffWithoutRedraw.
  2723                     reportButton turnOffWithoutRedraw.
  2707 		    self doOpenReportMailApp.
  2724                     self doOpenReportMailApp.
  2708 		]
  2725                 ]
  2709 		in:bpanel.
  2726                 in:bpanel.
  2710 
  2727 
  2711     "Created: / 17.11.2001 / 21:02:20 / cg"
  2728     "Created: / 17.11.2001 / 21:02:20 / cg"
  2712 !
  2729 !
  2713 
  2730 
  2714 initializeRestartButtonIn:bpanel
  2731 initializeRestartButtonIn:bpanel
  2715     restartButton := Button
  2732     restartButton := Button
  2716 		label:(resources string:'Restart')
  2733                 label:(resources string:'Restart')
  2717 		action:[
  2734                 action:[
  2718 		    restartButton turnOff.
  2735                     restartButton turnOff.
  2719 		    self doRestart
  2736                     self doRestart
  2720 		]
  2737                 ]
  2721 		in:bpanel.
  2738                 in:bpanel.
  2722 
  2739 
  2723     "Created: / 17.11.2001 / 20:58:52 / cg"
  2740     "Created: / 17.11.2001 / 20:58:52 / cg"
  2724 !
  2741 !
  2725 
  2742 
  2726 initializeReturnButtonIn:bpanel
  2743 initializeReturnButtonIn:bpanel
  2727     returnButton := Button
  2744     returnButton := Button
  2728 		label:(resources string:'Return')
  2745                 label:(resources string:'Return')
  2729 		action:[
  2746                 action:[
  2730 		    returnButton turnOff.
  2747                     returnButton turnOff.
  2731 		    self doReturn
  2748                     self doReturn
  2732 		]
  2749                 ]
  2733 		in:bpanel.
  2750                 in:bpanel.
  2734 
  2751 
  2735     "Created: / 17.11.2001 / 20:58:22 / cg"
  2752     "Created: / 17.11.2001 / 20:58:22 / cg"
  2736 !
  2753 !
  2737 
  2754 
  2738 initializeSendButtonIn:bpanel
  2755 initializeSendButtonIn:bpanel
  2739     sendButton := Button
  2756     sendButton := Button
  2740 		label:(resources string:'Send')
  2757                 label:(resources string:'Send')
  2741 		action:[
  2758                 action:[
  2742 		    sendButton turnOff.
  2759                     sendButton turnOff.
  2743 		    self doSend
  2760                     self doSend
  2744 		]
  2761                 ]
  2745 		in:bpanel.
  2762                 in:bpanel.
  2746 
  2763 
  2747     "Created: / 17.11.2001 / 21:01:20 / cg"
  2764     "Created: / 17.11.2001 / 21:01:20 / cg"
  2748 !
  2765 !
  2749 
  2766 
  2750 initializeStepButtonIn:bpanel
  2767 initializeStepButtonIn:bpanel
  2751     stepButton := Button
  2768     stepButton := Button
  2752 		label:(resources string:'Debug_Step')
  2769                 label:(resources string:'Debug_Step')
  2753 		action:[
  2770                 action:[
  2754 		    stepButton turnOff.
  2771                     stepButton turnOff.
  2755 		    self doStep
  2772                     self doStep
  2756 		]
  2773                 ]
  2757 		in:bpanel.
  2774                 in:bpanel.
  2758 
  2775 
  2759     "Created: / 17.11.2001 / 21:00:13 / cg"
  2776     "Created: / 17.11.2001 / 21:00:13 / cg"
  2760 !
  2777 !
  2761 
  2778 
  2762 initializeTerminateButtonIn:bpanel
  2779 initializeTerminateButtonIn:bpanel
  2763     terminateButton := Button
  2780     terminateButton := Button
  2764 		label:(resources string:'Debug_Terminate')
  2781                 label:(resources string:'Debug_Terminate')
  2765 		action:[
  2782                 action:[
  2766 		    terminateButton turnOffWithoutRedraw.
  2783                     terminateButton turnOffWithoutRedraw.
  2767 		    self doTerminate
  2784                     self doTerminate
  2768 		]
  2785                 ]
  2769 		in:bpanel.
  2786                 in:bpanel.
  2770 
  2787 
  2771     terminateButton backgroundColor:Color red lightened.
  2788     terminateButton backgroundColor:Color red lightened.
  2772     "/ terminateButton foregroundColor:Color red.
  2789     "/ terminateButton foregroundColor:Color red.
  2773 
  2790 
  2774     "Created: / 17.11.2001 / 21:02:20 / cg"
  2791     "Created: / 17.11.2001 / 21:02:20 / cg"
  2776 
  2793 
  2777 postRealize
  2794 postRealize
  2778     super postRealize.
  2795     super postRealize.
  2779 
  2796 
  2780     inspecting ifTrue:[
  2797     inspecting ifTrue:[
  2781 	inspectedProcess notNil ifTrue:[
  2798         inspectedProcess notNil ifTrue:[
  2782 	    "
  2799             "
  2783 	     set prio somewhat higher (by 2, to allow walkBack-update process
  2800              set prio somewhat higher (by 2, to allow walkBack-update process
  2784 	     to run between mine and the debugged processes prio)
  2801              to run between mine and the debugged processes prio)
  2785 	    "
  2802             "
  2786 	    Processor activeProcess
  2803             Processor activeProcess
  2787 		priority:(((inspectedProcess priority + 2) min:(Processor highIOPriority)) max:(Processor userSchedulingPriority+1)).
  2804                 priority:(((inspectedProcess priority + 2) min:(Processor highIOPriority)) max:(Processor userSchedulingPriority+1)).
  2788 	]
  2805         ]
  2789     ].
  2806     ].
  2790 
  2807 
  2791     self sensor addEventListener:self.
  2808     self sensor addEventListener:self.
  2792 
  2809 
  2793     "Created: 24.7.1997 / 18:17:44 / cg"
  2810     "Created: 24.7.1997 / 18:17:44 / cg"
  2796 reinitialize
  2813 reinitialize
  2797     "/ redefined - since the debugView runs on top of
  2814     "/ redefined - since the debugView runs on top of
  2798     "/ the debuggee, there would be no event loop for me.
  2815     "/ the debuggee, there would be no event loop for me.
  2799 
  2816 
  2800     drawableId notNil ifTrue:[
  2817     drawableId notNil ifTrue:[
  2801 	^ self
  2818         ^ self
  2802     ].
  2819     ].
  2803     "physically create the view & subviews"
  2820     "physically create the view & subviews"
  2804     self recreate.
  2821     self recreate.
  2805 
  2822 
  2806 !
  2823 !
  2808 setLabelFor:aMessage in:aProcess
  2825 setLabelFor:aMessage in:aProcess
  2809     |l lines processNameOrNil pidOrNil osPidString|
  2826     |l lines processNameOrNil pidOrNil osPidString|
  2810 
  2827 
  2811     lines := aMessage asStringCollection.
  2828     lines := aMessage asStringCollection.
  2812     lines size > 1 ifTrue:[
  2829     lines size > 1 ifTrue:[
  2813 	l := lines first
  2830         l := lines first
  2814     ] ifFalse:[
  2831     ] ifFalse:[
  2815 	l := aMessage.
  2832         l := aMessage.
  2816     ].
  2833     ].
  2817 
  2834 
  2818     l := l , ' ('.
  2835     l := l , ' ('.
  2819     Error handle:[:ex |
  2836     Error handle:[:ex |
  2820 	l := l , '???'
  2837         l := l , '???'
  2821     ] do:[
  2838     ] do:[
  2822 	processNameOrNil := aProcess name.
  2839         processNameOrNil := aProcess name.
  2823 	processNameOrNil notNil ifTrue:[
  2840         processNameOrNil notNil ifTrue:[
  2824 	    l := l , (processNameOrNil contractTo:20) , ''.
  2841             l := l , (processNameOrNil contractTo:20) , ''.
  2825 	].
  2842         ].
  2826 	pidOrNil := aProcess id printString.
  2843         pidOrNil := aProcess id printString.
  2827 	l := l , '[' , pidOrNil , ']'.
  2844         l := l , '[' , pidOrNil , ']'.
  2828     ].
  2845     ].
  2829     l := l , ')'.
  2846     l := l , ')'.
  2830     self label:l.
  2847     self label:l.
  2831 
  2848 
  2832     ((ShowThreadID == true) and:[OperatingSystem isMSDOSlike]) ifTrue:[
  2849     ((ShowThreadID == true) and:[OperatingSystem isMSDOSlike]) ifTrue:[
  2833 	osPidString := ' {threadID: ',OperatingSystem getThreadId printString,'}'.
  2850         osPidString := ' {threadID: ',OperatingSystem getThreadId printString,'}'.
  2834     ].
  2851     ].
  2835 
  2852 
  2836     exceptionInfoLabel notNil ifTrue:[
  2853     exceptionInfoLabel notNil ifTrue:[
  2837 	exceptionInfoLabel
  2854         exceptionInfoLabel
  2838 	    label:(resources
  2855             label:(resources
  2839 		    string:'Exception: %1 in process %2 [%3]%4'
  2856                     string:'Exception: %1 in process %2 [%3]%4'
  2840 		    with:(lines first colorizeAllWith:Color red)
  2857                     with:(lines first colorizeAllWith:Color red)
  2841 		    with:(processNameOrNil ? '')
  2858                     with:(processNameOrNil ? '')
  2842 		    with:(pidOrNil ? '')
  2859                     with:(pidOrNil ? '')
  2843 		    with:(osPidString ? ''))
  2860                     with:(osPidString ? ''))
  2844     ].
  2861     ].
  2845 
  2862 
  2846     "Modified: / 06-07-2006 / 12:43:19 / cg"
  2863     "Modified: / 06-07-2006 / 12:43:19 / cg"
  2847 ! !
  2864 ! !
  2848 
  2865 
  2849 !DebugView methodsFor:'interrupt handling'!
  2866 !DebugView methodsFor:'interrupt handling'!
  2850 
  2867 
  2851 contextInterrupt
  2868 contextInterrupt
  2852     DebuggingDebugger == true ifTrue:[
  2869     DebuggingDebugger == true ifTrue:[
  2853 	'contextIRQ' printCR.
  2870         'contextIRQ' printCR.
  2854 	thisContext sender fullPrint.
  2871         thisContext sender fullPrint.
  2855     ].
  2872     ].
  2856     self stepOrNext
  2873     self stepOrNext
  2857 
  2874 
  2858     "Modified: / 30.10.1997 / 21:22:25 / cg"
  2875     "Modified: / 30.10.1997 / 21:22:25 / cg"
  2859 !
  2876 !
  2860 
  2877 
  2861 stepInterrupt
  2878 stepInterrupt
  2862     DebuggingDebugger == true ifTrue:[
  2879     DebuggingDebugger == true ifTrue:[
  2863 	'stepIRQ' printCR.
  2880         'stepIRQ' printCR.
  2864 	thisContext sender fullPrint.
  2881         thisContext sender fullPrint.
  2865     ].
  2882     ].
  2866     Processor yield.
  2883     Processor yield.
  2867     self stepOrNext
  2884     self stepOrNext
  2868 
  2885 
  2869     "Modified: / 13.1.1998 / 21:14:11 / cg"
  2886     "Modified: / 13.1.1998 / 21:14:11 / cg"
  2879     "/ DebuggingDebugger := false
  2896     "/ DebuggingDebugger := false
  2880 
  2897 
  2881     processName := (Processor activeProcess nameOrId),' [',Processor activeProcess id printString,']'.
  2898     processName := (Processor activeProcess nameOrId),' [',Processor activeProcess id printString,']'.
  2882 
  2899 
  2883     skipLineNr == #return ifTrue:[
  2900     skipLineNr == #return ifTrue:[
  2884 	self label:('stepping context returned ' , ' (process: ' , processName , ')').
  2901         self label:('stepping context returned ' , ' (process: ' , processName , ')').
  2885 	here := thisContext sender sender.
  2902         here := thisContext sender sender.
  2886 	here setLineNumber:nil.
  2903         here setLineNumber:nil.
  2887 	here := nil.
  2904         here := nil.
  2888 	con := thisContext sender sender sender.
  2905         con := thisContext sender sender sender.
  2889 
  2906 
  2890 	HaltInterrupt handle:[:ex |
  2907         HaltInterrupt handle:[:ex |
  2891 	    ('DebugView [info]: halt/breakpoint in debugger at %1 ignored [stepOrNext]' bindWith:ex suspendedContext) infoPrintCR.
  2908             ('DebugView [info]: halt/breakpoint in debugger at %1 ignored [stepOrNext]' bindWith:ex suspendedContext) infoPrintCR.
  2892 	    ex proceed
  2909             ex proceed
  2893 	] do:[
  2910         ] do:[
  2894 	    self enter:con select:nil.
  2911             self enter:con select:nil.
  2895 	].
  2912         ].
  2896 	con := nil.
  2913         con := nil.
  2897 	^ self
  2914         ^ self
  2898     ].
  2915     ].
  2899 
  2916 
  2900 "/    "/
  2917 "/    "/
  2901 "/    "/ should no longer happen
  2918 "/    "/ should no longer happen
  2902 "/    "/
  2919 "/    "/
  2905 "/        self enter:thisContext sender.
  2922 "/        self enter:thisContext sender.
  2906 "/        ^ self
  2923 "/        ^ self
  2907 "/    ].
  2924 "/    ].
  2908 
  2925 
  2909     Processor activeProcess ~~ inspectedProcess ifTrue:[
  2926     Processor activeProcess ~~ inspectedProcess ifTrue:[
  2910 	'DebugView [info]: stray step interrupt' infoPrintCR.
  2927         'DebugView [info]: stray step interrupt' infoPrintCR.
  2911 	^ self
  2928         ^ self
  2912     ].
  2929     ].
  2913 
  2930 
  2914     here := thisContext.        "stepInterrupt"
  2931     here := thisContext.        "stepInterrupt"
  2915     here := here sender.        "the caller; step- or contextIRQ"
  2932     here := here sender.        "the caller; step- or contextIRQ"
  2916     here := here sender.        "the interrupted context"
  2933     here := here sender.        "the interrupted context"
  2917 
  2934 
  2918     DebuggingDebugger == true ifTrue:[
  2935     DebuggingDebugger == true ifTrue:[
  2919 	'*******' printCR.
  2936         '*******' printCR.
  2920 	'here in ' print.
  2937         'here in ' print.
  2921 	inWrap ifTrue:['(wrap) ' print.].
  2938         inWrap ifTrue:['(wrap) ' print.].
  2922 	((ObjectMemory addressOf:here) printStringRadix:16) print. ' ' print.
  2939         ((ObjectMemory addressOf:here) printStringRadix:16) print. ' ' print.
  2923 	here selector printCR.
  2940         here selector printCR.
  2924     ].
  2941     ].
  2925 
  2942 
  2926     "/ kludge an bug-workaround;
  2943     "/ kludge an bug-workaround;
  2927     "/ I should not see those ...
  2944     "/ I should not see those ...
  2928 
  2945 
  2929     here selector == #ioInterrupt ifTrue:[
  2946     here selector == #ioInterrupt ifTrue:[
  2930 	DebuggingDebugger == true ifTrue:[
  2947         DebuggingDebugger == true ifTrue:[
  2931 	    'oops - should not get that one' printCR.
  2948             'oops - should not get that one' printCR.
  2932 	].
  2949         ].
  2933 	Processor ioInterrupt.
  2950         Processor ioInterrupt.
  2934 	StepInterruptPending := 1.
  2951         StepInterruptPending := 1.
  2935 	InterruptPending := 1.
  2952         InterruptPending := 1.
  2936 	where := nil. here := nil.
  2953         where := nil. here := nil.
  2937 	InStepInterrupt := nil.
  2954         InStepInterrupt := nil.
  2938 	^ self
  2955         ^ self
  2939     ].
  2956     ].
  2940 
  2957 
  2941     stepUntilEntering notNil ifTrue:[
  2958     stepUntilEntering notNil ifTrue:[
  2942 	DebuggingDebugger == true ifTrue:[
  2959         DebuggingDebugger == true ifTrue:[
  2943 	    'check if entering ' print. stepUntilEntering printCR.
  2960             'check if entering ' print. stepUntilEntering printCR.
  2944 	].
  2961         ].
  2945 	(stepUntilEntering match:here selector) ifTrue:[
  2962         (stepUntilEntering match:here selector) ifTrue:[
  2946 	    DebuggingDebugger == true ifTrue:[
  2963             DebuggingDebugger == true ifTrue:[
  2947 		'entering...' printCR.
  2964                 'entering...' printCR.
  2948 	    ].
  2965             ].
  2949 	    self label:('arrived at ' , stepUntilEntering , ' (process: ' , processName , ')').
  2966             self label:('arrived at ' , stepUntilEntering , ' (process: ' , processName , ')').
  2950 
  2967 
  2951 	    lastStepUntilEntering := stepUntilEntering.
  2968             lastStepUntilEntering := stepUntilEntering.
  2952 	    stepUntilEntering := nil.
  2969             stepUntilEntering := nil.
  2953 	    self enter:here select:nil.
  2970             self enter:here select:nil.
  2954 	    con := nil.
  2971             con := nil.
  2955 	    ^ self
  2972             ^ self
  2956 	].
  2973         ].
  2957 	"/ see if stepping context is still active ...
  2974         "/ see if stepping context is still active ...
  2958 
  2975 
  2959 	con := here.
  2976         con := here.
  2960 
  2977 
  2961 	DebuggingDebugger == true ifTrue:[
  2978         DebuggingDebugger == true ifTrue:[
  2962 	    'start searching at: ' print.
  2979             'start searching at: ' print.
  2963 	    con fullPrint.
  2980             con fullPrint.
  2964 	].
  2981         ].
  2965 	[con notNil and:[con ~~ steppedContext]] whileTrue:[
  2982         [con notNil and:[con ~~ steppedContext]] whileTrue:[
  2966 	    con := con sender
  2983             con := con sender
  2967 	].
  2984         ].
  2968 	con notNil ifTrue:[
  2985         con notNil ifTrue:[
  2969 	    DebuggingDebugger == true ifTrue:[
  2986             DebuggingDebugger == true ifTrue:[
  2970 		'steppingContext still active - continue stepping' printCR.
  2987                 'steppingContext still active - continue stepping' printCR.
  2971 	    ].
  2988             ].
  2972 	    con := nil.
  2989             con := nil.
  2973 	    where := nil. here := nil.
  2990             where := nil. here := nil.
  2974 	    StepInterruptPending := 1.
  2991             StepInterruptPending := 1.
  2975 	    InterruptPending := 1.
  2992             InterruptPending := 1.
  2976 	    InStepInterrupt := nil.
  2993             InStepInterrupt := nil.
  2977 	    ^ self
  2994             ^ self
  2978 	].
  2995         ].
  2979 	stepUntilEntering := nil.
  2996         stepUntilEntering := nil.
  2980     ].
  2997     ].
  2981 
  2998 
  2982     "
  2999     "
  2983      kludge to hide breakpoint wrappers in the context list:
  3000      kludge to hide breakpoint wrappers in the context list:
  2984 	 check if we are in a wrapper methods hidden setup-sequence
  3001          check if we are in a wrapper methods hidden setup-sequence
  2985 	 if so, ignore the interrupt and continue single sending
  3002          if so, ignore the interrupt and continue single sending
  2986     "
  3003     "
  2987     isWrap := false.
  3004     isWrap := false.
  2988     left := false.
  3005     left := false.
  2989     leftWrap := enteredWrap := false.
  3006     leftWrap := enteredWrap := false.
  2990 
  3007 
  2991     where := here.
  3008     where := here.
  2992     inWrap ifTrue:[
  3009     inWrap ifTrue:[
  2993 	wrappedMethod := nil.
  3010         wrappedMethod := nil.
  2994 	5 timesRepeat:[
  3011         5 timesRepeat:[
  2995 	    (where notNil and:[where isBlockContext not]) ifTrue:[
  3012             (where notNil and:[where isBlockContext not]) ifTrue:[
  2996 		method := where method.
  3013                 method := where method.
  2997 		(method notNil and:[method isWrapped]) ifTrue:[
  3014                 (method notNil and:[method isWrapped]) ifTrue:[
  2998 		    "
  3015                     "
  2999 		     in a wrapper method
  3016                      in a wrapper method
  3000 		    "
  3017                     "
  3001 		    wrappedMethod ~~ method ifTrue:[
  3018                     wrappedMethod ~~ method ifTrue:[
  3002 			wrappedMethod := method.
  3019                         wrappedMethod := method.
  3003 			lastWrappedContext := where.
  3020                         lastWrappedContext := where.
  3004 			where sender receiver == method originalMethod ifFalse:[
  3021                         where sender receiver == method originalMethod ifFalse:[
  3005 			    isWrap := true.
  3022                             isWrap := true.
  3006 			]
  3023                         ]
  3007 		    ] ifFalse:[
  3024                     ] ifFalse:[
  3008 			where == steppedContext ifTrue:[
  3025                         where == steppedContext ifTrue:[
  3009 
  3026 
  3010 			    DebuggingDebugger == true ifTrue:[
  3027                             DebuggingDebugger == true ifTrue:[
  3011 				'change stepCon from: ' print.
  3028                                 'change stepCon from: ' print.
  3012 				steppedContext print.
  3029                                 steppedContext print.
  3013 				' to lastWrapped: ' print.
  3030                                 ' to lastWrapped: ' print.
  3014 				lastWrappedContext printCR.
  3031                                 lastWrappedContext printCR.
  3015 			    ].
  3032                             ].
  3016 
  3033 
  3017 			    inWrap := false.
  3034                             inWrap := false.
  3018 			    leftWrap := true.
  3035                             leftWrap := true.
  3019 			    wrapperContext := steppedContext.
  3036                             wrapperContext := steppedContext.
  3020 			    steppedContext := lastWrappedContext
  3037                             steppedContext := lastWrappedContext
  3021 			]
  3038                         ]
  3022 		    ]
  3039                     ]
  3023 		].
  3040                 ].
  3024 		where := where sender
  3041                 where := where sender
  3025 	    ]
  3042             ]
  3026 	].
  3043         ].
  3027     ].
  3044     ].
  3028 
  3045 
  3029     isWrap ifTrue:[
  3046     isWrap ifTrue:[
  3030 	DebuggingDebugger == true ifTrue:[
  3047         DebuggingDebugger == true ifTrue:[
  3031 	    'ignore wrap' printCR.
  3048             'ignore wrap' printCR.
  3032 	].
  3049         ].
  3033 
  3050 
  3034 	"/
  3051         "/
  3035 	"/ ignore, while in wrappers hidden setup
  3052         "/ ignore, while in wrappers hidden setup
  3036 	"/
  3053         "/
  3037 	where := nil. here := nil.
  3054         where := nil. here := nil.
  3038 	ObjectMemory flushInlineCaches.
  3055         ObjectMemory flushInlineCaches.
  3039 
  3056 
  3040 	skipLineNr == #return ifTrue:[
  3057         skipLineNr == #return ifTrue:[
  3041 	    DebuggingDebugger == true ifTrue:[
  3058             DebuggingDebugger == true ifTrue:[
  3042 		'skipRet in wrap' printCR.
  3059                 'skipRet in wrap' printCR.
  3043 	    ]
  3060             ]
  3044 	].
  3061         ].
  3045 
  3062 
  3046 	StepInterruptPending := 1.
  3063         StepInterruptPending := 1.
  3047 	InterruptPending := 1.
  3064         InterruptPending := 1.
  3048 	InStepInterrupt := nil.
  3065         InStepInterrupt := nil.
  3049 	^ self
  3066         ^ self
  3050     ].
  3067     ].
  3051 
  3068 
  3052     inBlock := inBlockBelow := anyStepBlocks := false.
  3069     inBlock := inBlockBelow := anyStepBlocks := false.
  3053 
  3070 
  3054     DebuggingDebugger == true ifTrue:[
  3071     DebuggingDebugger == true ifTrue:[
  3055 	'bigStep is: ' print. bigStep printCR.
  3072         'bigStep is: ' print. bigStep printCR.
  3056 	'steppedContext is: ' print. steppedContext printCR.
  3073         'steppedContext is: ' print. steppedContext printCR.
  3057     ].
  3074     ].
  3058 
  3075 
  3059     "/
  3076     "/
  3060     "/ is this for a send or a step/next ?
  3077     "/ is this for a send or a step/next ?
  3061     "/
  3078     "/
  3062     (bigStep
  3079     (bigStep
  3063     and:[steppedContext notNil]) ifTrue:[
  3080     and:[steppedContext notNil]) ifTrue:[
  3064 	"
  3081         "
  3065 	 a step or next - ignore all contexts below the interesting one
  3082          a step or next - ignore all contexts below the interesting one
  3066 	"
  3083         "
  3067 	where := here.      "the interrupted context"
  3084         where := here.      "the interrupted context"
  3068 	contextBelow := nil.
  3085         contextBelow := nil.
  3069 
  3086 
  3070 	where home notNil ifTrue:[
  3087         where home notNil ifTrue:[
  3071 	    "/
  3088             "/
  3072 	    "/ in a block called by 'our' context ?
  3089             "/ in a block called by 'our' context ?
  3073 	    "/
  3090             "/
  3074 	    where home == steppedContext ifTrue:[
  3091             where home == steppedContext ifTrue:[
  3075 "/ '*block*' printCR.
  3092 "/ '*block*' printCR.
  3076 		inBlock := true
  3093                 inBlock := true
  3077 	    ]
  3094             ]
  3078 	].
  3095         ].
  3079 
  3096 
  3080 	where == steppedContext ifFalse:[
  3097         where == steppedContext ifFalse:[
  3081 	    where := where sender.
  3098             where := where sender.
  3082 
  3099 
  3083 	    where notNil ifTrue:[
  3100             where notNil ifTrue:[
  3084 		where home == steppedContext ifTrue:[
  3101                 where home == steppedContext ifTrue:[
  3085 "/ '*block*' printCR.
  3102 "/ '*block*' printCR.
  3086 		    inBlock := true.
  3103                     inBlock := true.
  3087 		]
  3104                 ]
  3088 	    ].
  3105             ].
  3089 
  3106 
  3090 "/ 'looking for ' print.
  3107 "/ 'looking for ' print.
  3091 "/  (steppedContextAddress printStringRadix:16)print. '' printCR.
  3108 "/  (steppedContextAddress printStringRadix:16)print. '' printCR.
  3092 
  3109 
  3093 "/where print. ' ' print. ((ObjectMemory addressOf:where)printStringRadix:16) printCR.
  3110 "/where print. ' ' print. ((ObjectMemory addressOf:where)printStringRadix:16) printCR.
  3094 "/steppedContext print. ' ' print. ((ObjectMemory addressOf:steppedContext)printStringRadix:16) printCR.
  3111 "/steppedContext print. ' ' print. ((ObjectMemory addressOf:steppedContext)printStringRadix:16) printCR.
  3095 
  3112 
  3096 	    where == steppedContext ifFalse:[
  3113             where == steppedContext ifFalse:[
  3097 
  3114 
  3098 		"/ check if we are in a context below steppedContext
  3115                 "/ check if we are in a context below steppedContext
  3099 		"/ (i.e. if steppedContext can be reached from
  3116                 "/ (i.e. if steppedContext can be reached from
  3100 		"/  interrupted context. Not using context-ref but its
  3117                 "/  interrupted context. Not using context-ref but its
  3101 		"/  address to avoid creation of many useless contexts.)
  3118                 "/  address to avoid creation of many useless contexts.)
  3102 
  3119 
  3103 		inBlock ifFalse:[
  3120                 inBlock ifFalse:[
  3104 		    [where notNil] whileTrue:[
  3121                     [where notNil] whileTrue:[
  3105 
  3122 
  3106 			"/ if either the receiver or any arg of this context
  3123                         "/ if either the receiver or any arg of this context
  3107 			"/ is a block of the steppedContext, we must really
  3124                         "/ is a block of the steppedContext, we must really
  3108 			"/ do a single step. Otherwise, stepping through a
  3125                         "/ do a single step. Otherwise, stepping through a
  3109 			"/ do:-loop would be very difficult.
  3126                         "/ do:-loop would be very difficult.
  3110 			receiver := where receiver.
  3127                         receiver := where receiver.
  3111 			(receiver isBlock
  3128                         (receiver isBlock
  3112 			and:[(receiver isKindOf:Block)
  3129                         and:[(receiver isKindOf:Block)
  3113 			and:[receiver home == steppedContext]])
  3130                         and:[receiver home == steppedContext]])
  3114 			ifTrue:[
  3131                         ifTrue:[
  3115 			    anyStepBlocks := true.
  3132                             anyStepBlocks := true.
  3116 			] ifFalse:[
  3133                         ] ifFalse:[
  3117 			    where args do:[:arg |
  3134                             where args do:[:arg |
  3118 				(arg isBlock
  3135                                 (arg isBlock
  3119 				and:[(arg isKindOf:Block)
  3136                                 and:[(arg isKindOf:Block)
  3120 				and:[arg home == steppedContext]])
  3137                                 and:[arg home == steppedContext]])
  3121 				ifTrue:[
  3138                                 ifTrue:[
  3122 				    anyStepBlocks := true.
  3139                                     anyStepBlocks := true.
  3123 				]
  3140                                 ]
  3124 			    ]
  3141                             ]
  3125 			].
  3142                         ].
  3126 
  3143 
  3127 			DebuggingDebugger == true ifTrue:[
  3144                         DebuggingDebugger == true ifTrue:[
  3128 			    ((ObjectMemory addressOf:where) printStringRadix:16)print. ' ' print.
  3145                             ((ObjectMemory addressOf:where) printStringRadix:16)print. ' ' print.
  3129 			    where selector printCR.
  3146                             where selector printCR.
  3130 			].
  3147                         ].
  3131 
  3148 
  3132 			where == steppedContext ifTrue:[
  3149                         where == steppedContext ifTrue:[
  3133 "/ 'found it - below; ignore' printCR.
  3150 "/ 'found it - below; ignore' printCR.
  3134 			    "
  3151                             "
  3135 			     found the interesting context somwehere up in the
  3152                              found the interesting context somwehere up in the
  3136 			     chain. We seem to be still below the interesting one ...
  3153                              chain. We seem to be still below the interesting one ...
  3137 			    "
  3154                             "
  3138 			    tracing == true ifTrue:[
  3155                             tracing == true ifTrue:[
  3139 				here printString printCR
  3156                                 here printString printCR
  3140 			    ].
  3157                             ].
  3141 			    "
  3158                             "
  3142 			      yes, a context below
  3159                               yes, a context below
  3143 			      - continue and schedule another stepInterrupt.
  3160                               - continue and schedule another stepInterrupt.
  3144 			      Must flush caches since optimized methods not always
  3161                               Must flush caches since optimized methods not always
  3145 			      look for pending interrupts
  3162                               look for pending interrupts
  3146 			    "
  3163                             "
  3147 
  3164 
  3148 			    contextBelow notNil ifTrue:[
  3165                             contextBelow notNil ifTrue:[
  3149 "/ 'prepare for unwind-catch' printCR.
  3166 "/ 'prepare for unwind-catch' printCR.
  3150 "/ 'con= ' print. contextBelow printCR.
  3167 "/ 'con= ' print. contextBelow printCR.
  3151 "/                                contextBelow selector notNil ifTrue:[
  3168 "/                                contextBelow selector notNil ifTrue:[
  3152 "/                                    self label:'single stepping - please wait ...(' , contextBelow selector , ')'.
  3169 "/                                    self label:'single stepping - please wait ...(' , contextBelow selector , ')'.
  3153 "/                                ].
  3170 "/                                ].
  3154 
  3171 
  3155 				DebuggingDebugger == true ifTrue:[
  3172                                 DebuggingDebugger == true ifTrue:[
  3156 				    'below stepCon; continue until unwind of: ' print.
  3173                                     'below stepCon; continue until unwind of: ' print.
  3157 				    contextBelow printCR.
  3174                                     contextBelow printCR.
  3158 				].
  3175                                 ].
  3159 				Processor activeProcess forceInterruptOnReturnOf:contextBelow.
  3176                                 Processor activeProcess forceInterruptOnReturnOf:contextBelow.
  3160 				StepInterruptPending := nil.
  3177                                 StepInterruptPending := nil.
  3161 			    ] ifFalse:[
  3178                             ] ifFalse:[
  3162 				ObjectMemory flushInlineCaches.
  3179                                 ObjectMemory flushInlineCaches.
  3163 
  3180 
  3164 "/                                here selector notNil ifTrue:[
  3181 "/                                here selector notNil ifTrue:[
  3165 "/                                    self label:'single stepping - please wait ...(' , here selector , ')'.
  3182 "/                                    self label:'single stepping - please wait ...(' , here selector , ')'.
  3166 "/                                ].
  3183 "/                                ].
  3167 
  3184 
  3168 				DebuggingDebugger == true ifTrue:[
  3185                                 DebuggingDebugger == true ifTrue:[
  3169 				    'in stepCon; continue single stepping' printCR.
  3186                                     'in stepCon; continue single stepping' printCR.
  3170 				].
  3187                                 ].
  3171 				StepInterruptPending := 1.
  3188                                 StepInterruptPending := 1.
  3172 				InterruptPending := 1.
  3189                                 InterruptPending := 1.
  3173 			    ].
  3190                             ].
  3174 			    where := nil. here := nil.
  3191                             where := nil. here := nil.
  3175 			    InStepInterrupt := nil.
  3192                             InStepInterrupt := nil.
  3176 
  3193 
  3177 			    ^ self
  3194                             ^ self
  3178 			].
  3195                         ].
  3179 
  3196 
  3180 			(steppedContext notNil and:[
  3197                         (steppedContext notNil and:[
  3181 			 where methodHome == steppedContext methodHome]) ifTrue:[
  3198                          where methodHome == steppedContext methodHome]) ifTrue:[
  3182 			    inBlockBelow := true.
  3199                             inBlockBelow := true.
  3183 			].
  3200                         ].
  3184 
  3201 
  3185 			anyStepBlocks ifFalse:[
  3202                         anyStepBlocks ifFalse:[
  3186 			    inBlock ifFalse:[
  3203                             inBlock ifFalse:[
  3187 "/ workaround a VM bug,
  3204 "/ workaround a VM bug,
  3188 "/ which does not honor interrupt-on-return of block contexts
  3205 "/ which does not honor interrupt-on-return of block contexts
  3189 "/ sigh
  3206 "/ sigh
  3190 where isBlockContext ifFalse:[
  3207 where isBlockContext ifFalse:[
  3191 				contextBelow := where
  3208                                 contextBelow := where
  3192 ].
  3209 ].
  3193 			    ]
  3210                             ]
  3194 			].
  3211                         ].
  3195 			where := where sender
  3212                         where := where sender
  3196 		    ].
  3213                     ].
  3197 		    s := 'context returned'.
  3214                     s := 'context returned'.
  3198 		    left := true.
  3215                     left := true.
  3199 		].
  3216                 ].
  3200 	    ] ifTrue:[
  3217             ] ifTrue:[
  3201 "/ 'found it right in sender' printCR.
  3218 "/ 'found it right in sender' printCR.
  3202 		s := 'after step'
  3219                 s := 'after step'
  3203 	    ].
  3220             ].
  3204 	] ifTrue:[
  3221         ] ifTrue:[
  3205 "/ 'found it right away' printCR.
  3222 "/ 'found it right away' printCR.
  3206 	    s := 'after step'
  3223             s := 'after step'
  3207 	].
  3224         ].
  3208     ] ifFalse:[
  3225     ] ifFalse:[
  3209 "/ ' send' printCR.
  3226 "/ ' send' printCR.
  3210 	"
  3227         "
  3211 	 a send
  3228          a send
  3212 	"
  3229         "
  3213 	DebuggingDebugger == true ifTrue:[
  3230         DebuggingDebugger == true ifTrue:[
  3214 	    'clear steppedContext' printCR.
  3231             'clear steppedContext' printCR.
  3215 	].
  3232         ].
  3216 	steppedContext := nil.
  3233         steppedContext := nil.
  3217 	s := 'after send'
  3234         s := 'after send'
  3218     ].
  3235     ].
  3219 
  3236 
  3220     ignore := false.
  3237     ignore := false.
  3221     (inBlock and:[stepHow == #nextOver or:[stepHow == #nextOut]]) ifTrue:[
  3238     (inBlock and:[stepHow == #nextOver or:[stepHow == #nextOut]]) ifTrue:[
  3222 	ignore := true.
  3239         ignore := true.
  3223     ].
  3240     ].
  3224 
  3241 
  3225     "/ handle the case, when a subBlock leaves;
  3242     "/ handle the case, when a subBlock leaves;
  3226     "/ continue stepping in the home context.
  3243     "/ continue stepping in the home context.
  3227 
  3244 
  3228     left ifTrue:[
  3245     left ifTrue:[
  3229 	steppedContext home notNil ifTrue:[
  3246         steppedContext home notNil ifTrue:[
  3230 	    steppedContext := steppedContext home.
  3247             steppedContext := steppedContext home.
  3231 	    s := 'after step'.
  3248             s := 'after step'.
  3232 	    left := false.
  3249             left := false.
  3233 "/ DebugView enterUnconditional:thisContext withMessage:'debug'.
  3250 "/ DebugView enterUnconditional:thisContext withMessage:'debug'.
  3234 
  3251 
  3235 	]
  3252         ]
  3236     ].
  3253     ].
  3237 
  3254 
  3238     "
  3255     "
  3239      kludge to hide breakpoint wrappers in the context list:
  3256      kludge to hide breakpoint wrappers in the context list:
  3240 	 check if we are in a wrapper methods hidden exit-sequence
  3257          check if we are in a wrapper methods hidden exit-sequence
  3241 	 if so, ignore the interrupt and continue single sending
  3258          if so, ignore the interrupt and continue single sending
  3242     "
  3259     "
  3243     (where isNil
  3260     (where isNil
  3244     and:[wrapperContext notNil])
  3261     and:[wrapperContext notNil])
  3245     ifTrue:[
  3262     ifTrue:[
  3246 	"/ did not find our steppedContext along the chain;
  3263         "/ did not find our steppedContext along the chain;
  3247 	"/ could be in a wrappedMethods exitBlock ...
  3264         "/ could be in a wrappedMethods exitBlock ...
  3248 
  3265 
  3249 	leftWrap ifFalse:[
  3266         leftWrap ifFalse:[
  3250 	    where := here.
  3267             where := here.
  3251 	    wrappedMethod := nil.
  3268             wrappedMethod := nil.
  3252 	    5 timesRepeat:[
  3269             5 timesRepeat:[
  3253 		where notNil ifTrue:[
  3270                 where notNil ifTrue:[
  3254 		    where isBlockContext ifFalse:[
  3271                     where isBlockContext ifFalse:[
  3255 			method := where method.
  3272                         method := where method.
  3256 			(method notNil and:[method isWrapped]) ifTrue:[
  3273                         (method notNil and:[method isWrapped]) ifTrue:[
  3257 			    where == wrapperContext ifTrue:[
  3274                             where == wrapperContext ifTrue:[
  3258 				DebuggingDebugger == true ifTrue:[
  3275                                 DebuggingDebugger == true ifTrue:[
  3259 				    'change stepCon fromWrapped: ' print.
  3276                                     'change stepCon fromWrapped: ' print.
  3260 				    steppedContext print.
  3277                                     steppedContext print.
  3261 				    ' to: ' print.
  3278                                     ' to: ' print.
  3262 				    wrapperContext printCR.
  3279                                     wrapperContext printCR.
  3263 				].
  3280                                 ].
  3264 
  3281 
  3265 				inWrap := true.
  3282                                 inWrap := true.
  3266 				enteredWrap := true.
  3283                                 enteredWrap := true.
  3267 				steppedContext := wrapperContext.
  3284                                 steppedContext := wrapperContext.
  3268 				wrapperContext := nil.
  3285                                 wrapperContext := nil.
  3269 			    ]
  3286                             ]
  3270 			].
  3287                         ].
  3271 		    ].
  3288                     ].
  3272 		    where := where sender
  3289                     where := where sender
  3273 		]
  3290                 ]
  3274 	    ].
  3291             ].
  3275 	].
  3292         ].
  3276 	enteredWrap ifTrue:[
  3293         enteredWrap ifTrue:[
  3277 	    ignore := true
  3294             ignore := true
  3278 	]
  3295         ]
  3279     ].
  3296     ].
  3280 
  3297 
  3281     "/
  3298     "/
  3282 
  3299 
  3283     left ifTrue:[
  3300     left ifTrue:[
  3284 	"/ special care for stepInterrupt in send,
  3301         "/ special care for stepInterrupt in send,
  3285 	"/ when created a dummy context (lineNr == 1)
  3302         "/ when created a dummy context (lineNr == 1)
  3286 
  3303 
  3287 	steppedContext lineNumber isNil ifTrue:[
  3304         steppedContext lineNumber isNil ifTrue:[
  3288 	    steppedContext selector == here sender selector ifTrue:[
  3305             steppedContext selector == here sender selector ifTrue:[
  3289 		left := false.
  3306                 left := false.
  3290 		s := 'after step'.
  3307                 s := 'after step'.
  3291 		steppedContext := here sender.
  3308                 steppedContext := here sender.
  3292 	    ].
  3309             ].
  3293 	].
  3310         ].
  3294 	oneMore := true
  3311         oneMore := true
  3295     ].
  3312     ].
  3296 
  3313 
  3297     inBlock ifTrue:[
  3314     inBlock ifTrue:[
  3298 "/ 'inBlock' printCR.
  3315 "/ 'inBlock' printCR.
  3299 	s := 'in block'.
  3316         s := 'in block'.
  3300     ].
  3317     ].
  3301     inBlockBelow ifTrue:[
  3318     inBlockBelow ifTrue:[
  3302 	ignore := true
  3319         ignore := true
  3303     ].
  3320     ].
  3304 
  3321 
  3305     DebuggingDebugger == true ifTrue:[
  3322     DebuggingDebugger == true ifTrue:[
  3306 	where notNil ifTrue:[
  3323         where notNil ifTrue:[
  3307 	    '(' print. steppedContextLineno print. ') ' print.
  3324             '(' print. steppedContextLineno print. ') ' print.
  3308 	    where printCR.
  3325             where printCR.
  3309 	].
  3326         ].
  3310     ].
  3327     ].
  3311 
  3328 
  3312     ignore ifFalse:[
  3329     ignore ifFalse:[
  3313 	(bigStep
  3330         (bigStep
  3314 	and:[steppedContextLineno notNil
  3331         and:[steppedContextLineno notNil
  3315 	and:[where notNil
  3332         and:[where notNil
  3316 	and:[where lineNumber == steppedContextLineno]]]) ifTrue:[
  3333         and:[where lineNumber == steppedContextLineno]]]) ifTrue:[
  3317 	    (here isBlockContext
  3334             (here isBlockContext
  3318 	    and:[(here methodHome == steppedContext)
  3335             and:[(here methodHome == steppedContext)
  3319 		 or:[here home == steppedContext]]) ifTrue:[
  3336                  or:[here home == steppedContext]]) ifTrue:[
  3320 		DebuggingDebugger == true ifTrue:[
  3337                 DebuggingDebugger == true ifTrue:[
  3321 		    'same line but in block' printCR.
  3338                     'same line but in block' printCR.
  3322 		].
  3339                 ].
  3323 
  3340 
  3324 		steppedContext := actualContext := here.
  3341                 steppedContext := actualContext := here.
  3325 		steppedContextLineno := here lineNumber.
  3342                 steppedContextLineno := here lineNumber.
  3326 	    ] ifFalse:[
  3343             ] ifFalse:[
  3327 		"/ kludge - I only have the info for up to 255 lines
  3344                 "/ kludge - I only have the info for up to 255 lines
  3328 		steppedContextLineno ~~ 255 ifTrue:[
  3345                 steppedContextLineno ~~ 255 ifTrue:[
  3329 		    DebuggingDebugger == true ifTrue:[
  3346                     DebuggingDebugger == true ifTrue:[
  3330 			'same line - ignored' printCR.
  3347                         'same line - ignored' printCR.
  3331 		    ].
  3348                     ].
  3332 		    ignore := true
  3349                     ignore := true
  3333 		].
  3350                 ].
  3334 	    ].
  3351             ].
  3335 	].
  3352         ].
  3336 
  3353 
  3337 	(left not
  3354         (left not
  3338 	and:[skipLineNr notNil
  3355         and:[skipLineNr notNil
  3339 	and:[where notNil
  3356         and:[where notNil
  3340 	and:[where lineNumber notNil
  3357         and:[where lineNumber notNil
  3341 	and:[where lineNumber < skipLineNr]]]]) ifTrue:[
  3358         and:[where lineNumber < skipLineNr]]]]) ifTrue:[
  3342 	    DebuggingDebugger == true ifTrue:[
  3359             DebuggingDebugger == true ifTrue:[
  3343 		'skip (' print. skipLineNr print. ' unreached - ignored' printCR.
  3360                 'skip (' print. skipLineNr print. ' unreached - ignored' printCR.
  3344 	    ].
  3361             ].
  3345 	    ignore := true
  3362             ignore := true
  3346 	].
  3363         ].
  3347 
  3364 
  3348 	(steppedContextLineno isNil
  3365         (steppedContextLineno isNil
  3349 	and:[skipLineNr isNil
  3366         and:[skipLineNr isNil
  3350 	and:[thisContext sender selector == #contextInterrupt]]) ifTrue:[
  3367         and:[thisContext sender selector == #contextInterrupt]]) ifTrue:[
  3351 	    DebuggingDebugger == true ifTrue:[
  3368             DebuggingDebugger == true ifTrue:[
  3352 		'same line2 (after conIRQ) - ignored' printCR.
  3369                 'same line2 (after conIRQ) - ignored' printCR.
  3353 	    ].
  3370             ].
  3354 	    ignore := true
  3371             ignore := true
  3355 	].
  3372         ].
  3356     ].
  3373     ].
  3357 
  3374 
  3358     ignore ifTrue:[
  3375     ignore ifTrue:[
  3359 "/' ' printCR.
  3376 "/' ' printCR.
  3360 	where := nil. here := nil.
  3377         where := nil. here := nil.
  3361 	"
  3378         "
  3362 	 yes, a context below
  3379          yes, a context below
  3363 	  - continue and schedule another stepInterrupt.
  3380           - continue and schedule another stepInterrupt.
  3364 	  Must flush caches since optimized methods not always
  3381           Must flush caches since optimized methods not always
  3365 	  look for pending interrupts
  3382           look for pending interrupts
  3366 	"
  3383         "
  3367 	ObjectMemory flushInlineCaches.
  3384         ObjectMemory flushInlineCaches.
  3368 	StepInterruptPending := 1.
  3385         StepInterruptPending := 1.
  3369 	InterruptPending := 1.
  3386         InterruptPending := 1.
  3370 	InStepInterrupt := nil.
  3387         InStepInterrupt := nil.
  3371 	^ self
  3388         ^ self
  3372     ].
  3389     ].
  3373 
  3390 
  3374 "/ ' ' printCR.
  3391 "/ ' ' printCR.
  3375 
  3392 
  3376     self label:(s , ' (process: ' , processName , ')').
  3393     self label:(s , ' (process: ' , processName , ')').
  3381     "release refs to context"
  3398     "release refs to context"
  3382     where := nil. here := nil.
  3399     where := nil. here := nil.
  3383 "/'enter' printCR.
  3400 "/'enter' printCR.
  3384 
  3401 
  3385     DebuggingDebugger == true ifTrue:[
  3402     DebuggingDebugger == true ifTrue:[
  3386 	'==> enter on: ' print. thisContext sender sender printCR.
  3403         '==> enter on: ' print. thisContext sender sender printCR.
  3387     ].
  3404     ].
  3388 
  3405 
  3389     initiallyShown := nil.
  3406     initiallyShown := nil.
  3390     (oneMore == true) ifTrue:[
  3407     (oneMore == true) ifTrue:[
  3391 	(thisContext sender sender lineNumber ? 0) <= 1 ifTrue:[
  3408         (thisContext sender sender lineNumber ? 0) <= 1 ifTrue:[
  3392 	    initiallyShown := 2
  3409             initiallyShown := 2
  3393 	] ifFalse:[
  3410         ] ifFalse:[
  3394 	    initiallyShown := 1
  3411             initiallyShown := 1
  3395 	]
  3412         ]
  3396     ].
  3413     ].
  3397     con := thisContext sender sender.
  3414     con := thisContext sender sender.
  3398 
  3415 
  3399     HaltInterrupt handle:[:ex |
  3416     HaltInterrupt handle:[:ex |
  3400 	'DebugView [info]: halt/breakpoint in debugger ignored [stepOpNext 2]' infoPrintCR.
  3417         'DebugView [info]: halt/breakpoint in debugger ignored [stepOpNext 2]' infoPrintCR.
  3401 	ex proceed
  3418         ex proceed
  3402     ] do:[
  3419     ] do:[
  3403 	self enter:con select:initiallyShown
  3420         self enter:con select:initiallyShown
  3404     ].
  3421     ].
  3405     con := nil
  3422     con := nil
  3406 
  3423 
  3407     "Created: / 14.10.1996 / 12:53:39 / cg"
  3424     "Created: / 14.10.1996 / 12:53:39 / cg"
  3408     "Modified: / 18.11.2001 / 01:00:55 / cg"
  3425     "Modified: / 18.11.2001 / 01:00:55 / cg"
  3414     "add a breakpoint on the selected contexts method - if any"
  3431     "add a breakpoint on the selected contexts method - if any"
  3415 
  3432 
  3416     |implementorClass method|
  3433     |implementorClass method|
  3417 
  3434 
  3418     selectedContext isNil ifTrue:[
  3435     selectedContext isNil ifTrue:[
  3419 	^ self showError:'** select a context first **'
  3436         ^ self showError:'** select a context first **'
  3420     ].
  3437     ].
  3421     (MessageTracer isNil or:[MessageTracer isLoaded not]) ifTrue:[
  3438     (MessageTracer isNil or:[MessageTracer isLoaded not]) ifTrue:[
  3422 	^ self
  3439         ^ self
  3423     ].
  3440     ].
  3424 
  3441 
  3425     implementorClass := selectedContext methodClass.
  3442     implementorClass := selectedContext methodClass.
  3426     implementorClass notNil ifTrue:[
  3443     implementorClass notNil ifTrue:[
  3427 	method := implementorClass compiledMethodAt:selectedContext selector.
  3444         method := implementorClass compiledMethodAt:selectedContext selector.
  3428 	(method notNil and:[method isBreakpointed not]) ifTrue:[
  3445         (method notNil and:[method isBreakpointed not]) ifTrue:[
  3429 	    method setBreakPoint
  3446             method setBreakPoint
  3430 	]
  3447         ]
  3431     ].
  3448     ].
  3432     contextView middleButtonMenu disable:#addBreakpoint.
  3449     contextView middleButtonMenu disable:#addBreakpoint.
  3433     contextView middleButtonMenu enable:#removeBreakpoint.
  3450     contextView middleButtonMenu enable:#removeBreakpoint.
  3434 
  3451 
  3435     "Modified: / 13.1.1998 / 00:24:47 / cg"
  3452     "Modified: / 13.1.1998 / 00:24:47 / cg"
  3443     selectedContext isNil ifTrue:[^ self].
  3460     selectedContext isNil ifTrue:[^ self].
  3444 
  3461 
  3445     cls := selectedContext receiver class.
  3462     cls := selectedContext receiver class.
  3446     sel := selectedContext selector.
  3463     sel := selectedContext selector.
  3447     (cls includesSelector:sel) ifFalse:[
  3464     (cls includesSelector:sel) ifFalse:[
  3448 	sel := nil
  3465         sel := nil
  3449     ].
  3466     ].
  3450     Tools::NewSystemBrowser addToBookMarks:cls selector:sel
  3467     Tools::NewSystemBrowser addToBookMarks:cls selector:sel
  3451 !
  3468 !
  3452 
  3469 
  3453 allowBreakPointsInDebugger
  3470 allowBreakPointsInDebugger
  3474 
  3491 
  3475 autoUpdateOff
  3492 autoUpdateOff
  3476     "stop the update process"
  3493     "stop the update process"
  3477 
  3494 
  3478     updateProcess notNil ifTrue:[
  3495     updateProcess notNil ifTrue:[
  3479 	monitorToggle lampColor:(Color yellow).
  3496         monitorToggle lampColor:(Color yellow).
  3480 	updateProcess terminate.
  3497         updateProcess terminate.
  3481 	updateProcess := nil
  3498         updateProcess := nil
  3482     ]
  3499     ]
  3483 !
  3500 !
  3484 
  3501 
  3485 autoUpdateOn
  3502 autoUpdateOn
  3486     "fork a subprocess which updates the contextList in regular intervals"
  3503     "fork a subprocess which updates the contextList in regular intervals"
  3487 
  3504 
  3488     updateProcess isNil ifTrue:[
  3505     updateProcess isNil ifTrue:[
  3489 	updateProcess :=
  3506         updateProcess :=
  3490 	    [
  3507             [
  3491 		[true] whileTrue:[
  3508                 [true] whileTrue:[
  3492 		    monitorToggle showLamp ifTrue:[
  3509                     monitorToggle showLamp ifTrue:[
  3493 			monitorToggle lampColor:(Color yellow).
  3510                         monitorToggle lampColor:(Color yellow).
  3494 		    ] ifFalse:[
  3511                     ] ifFalse:[
  3495 			monitorToggle activeForegroundColor:Color black.
  3512                         monitorToggle activeForegroundColor:Color black.
  3496 		    ].
  3513                     ].
  3497 		    (Delay forSeconds:0.25) wait.
  3514                     (Delay forSeconds:0.25) wait.
  3498 		    self updateContext.
  3515                     self updateContext.
  3499 		    monitorToggle showLamp ifTrue:[
  3516                     monitorToggle showLamp ifTrue:[
  3500 			monitorToggle lampColor:(Color red).
  3517                         monitorToggle lampColor:(Color red).
  3501 		    ] ifFalse:[
  3518                     ] ifFalse:[
  3502 			monitorToggle activeForegroundColor:Color red.
  3519                         monitorToggle activeForegroundColor:Color red.
  3503 		    ].
  3520                     ].
  3504 		    (Delay forSeconds:0.25) wait.
  3521                     (Delay forSeconds:0.25) wait.
  3505 		    self updateContext.
  3522                     self updateContext.
  3506 		]
  3523                 ]
  3507 	    ] forkAt:(Processor activePriority - 1)
  3524             ] forkAt:(Processor activePriority - 1)
  3508     ]
  3525     ]
  3509 
  3526 
  3510 !
  3527 !
  3511 
  3528 
  3512 browseClass
  3529 browseClass
  3517     selectedContext isNil ifTrue:[^ self].
  3534     selectedContext isNil ifTrue:[^ self].
  3518 
  3535 
  3519     cls := selectedContext receiver class.
  3536     cls := selectedContext receiver class.
  3520     sel := selectedContext selector.
  3537     sel := selectedContext selector.
  3521     (cls includesSelector:sel) ifFalse:[
  3538     (cls includesSelector:sel) ifFalse:[
  3522 	sel := nil
  3539         sel := nil
  3523     ].
  3540     ].
  3524     cls browserClass openInClass:cls selector:sel.
  3541     cls browserClass openInClass:cls selector:sel.
  3525 
  3542 
  3526     "Modified: / 3.2.1998 / 20:23:36 / cg"
  3543     "Modified: / 3.2.1998 / 20:23:36 / cg"
  3527 !
  3544 !
  3533 
  3550 
  3534     selectedContext isNil ifTrue:[^ self].
  3551     selectedContext isNil ifTrue:[^ self].
  3535 
  3552 
  3536     mthd := selectedContext method.
  3553     mthd := selectedContext method.
  3537     mthd notNil ifTrue:[
  3554     mthd notNil ifTrue:[
  3538 	cls := mthd containingClass.
  3555         cls := mthd containingClass.
  3539 	"/ still nil if unbound - then use receivers class
  3556         "/ still nil if unbound - then use receivers class
  3540     ].
  3557     ].
  3541     cls isNil ifTrue:[
  3558     cls isNil ifTrue:[
  3542 	cls := selectedContext receiver class
  3559         cls := selectedContext receiver class
  3543     ].
  3560     ].
  3544     cls browserClass browseClassHierarchy:cls.
  3561     cls browserClass browseClassHierarchy:cls.
  3545 
  3562 
  3546     "Modified: / 17.11.2001 / 19:43:06 / cg"
  3563     "Modified: / 17.11.2001 / 19:43:06 / cg"
  3547 !
  3564 !
  3553 
  3570 
  3554     selectedContext isNil ifTrue:[^ self].
  3571     selectedContext isNil ifTrue:[^ self].
  3555 
  3572 
  3556     mthd := selectedContext method.
  3573     mthd := selectedContext method.
  3557     mthd notNil ifTrue:[
  3574     mthd notNil ifTrue:[
  3558 	cls := mthd containingClass.
  3575         cls := mthd containingClass.
  3559 	"/ still nil if unbound - then use receivers class
  3576         "/ still nil if unbound - then use receivers class
  3560     ].
  3577     ].
  3561     cls isNil ifTrue:[
  3578     cls isNil ifTrue:[
  3562 	cls := selectedContext receiver class
  3579         cls := selectedContext receiver class
  3563     ].
  3580     ].
  3564     cls browserClass browseFullClassProtocol:cls.
  3581     cls browserClass browseFullClassProtocol:cls.
  3565 
  3582 
  3566     "Modified: / 17.11.2001 / 19:43:43 / cg"
  3583     "Modified: / 17.11.2001 / 19:43:43 / cg"
  3567 !
  3584 !
  3573 
  3590 
  3574     selectedContext isNil ifTrue:[^ self].
  3591     selectedContext isNil ifTrue:[^ self].
  3575 
  3592 
  3576     mthd := selectedContext method.
  3593     mthd := selectedContext method.
  3577     mthd notNil ifTrue:[
  3594     mthd notNil ifTrue:[
  3578 	who := selectedContext method who.
  3595         who := selectedContext method who.
  3579 	who notNil ifTrue:[
  3596         who notNil ifTrue:[
  3580 	    cls := who methodClass.
  3597             cls := who methodClass.
  3581 	    sel := who methodSelector.
  3598             sel := who methodSelector.
  3582 	]
  3599         ]
  3583     ].
  3600     ].
  3584     cls isNil ifTrue:[
  3601     cls isNil ifTrue:[
  3585 	"/ class not found - try receiver
  3602         "/ class not found - try receiver
  3586 	cls := selectedContext receiver class
  3603         cls := selectedContext receiver class
  3587     ].
  3604     ].
  3588 
  3605 
  3589     cls browserClass openInClass:cls selector:sel.
  3606     cls browserClass openInClass:cls selector:sel.
  3590 
  3607 
  3591     "Created: / 22.11.1995 / 21:27:01 / cg"
  3608     "Created: / 22.11.1995 / 21:27:01 / cg"
  3594 
  3611 
  3595 browseImplementors
  3612 browseImplementors
  3596     "open a browser on the implementors of the selected method's selector"
  3613     "open a browser on the implementors of the selected method's selector"
  3597 
  3614 
  3598     selectedContext isNil ifTrue:[
  3615     selectedContext isNil ifTrue:[
  3599 	^ self showError:'** select a context first **'
  3616         ^ self showError:'** select a context first **'
  3600     ].
  3617     ].
  3601     "/ selectedContext receiver class browserClass
  3618     "/ selectedContext receiver class browserClass
  3602     UserPreferences systemBrowserClass
  3619     UserPreferences systemBrowserClass
  3603 	 browseImplementorsOf:selectedContext selector.
  3620          browseImplementorsOf:selectedContext selector.
  3604 !
  3621 !
  3605 
  3622 
  3606 browseImplementorsOf
  3623 browseImplementorsOf
  3607     "open a browser on the implementors of some selector"
  3624     "open a browser on the implementors of some selector"
  3608 
  3625 
  3609     |initial selector sel|
  3626     |initial selector sel|
  3610 
  3627 
  3611     (sel := codeView selection) notNil ifTrue:[
  3628     (sel := codeView selection) notNil ifTrue:[
  3612 	initial := SystemBrowser extractSelectorFrom:sel
  3629         initial := SystemBrowser extractSelectorFrom:sel
  3613     ].
  3630     ].
  3614     initial isNil ifTrue:[
  3631     initial isNil ifTrue:[
  3615 	initial := selectedContext isNil
  3632         initial := selectedContext isNil
  3616 			    ifTrue:[nil]
  3633                             ifTrue:[nil]
  3617 			    ifFalse:[selectedContext selector].
  3634                             ifFalse:[selectedContext selector].
  3618     ].
  3635     ].
  3619     selector := Dialog
  3636     selector := Dialog
  3620 		    requestSelector:'Selector to browse implementors of:'
  3637                     requestSelector:'Selector to browse implementors of:'
  3621 		    initialAnswer:initial.
  3638                     initialAnswer:initial.
  3622     selector size == 0 ifFalse:[
  3639     selector size == 0 ifFalse:[
  3623 	UserPreferences systemBrowserClass
  3640         UserPreferences systemBrowserClass
  3624 	    browseImplementorsMatching:selector.
  3641             browseImplementorsMatching:selector.
  3625     ]
  3642     ]
  3626 
  3643 
  3627     "Modified: / 6.2.2000 / 01:05:14 / cg"
  3644     "Modified: / 6.2.2000 / 01:05:14 / cg"
  3628 !
  3645 !
  3629 
  3646 
  3632 
  3649 
  3633     |p appClass|
  3650     |p appClass|
  3634 
  3651 
  3635     p := inspectedProcess ? Processor activeProcess.
  3652     p := inspectedProcess ? Processor activeProcess.
  3636     (p notNil and:[p isGUIProcess]) ifTrue:[
  3653     (p notNil and:[p isGUIProcess]) ifTrue:[
  3637 	WindowGroup scheduledWindowGroups do:[:wg |
  3654         WindowGroup scheduledWindowGroups do:[:wg |
  3638 	    wg process == p ifTrue:[
  3655             wg process == p ifTrue:[
  3639 		appClass := wg application class.
  3656                 appClass := wg application class.
  3640 		appClass browserClass openInClass:appClass selector:nil.
  3657                 appClass browserClass openInClass:appClass selector:nil.
  3641 		^ self
  3658                 ^ self
  3642 	    ]
  3659             ]
  3643 	]
  3660         ]
  3644     ].
  3661     ].
  3645 !
  3662 !
  3646 
  3663 
  3647 browseReceiversClass
  3664 browseReceiversClass
  3648     "browse the receiver's class (of the selected context's message)"
  3665     "browse the receiver's class (of the selected context's message)"
  3652     selectedContext isNil ifTrue:[^ self].
  3669     selectedContext isNil ifTrue:[^ self].
  3653 
  3670 
  3654     cls := selectedContext receiver class.
  3671     cls := selectedContext receiver class.
  3655     sel := selectedContext selector.
  3672     sel := selectedContext selector.
  3656     (cls includesSelector:sel) ifFalse:[
  3673     (cls includesSelector:sel) ifFalse:[
  3657 	sel := nil
  3674         sel := nil
  3658     ].
  3675     ].
  3659     cls browserClass openInClass:cls selector:sel.
  3676     cls browserClass openInClass:cls selector:sel.
  3660 
  3677 
  3661     "Modified: / 3.2.1998 / 20:23:36 / cg"
  3678     "Modified: / 3.2.1998 / 20:23:36 / cg"
  3662 !
  3679 !
  3663 
  3680 
  3664 browseSenders
  3681 browseSenders
  3665     "open a browser on the senders of the selected method's selector"
  3682     "open a browser on the senders of the selected method's selector"
  3666 
  3683 
  3667     selectedContext isNil ifTrue:[
  3684     selectedContext isNil ifTrue:[
  3668 	^ self showError:'** select a context first **'
  3685         ^ self showError:'** select a context first **'
  3669     ].
  3686     ].
  3670     UserPreferences systemBrowserClass
  3687     UserPreferences systemBrowserClass
  3671 	browseAllCallsOn:selectedContext selector.
  3688         browseAllCallsOn:selectedContext selector.
  3672 !
  3689 !
  3673 
  3690 
  3674 browseSendersOf
  3691 browseSendersOf
  3675     "open a browser on the senders of some selector"
  3692     "open a browser on the senders of some selector"
  3676 
  3693 
  3677     |initial selector sel|
  3694     |initial selector sel|
  3678 
  3695 
  3679     (sel := codeView selection) notNil ifTrue:[
  3696     (sel := codeView selection) notNil ifTrue:[
  3680 	initial := SystemBrowser extractSelectorFrom:sel
  3697         initial := SystemBrowser extractSelectorFrom:sel
  3681     ].
  3698     ].
  3682     initial isNil ifTrue:[
  3699     initial isNil ifTrue:[
  3683 	initial := selectedContext isNil
  3700         initial := selectedContext isNil
  3684 			    ifTrue:[nil]
  3701                             ifTrue:[nil]
  3685 			    ifFalse:[selectedContext selector].
  3702                             ifFalse:[selectedContext selector].
  3686     ].
  3703     ].
  3687     selector := Dialog
  3704     selector := Dialog
  3688 		    requestSelector:'Selector to browse senders of:'
  3705                     requestSelector:'Selector to browse senders of:'
  3689 		    initialAnswer:initial.
  3706                     initialAnswer:initial.
  3690     selector size == 0 ifFalse:[
  3707     selector size == 0 ifFalse:[
  3691 	UserPreferences systemBrowserClass
  3708         UserPreferences systemBrowserClass
  3692 	    browseAllCallsOn:selector asSymbol.
  3709             browseAllCallsOn:selector asSymbol.
  3693     ]
  3710     ]
  3694 
  3711 
  3695     "Modified: / 6.2.2000 / 01:05:29 / cg"
  3712     "Modified: / 6.2.2000 / 01:05:29 / cg"
  3696 !
  3713 !
  3697 
  3714 
  3724     "abort - send Object>>abortSignal, which is usually caught
  3741     "abort - send Object>>abortSignal, which is usually caught
  3725      at save places (for example: in the event loop) and returns back
  3742      at save places (for example: in the event loop) and returns back
  3726      from whatever the process is doing, but does not terminate it."
  3743      from whatever the process is doing, but does not terminate it."
  3727 
  3744 
  3728     self checkIfCodeIsReallyModified ifTrue:[
  3745     self checkIfCodeIsReallyModified ifTrue:[
  3729 	(self confirm:('Code modified - abort anyway ?'))
  3746         (self confirm:('Code modified - abort anyway ?'))
  3730 	ifFalse:[
  3747         ifFalse:[
  3731 	    ^ self
  3748             ^ self
  3732 	]
  3749         ]
  3733     ].
  3750     ].
  3734 
  3751 
  3735     inspecting ifTrue:[
  3752     inspecting ifTrue:[
  3736 	inspectedProcess isDead ifTrue:[
  3753         inspectedProcess isDead ifTrue:[
  3737 	    self showTerminated.
  3754             self showTerminated.
  3738 	    ^ self
  3755             ^ self
  3739 	].
  3756         ].
  3740 	(AbortOperationRequest isHandledIn:inspectedProcess suspendedContext) ifFalse:[
  3757         (AbortOperationRequest isHandledIn:inspectedProcess suspendedContext) ifFalse:[
  3741 	    self showError:'** the process does not handle the abort signal **'
  3758             self showError:'** the process does not handle the abort signal **'
  3742 	] ifTrue:[
  3759         ] ifTrue:[
  3743 	    self interruptProcessWith:[AbortOperationRequest raise].
  3760             self interruptProcessWith:[AbortOperationRequest raise].
  3744 	].
  3761         ].
  3745 	^ self
  3762         ^ self
  3746     ].
  3763     ].
  3747 
  3764 
  3748     steppedContext := wrapperContext := nil.
  3765     steppedContext := wrapperContext := nil.
  3749     haveControl := false.
  3766     haveControl := false.
  3750     exitAction := #abort.
  3767     exitAction := #abort.
  3751 
  3768 
  3752     "exit private event-loop"
  3769     "exit private event-loop"
  3753     catchBlock notNil ifTrue:[
  3770     catchBlock notNil ifTrue:[
  3754 	abortButton turnOff.
  3771         abortButton turnOff.
  3755 	catchBlock value.
  3772         catchBlock value.
  3756 
  3773 
  3757 	"/ not reached
  3774         "/ not reached
  3758 	'DebugView [warning]: abort failed' errorPrintCR.
  3775         'DebugView [warning]: abort failed' errorPrintCR.
  3759     ].
  3776     ].
  3760 
  3777 
  3761     ^ self.
  3778     ^ self.
  3762 
  3779 
  3763     "Modified: / 17.11.2001 / 22:53:22 / cg"
  3780     "Modified: / 17.11.2001 / 22:53:22 / cg"
  3767     "abortAll - send Object>>abortAllSignal, which is usually caught
  3784     "abortAll - send Object>>abortAllSignal, which is usually caught
  3768      at save places (for example: in the event loop) and returns back
  3785      at save places (for example: in the event loop) and returns back
  3769      from whatever the process is doing, but does not terminate it."
  3786      from whatever the process is doing, but does not terminate it."
  3770 
  3787 
  3771     self checkIfCodeIsReallyModified ifTrue:[
  3788     self checkIfCodeIsReallyModified ifTrue:[
  3772 	(self confirm:('Code modified - abort anyway ?'))
  3789         (self confirm:('Code modified - abort anyway ?'))
  3773 	ifFalse:[
  3790         ifFalse:[
  3774 	    ^ self
  3791             ^ self
  3775 	]
  3792         ]
  3776     ].
  3793     ].
  3777 
  3794 
  3778     inspecting ifTrue:[
  3795     inspecting ifTrue:[
  3779 	inspectedProcess isDead ifTrue:[
  3796         inspectedProcess isDead ifTrue:[
  3780 	    self showTerminated.
  3797             self showTerminated.
  3781 	    ^ self
  3798             ^ self
  3782 	].
  3799         ].
  3783 	(AbortOperationRequest isHandledIn:inspectedProcess suspendedContext) ifFalse:[
  3800         (AbortOperationRequest isHandledIn:inspectedProcess suspendedContext) ifFalse:[
  3784 	    self showError:'** the process does not handle the abort signal **'
  3801             self showError:'** the process does not handle the abort signal **'
  3785 	] ifTrue:[
  3802         ] ifTrue:[
  3786 	    self interruptProcessWith:[AbortAllOperationRequest raise].
  3803             self interruptProcessWith:[AbortAllOperationRequest raise].
  3787 	].
  3804         ].
  3788 	^ self
  3805         ^ self
  3789     ].
  3806     ].
  3790 
  3807 
  3791     steppedContext := wrapperContext := nil.
  3808     steppedContext := wrapperContext := nil.
  3792     haveControl := false.
  3809     haveControl := false.
  3793     exitAction := #abortAll.
  3810     exitAction := #abortAll.
  3794 
  3811 
  3795     "exit private event-loop"
  3812     "exit private event-loop"
  3796     catchBlock notNil ifTrue:[
  3813     catchBlock notNil ifTrue:[
  3797 	abortButton turnOff.
  3814         abortButton turnOff.
  3798 	catchBlock value.
  3815         catchBlock value.
  3799 
  3816 
  3800 	"/ not reached
  3817         "/ not reached
  3801 	'DebugView [warning]: abort failed' errorPrintCR.
  3818         'DebugView [warning]: abort failed' errorPrintCR.
  3802     ].
  3819     ].
  3803 
  3820 
  3804     ^ self.
  3821     ^ self.
  3805 
  3822 
  3806     "Modified: / 17.11.2001 / 22:53:22 / cg"
  3823     "Modified: / 17.11.2001 / 22:53:22 / cg"
  3810     "continue from menu"
  3827     "continue from menu"
  3811 
  3828 
  3812     |proc exContext ex answer|
  3829     |proc exContext ex answer|
  3813 
  3830 
  3814     self checkIfCodeIsReallyModified ifTrue:[
  3831     self checkIfCodeIsReallyModified ifTrue:[
  3815 	(self confirm:('Code modified - continue anyway ?')) ifFalse:[
  3832         (self confirm:('Code modified - continue anyway ?')) ifFalse:[
  3816 	    ^ self
  3833             ^ self
  3817 	]
  3834         ]
  3818     ].
  3835     ].
  3819 
  3836 
  3820     inspecting ifTrue:[
  3837     inspecting ifTrue:[
  3821 	device hasColors ifTrue:[
  3838         device hasColors ifTrue:[
  3822 	    continueButton foregroundColor:Color red darkened.
  3839             continueButton foregroundColor:Color red darkened.
  3823 	].
  3840         ].
  3824 	continueButton label:(resources string:'Stop').
  3841         continueButton label:(resources string:'Stop').
  3825 	continueButton action:[self doStop].
  3842         continueButton action:[self doStop].
  3826 
  3843 
  3827 	self processPerform:#resume.
  3844         self processPerform:#resume.
  3828 
  3845 
  3829 	^ self
  3846         ^ self
  3830     ].
  3847     ].
  3831     canContinue ifTrue:[
  3848     canContinue ifTrue:[
  3832 	exContext := thisContext findSpecialHandle:false raise:true.
  3849         exContext := thisContext findSpecialHandle:false raise:true.
  3833 
  3850 
  3834 	(exContext notNil
  3851         (exContext notNil
  3835 	and:[ (ex := exContext receiver) isLazyValue not
  3852         and:[ (ex := exContext receiver) isLazyValue not
  3836 	and:[ ex isException
  3853         and:[ ex isException
  3837 	and:[ ex signal == NoHandlerError
  3854         and:[ ex signal == NoHandlerError
  3838 	and:[ ex parameter signal == RecursionError]]]])
  3855         and:[ ex parameter signal == RecursionError]]]])
  3839 	ifTrue:[
  3856         ifTrue:[
  3840 	    "/ debug due to unhandled recursionInterrupt.
  3857             "/ debug due to unhandled recursionInterrupt.
  3841 	    "/ ask if we should proceed with more stack.
  3858             "/ ask if we should proceed with more stack.
  3842 
  3859 
  3843 	    answer := self confirm:'Debugger entered due to a stack overflow.\\Continue with more stack ?' withCRs.
  3860             answer := self confirm:'Debugger entered due to a stack overflow.\\Continue with more stack ?' withCRs.
  3844 	    answer == true ifTrue:[
  3861             answer == true ifTrue:[
  3845 		proc := Processor activeProcess.
  3862                 proc := Processor activeProcess.
  3846 		proc setMaximumStackSize:(proc maximumStackSize * 2).
  3863                 proc setMaximumStackSize:(proc maximumStackSize * 2).
  3847 	    ].
  3864             ].
  3848 	].
  3865         ].
  3849 
  3866 
  3850 	steppedContext := wrapperContext := nil.
  3867         steppedContext := wrapperContext := nil.
  3851 	tracing := false.
  3868         tracing := false.
  3852 	haveControl := false.
  3869         haveControl := false.
  3853 	exitAction := #continue.
  3870         exitAction := #continue.
  3854 
  3871 
  3855 	"exit private event-loop"
  3872         "exit private event-loop"
  3856 	catchBlock value.
  3873         catchBlock value.
  3857 
  3874 
  3858 	"/ not reached.
  3875         "/ not reached.
  3859 	'DebugView [warning]: continue failed' errorPrintCR.
  3876         'DebugView [warning]: continue failed' errorPrintCR.
  3860 	continueButton turnOff.
  3877         continueButton turnOff.
  3861 
  3878 
  3862     ] ifFalse:[
  3879     ] ifFalse:[
  3863 	inspecting ifFalse:[
  3880         inspecting ifFalse:[
  3864 	    'DebugView [info]: resuming top context' infoPrintCR.
  3881             'DebugView [info]: resuming top context' infoPrintCR.
  3865 	    self showSelection:1.
  3882             self showSelection:1.
  3866 	    self doReturn
  3883             self doReturn
  3867 	]
  3884         ]
  3868     ]
  3885     ]
  3869 
  3886 
  3870     "Modified: / 5.10.1998 / 13:03:47 / cg"
  3887     "Modified: / 5.10.1998 / 13:03:47 / cg"
  3871     "Modified: / 26.7.1999 / 15:38:45 / stefan"
  3888     "Modified: / 26.7.1999 / 15:38:45 / stefan"
  3872 !
  3889 !
  3879     restart := true.
  3896     restart := true.
  3880 
  3897 
  3881     selector := actualContext selector.
  3898     selector := actualContext selector.
  3882     implClass := actualContext receiver class whichClassIncludesSelector:selector.
  3899     implClass := actualContext receiver class whichClassIncludesSelector:selector.
  3883     implClass notNil ifTrue:[
  3900     implClass notNil ifTrue:[
  3884 	"/ must be a subclassResponsibility
  3901         "/ must be a subclassResponsibility
  3885 
  3902 
  3886 	idx := contextArray identityIndexOf:actualContext.
  3903         idx := contextArray identityIndexOf:actualContext.
  3887 	idx > 1 ifTrue:[
  3904         idx > 1 ifTrue:[
  3888 	    callee := contextArray at:idx-1.
  3905             callee := contextArray at:idx-1.
  3889 
  3906 
  3890 	    callee selector == #subclassResponsibility ifTrue:[
  3907             callee selector == #subclassResponsibility ifTrue:[
  3891 		restart := false.
  3908                 restart := false.
  3892 	    ]
  3909             ]
  3893 	].
  3910         ].
  3894     ].
  3911     ].
  3895 
  3912 
  3896     "generate nice argument names"
  3913     "generate nice argument names"
  3897     bagOfClassNames := (actualContext args collect:[:eachArg | eachArg class name]) asBag.
  3914     bagOfClassNames := (actualContext args collect:[:eachArg | eachArg class name]) asBag.
  3898     bagOfUsedClassNames := Bag new.
  3915     bagOfUsedClassNames := Bag new.
  3899     argNames := actualContext args
  3916     argNames := actualContext args
  3900 		    collect:
  3917                     collect:
  3901 			[:eachArg |
  3918                         [:eachArg |
  3902 			    |nm|
  3919                             |nm|
  3903 
  3920 
  3904 			    nm := eachArg class name.
  3921                             nm := eachArg class name.
  3905 			    (bagOfClassNames occurrencesOf:nm) == 1 ifTrue:[
  3922                             (bagOfClassNames occurrencesOf:nm) == 1 ifTrue:[
  3906 				nm article , nm
  3923                                 nm article , nm
  3907 			    ] ifFalse:[
  3924                             ] ifFalse:[
  3908 				bagOfUsedClassNames add:nm.
  3925                                 bagOfUsedClassNames add:nm.
  3909 				nm asLowercaseFirst , (bagOfUsedClassNames occurrencesOf:nm) printString
  3926                                 nm asLowercaseFirst , (bagOfUsedClassNames occurrencesOf:nm) printString
  3910 			    ].
  3927                             ].
  3911 			].
  3928                         ].
  3912 
  3929 
  3913     proto := Method methodDefinitionTemplateForSelector:selector andArgumentNames:argNames.
  3930     proto := Method methodDefinitionTemplateForSelector:selector andArgumentNames:argNames.
  3914 
  3931 
  3915     haltStmtDef := '    self halt:''please define %2 here''.'.
  3932     haltStmtDef := '    self halt:''please define %2 here''.'.
  3916     haltStmtFix := '    self halt:''please change %2 as required''.'.
  3933     haltStmtFix := '    self halt:''please change %2 as required''.'.
  3917 
  3934 
  3918     actualContext receiver isNil ifTrue:[
  3935     actualContext receiver isNil ifTrue:[
  3919 	(self confirm:'Are you sure you want to add this method (to UndefinedObject) ?')
  3936         (self confirm:'Are you sure you want to add this method (to UndefinedObject) ?')
  3920 	ifFalse:[
  3937         ifFalse:[
  3921 	    ^ self
  3938             ^ self
  3922 	]
  3939         ]
  3923     ].
  3940     ].
  3924 
  3941 
  3925     receiversClass := actualContext receiver class.
  3942     receiversClass := actualContext receiver class.
  3926 
  3943 
  3927     (receiversClass instVarNames includes:selector) ifTrue:[
  3944     (receiversClass instVarNames includes:selector) ifTrue:[
  3928 	code := '%1\' , haltStmtFix , '\    ^ %2'.
  3945         code := '%1\' , haltStmtFix , '\    ^ %2'.
  3929 	cat := 'accessing'.
  3946         cat := 'accessing'.
  3930     ].
  3947     ].
  3931     (selector numArgs == 1
  3948     (selector numArgs == 1
  3932     and:[(selector endsWith:':')
  3949     and:[(selector endsWith:':')
  3933     and:[receiversClass instVarNames includes:(selector copyWithoutLast:1)]])
  3950     and:[receiversClass instVarNames includes:(selector copyWithoutLast:1)]])
  3934     ifTrue:[
  3951     ifTrue:[
  3935 	code := '%1\' , haltStmtFix , '\    %2 := arg.'.
  3952         code := '%1\' , haltStmtFix , '\    %2 := arg.'.
  3936 	cat := 'accessing'.
  3953         cat := 'accessing'.
  3937     ].
  3954     ].
  3938 
  3955 
  3939 "/    actualContext receiver isClass ifTrue:[
  3956 "/    actualContext receiver isClass ifTrue:[
  3940 "/        selector == #new ifTrue:[
  3957 "/        selector == #new ifTrue:[
  3941 "/            code := '%1\' , haltStmt , '\    ^ self basicNew initialize'
  3958 "/            code := '%1\' , haltStmt , '\    ^ self basicNew initialize'
  3943 "/        selector == #'new:' ifTrue:[
  3960 "/        selector == #'new:' ifTrue:[
  3944 "/            code := '%1\' , haltStmt , '\    ^ (self basicNew:arg) initialize'
  3961 "/            code := '%1\' , haltStmt , '\    ^ (self basicNew:arg) initialize'
  3945 "/        ].
  3962 "/        ].
  3946 "/    ].
  3963 "/    ].
  3947     code isNil ifTrue:[
  3964     code isNil ifTrue:[
  3948 	code := '%1\' , haltStmtDef
  3965         code := '%1\' , haltStmtDef
  3949     ].
  3966     ].
  3950 
  3967 
  3951     self
  3968     self
  3952 	codeAccept:(code bindWith:proto with:selector) withCRs
  3969         codeAccept:(code bindWith:proto with:selector) withCRs
  3953 	inClass:receiversClass
  3970         inClass:receiversClass
  3954 	unwind:false
  3971         unwind:false
  3955 	category:cat
  3972         category:cat
  3956 	onCancel:[^ self].
  3973         onCancel:[^ self].
  3957 
  3974 
  3958     self doShowSelection:selectionIndex.
  3975     self doShowSelection:selectionIndex.
  3959     restart ifTrue:[
  3976     restart ifTrue:[
  3960 	self doRestart
  3977         self doRestart
  3961     ]
  3978     ]
  3962 
  3979 
  3963     "Modified: / 17.11.2001 / 23:43:54 / cg"
  3980     "Modified: / 17.11.2001 / 23:43:54 / cg"
  3964 !
  3981 !
  3965 
  3982 
  3971     "single send; reenter with next message send"
  3988     "single send; reenter with next message send"
  3972 
  3989 
  3973     inspecting ifTrue:[^ self].
  3990     inspecting ifTrue:[^ self].
  3974 
  3991 
  3975     self checkIfCodeIsReallyModified ifTrue:[
  3992     self checkIfCodeIsReallyModified ifTrue:[
  3976 	(self confirm:('Code modified - step anyway ?'))
  3993         (self confirm:('Code modified - step anyway ?'))
  3977 	ifFalse:[
  3994         ifFalse:[
  3978 	    ^ self
  3995             ^ self
  3979 	]
  3996         ]
  3980     ].
  3997     ].
  3981 
  3998 
  3982     canContinue ifTrue:[
  3999     canContinue ifTrue:[
  3983 	steppedContext := wrapperContext := nil.
  4000         steppedContext := wrapperContext := nil.
  3984 	haveControl := false.
  4001         haveControl := false.
  3985 	exitAction := #step.
  4002         exitAction := #step.
  3986 
  4003 
  3987 	"exit private event-loop"
  4004         "exit private event-loop"
  3988 	catchBlock value.
  4005         catchBlock value.
  3989 
  4006 
  3990 	"/ not reached
  4007         "/ not reached
  3991 	'DebugView [warning]: send failed' errorPrintCR.
  4008         'DebugView [warning]: send failed' errorPrintCR.
  3992 	sendButton turnOff.
  4009         sendButton turnOff.
  3993     ]
  4010     ]
  3994 
  4011 
  3995     "Created: / 6.3.1997 / 21:09:36 / cg"
  4012     "Created: / 6.3.1997 / 21:09:36 / cg"
  3996     "Modified: / 29.7.1998 / 21:49:29 / cg"
  4013     "Modified: / 29.7.1998 / 21:49:29 / cg"
  3997 !
  4014 !
  4025     "Modified: 7.3.1997 / 18:39:00 / cg"
  4042     "Modified: 7.3.1997 / 18:39:00 / cg"
  4026 !
  4043 !
  4027 
  4044 
  4028 doNoTrace
  4045 doNoTrace
  4029     traceView notNil ifTrue:[
  4046     traceView notNil ifTrue:[
  4030 	traceView topView destroy.
  4047         traceView topView destroy.
  4031 	traceView := nil.
  4048         traceView := nil.
  4032     ].
  4049     ].
  4033     tracing := false
  4050     tracing := false
  4034 !
  4051 !
  4035 
  4052 
  4036 doNotIgnoreBreakpoints
  4053 doNotIgnoreBreakpoints
  4043     | str |
  4060     | str |
  4044 
  4061 
  4045     str := '' writeStream.
  4062     str := '' writeStream.
  4046 
  4063 
  4047     str nextPutLine:('Error notification from '
  4064     str nextPutLine:('Error notification from '
  4048 		    , OperatingSystem getLoginName
  4065                     , OperatingSystem getLoginName
  4049 		    , '@'
  4066                     , '@'
  4050 		    , OperatingSystem getHostName).
  4067                     , OperatingSystem getHostName).
  4051     str cr.
  4068     str cr.
  4052 
  4069 
  4053     str nextPutLine:('Time: ' , Timestamp now printString).
  4070     str nextPutLine:('Time: ' , Timestamp now printString).
  4054     str nextPutLine:('STX Version: ' , Smalltalk versionString).
  4071     str nextPutLine:('STX Version: ' , Smalltalk versionString).
  4055     str nextPutLine:('Description: ' , self label).
  4072     str nextPutLine:('Description: ' , self label).
  4058 "/    str nextPutLine:('Parameter: ', printedException parameter printString).
  4075 "/    str nextPutLine:('Parameter: ', printedException parameter printString).
  4059     str nextPutLine:'Backtrace:'.
  4076     str nextPutLine:'Backtrace:'.
  4060     str cr.
  4077     str cr.
  4061 
  4078 
  4062     firstContext notNil ifTrue:[
  4079     firstContext notNil ifTrue:[
  4063 	firstContext fullPrintAllOn:str.
  4080         firstContext fullPrintAllOn:str.
  4064     ].
  4081     ].
  4065     str cr;cr.
  4082     str cr;cr.
  4066 
  4083 
  4067     SendMailTool
  4084     SendMailTool
  4068 	openForMessage:(str contents)
  4085         openForMessage:(str contents)
  4069 	withSubject:('STX Error:[', self label, ']')
  4086         withSubject:('STX Error:[', self label, ']')
  4070 	preOpenBlock:[:inst|
  4087         preOpenBlock:[:inst|
  4071 	    inst recipientEntryField value:'error@exept.de'
  4088             inst recipientEntryField value:'error@exept.de'
  4072 	].
  4089         ].
  4073 
  4090 
  4074     "Modified: / 20-09-2007 / 12:40:40 / cg"
  4091     "Modified: / 20-09-2007 / 12:40:40 / cg"
  4075 !
  4092 !
  4076 
  4093 
  4077 doRestart
  4094 doRestart
  4078     "restart - the selected context will be restarted"
  4095     "restart - the selected context will be restarted"
  4079 
  4096 
  4080     self checkIfCodeIsReallyModified ifTrue:[
  4097     self checkIfCodeIsReallyModified ifTrue:[
  4081 	(self confirm:('Code modified - restart anyway ?')) ifFalse:[
  4098         (self confirm:('Code modified - restart anyway ?')) ifFalse:[
  4082 	    ^ self
  4099             ^ self
  4083 	]
  4100         ]
  4084     ].
  4101     ].
  4085     inspecting ifTrue:[
  4102     inspecting ifTrue:[
  4086 	selectedContext isNil ifTrue:[
  4103         selectedContext isNil ifTrue:[
  4087 	    ^ self showError:'** select a context first **'
  4104             ^ self showError:'** select a context first **'
  4088 	].
  4105         ].
  4089 	self interruptProcessWith:[ selectedContext unwindAndRestart ].
  4106         self interruptProcessWith:[ selectedContext unwindAndRestart ].
  4090 	^ self
  4107         ^ self
  4091     ].
  4108     ].
  4092     steppedContext := wrapperContext := nil.
  4109     steppedContext := wrapperContext := nil.
  4093     haveControl := false.
  4110     haveControl := false.
  4094     exitAction := #restart. "exit private event-loop"
  4111     exitAction := #restart. "exit private event-loop"
  4095 
  4112 
  4105 
  4122 
  4106 doReturn
  4123 doReturn
  4107     "return - the selected context will do a ^nil"
  4124     "return - the selected context will do a ^nil"
  4108 
  4125 
  4109     self checkIfCodeIsReallyModified ifTrue:[
  4126     self checkIfCodeIsReallyModified ifTrue:[
  4110 	(self confirm:('Code modified - return anyway ?'))
  4127         (self confirm:('Code modified - return anyway ?'))
  4111 	ifFalse:[
  4128         ifFalse:[
  4112 	    ^ self
  4129             ^ self
  4113 	]
  4130         ]
  4114     ].
  4131     ].
  4115 
  4132 
  4116     inspecting ifTrue:[
  4133     inspecting ifTrue:[
  4117 	selectedContext isNil ifTrue:[
  4134         selectedContext isNil ifTrue:[
  4118 	    ^ self showError:'** select a context first **'
  4135             ^ self showError:'** select a context first **'
  4119 	].
  4136         ].
  4120 	self interruptProcessWith:[selectedContext unwind:nil].
  4137         self interruptProcessWith:[selectedContext unwind:nil].
  4121 	^ self
  4138         ^ self
  4122     ].
  4139     ].
  4123 
  4140 
  4124     steppedContext := wrapperContext := nil.
  4141     steppedContext := wrapperContext := nil.
  4125     haveControl := false.
  4142     haveControl := false.
  4126     exitAction := #return.
  4143     exitAction := #return.
  4176     |con method|
  4193     |con method|
  4177 
  4194 
  4178     inspecting ifTrue:[^ self].
  4195     inspecting ifTrue:[^ self].
  4179 
  4196 
  4180     self checkIfCodeIsReallyModified ifTrue:[
  4197     self checkIfCodeIsReallyModified ifTrue:[
  4181 	(self confirm:('Code modified - step anyway ?'))
  4198         (self confirm:('Code modified - step anyway ?'))
  4182 	ifFalse:[
  4199         ifFalse:[
  4183 	    ^ self
  4200             ^ self
  4184 	]
  4201         ]
  4185     ].
  4202     ].
  4186 
  4203 
  4187     canContinue ifTrue:[
  4204     canContinue ifTrue:[
  4188 	selectedContext notNil ifTrue:[
  4205         selectedContext notNil ifTrue:[
  4189 	    con := actualContext. "/ selectedContext.
  4206             con := actualContext. "/ selectedContext.
  4190 	    steppedContextLineno := actualContext lineNumber.
  4207             steppedContextLineno := actualContext lineNumber.
  4191 	] ifFalse:[
  4208         ] ifFalse:[
  4192 	    con := contextArray at:2.
  4209             con := contextArray at:2.
  4193 	    steppedContextLineno := con lineNumber.
  4210             steppedContextLineno := con lineNumber.
  4194 	].
  4211         ].
  4195 
  4212 
  4196 	skipLineNr := lineNr.
  4213         skipLineNr := lineNr.
  4197 
  4214 
  4198 	lineNr == -1 ifTrue:[
  4215         lineNr == -1 ifTrue:[
  4199 	    steppedContextLineno := skipLineNr := nil.
  4216             steppedContextLineno := skipLineNr := nil.
  4200 	].
  4217         ].
  4201 
  4218 
  4202 	(stepUntilEntering isNil and:[stepHow == #send]) ifTrue:[
  4219         (stepUntilEntering isNil and:[stepHow == #send]) ifTrue:[
  4203 	    steppedContext := contextArray at:1.
  4220             steppedContext := contextArray at:1.
  4204 	    stepHow := #nextIn.
  4221             stepHow := #nextIn.
  4205 	] ifFalse:[
  4222         ] ifFalse:[
  4206 	    stepHow == #nextOut ifTrue:[
  4223             stepHow == #nextOut ifTrue:[
  4207 		steppedContext := con home.
  4224                 steppedContext := con home.
  4208 	    ] ifFalse:[
  4225             ] ifFalse:[
  4209 		steppedContext := con.
  4226                 steppedContext := con.
  4210 	    ].
  4227             ].
  4211 	].
  4228         ].
  4212 	wrapperContext := nil.
  4229         wrapperContext := nil.
  4213 
  4230 
  4214 "/ ' step con:' print. (ObjectMemory addressOf:steppedContext) printHex. ' ' print. steppedContext printCR.
  4231 "/ ' step con:' print. (ObjectMemory addressOf:steppedContext) printHex. ' ' print. steppedContext printCR.
  4215 
  4232 
  4216 	"
  4233         "
  4217 	 if we step in a wrapped method,
  4234          if we step in a wrapped method,
  4218 	 prepare to skip the prolog ...
  4235          prepare to skip the prolog ...
  4219 	"
  4236         "
  4220 
  4237 
  4221 	inWrap := false.
  4238         inWrap := false.
  4222 	method := con method.
  4239         method := con method.
  4223 	(method notNil
  4240         (method notNil
  4224 	and:[method isWrapped
  4241         and:[method isWrapped
  4225 	and:[method originalMethod ~~ method]]) ifTrue:[
  4242         and:[method originalMethod ~~ method]]) ifTrue:[
  4226 	    inWrap := true
  4243             inWrap := true
  4227 	].
  4244         ].
  4228 
  4245 
  4229 	lineNr == #return ifTrue:[
  4246         lineNr == #return ifTrue:[
  4230 	    Processor activeProcess forceInterruptOnReturnOf:con.
  4247             Processor activeProcess forceInterruptOnReturnOf:con.
  4231 	].
  4248         ].
  4232 
  4249 
  4233 	con := nil.
  4250         con := nil.
  4234 	bigStep := true.
  4251         bigStep := true.
  4235 	haveControl := false.
  4252         haveControl := false.
  4236 	exitAction := #step.
  4253         exitAction := #step.
  4237 
  4254 
  4238 	"exit private event-loop"
  4255         "exit private event-loop"
  4239 	catchBlock value.
  4256         catchBlock value.
  4240 
  4257 
  4241 	"/ not reached
  4258         "/ not reached
  4242 	'DebugView [warning]: step failed' errorPrintCR.
  4259         'DebugView [warning]: step failed' errorPrintCR.
  4243 	stepButton turnOff. nextButton turnOff. sendButton turnOff.
  4260         stepButton turnOff. nextButton turnOff. sendButton turnOff.
  4244     ]
  4261     ]
  4245 
  4262 
  4246     "Modified: / 29.7.1998 / 21:50:16 / cg"
  4263     "Modified: / 29.7.1998 / 21:50:16 / cg"
  4247 !
  4264 !
  4248 
  4265 
  4249 doStop
  4266 doStop
  4250     "stop the process (if its running, otherwise this is a no-op)"
  4267     "stop the process (if its running, otherwise this is a no-op)"
  4251 
  4268 
  4252     inspecting ifTrue:[
  4269     inspecting ifTrue:[
  4253 	device hasColors ifTrue:[
  4270         device hasColors ifTrue:[
  4254 	    continueButton foregroundColor:Color green darkened darkened.
  4271             continueButton foregroundColor:Color green darkened darkened.
  4255 	].
  4272         ].
  4256 	continueButton label:(resources string:'Continue').
  4273         continueButton label:(resources string:'Continue').
  4257 	continueButton action:[self doContinue].
  4274         continueButton action:[self doContinue].
  4258 
  4275 
  4259 	self processPerform:#stop.
  4276         self processPerform:#stop.
  4260 
  4277 
  4261 	^ self
  4278         ^ self
  4262     ].
  4279     ].
  4263 
  4280 
  4264     "Modified: 20.10.1996 / 18:30:48 / cg"
  4281     "Modified: 20.10.1996 / 18:30:48 / cg"
  4265 !
  4282 !
  4266 
  4283 
  4267 doTerminate
  4284 doTerminate
  4268     "terminate - the process has a chance for cleanup"
  4285     "terminate - the process has a chance for cleanup"
  4269 
  4286 
  4270     self checkIfCodeIsReallyModified ifTrue:[
  4287     self checkIfCodeIsReallyModified ifTrue:[
  4271 	(self confirm:('Code modified - terminate anyway ?'))
  4288         (self confirm:('Code modified - terminate anyway ?'))
  4272 	ifFalse:[
  4289         ifFalse:[
  4273 	    ^ self
  4290             ^ self
  4274 	]
  4291         ]
  4275     ].
  4292     ].
  4276 
  4293 
  4277     inspecting ifTrue:[
  4294     inspecting ifTrue:[
  4278 	self processPerform:#terminate.
  4295         self processPerform:#terminate.
  4279 	^ self
  4296         ^ self
  4280     ].
  4297     ].
  4281 
  4298 
  4282     steppedContext := wrapperContext := nil.
  4299     steppedContext := wrapperContext := nil.
  4283     haveControl := false.
  4300     haveControl := false.
  4284     exitAction := #terminate.
  4301     exitAction := #terminate.
  4286     "exit private event-loop"
  4303     "exit private event-loop"
  4287     catchBlock value.
  4304     catchBlock value.
  4288 
  4305 
  4289     "/ not reached (normally)
  4306     "/ not reached (normally)
  4290     inspecting ifFalse:[
  4307     inspecting ifFalse:[
  4291 	'DebugView [warning]: terminate failed' errorPrintCR.
  4308         'DebugView [warning]: terminate failed' errorPrintCR.
  4292 	(self confirm:'Regular terminate failed - do it the hard way ?') ifTrue:[
  4309         (self confirm:'Regular terminate failed - do it the hard way ?') ifTrue:[
  4293 	    Debugger newDebugger.
  4310             Debugger newDebugger.
  4294 	    Processor activeProcess terminate.
  4311             Processor activeProcess terminate.
  4295 	]
  4312         ]
  4296     ].
  4313     ].
  4297     terminateButton turnOff.
  4314     terminateButton turnOff.
  4298 
  4315 
  4299     "Modified: / 29.7.1998 / 21:50:35 / cg"
  4316     "Modified: / 29.7.1998 / 21:50:35 / cg"
  4300 !
  4317 !
  4330 
  4347 
  4331 doTraceStep
  4348 doTraceStep
  4332     "tracestep - not implemented yet"
  4349     "tracestep - not implemented yet"
  4333 
  4350 
  4334     canContinue ifTrue:[
  4351     canContinue ifTrue:[
  4335 	tracing := true.
  4352         tracing := true.
  4336 	self doStep
  4353         self doStep
  4337     ]
  4354     ]
  4338 !
  4355 !
  4339 
  4356 
  4340 exit
  4357 exit
  4341     "exit from menu: immediate exit from smalltalk"
  4358     "exit from menu: immediate exit from smalltalk"
  4346 hasHaltsToIgnore
  4363 hasHaltsToIgnore
  4347     ^ IgnoredHalts notEmptyOrNil
  4364     ^ IgnoredHalts notEmptyOrNil
  4348 !
  4365 !
  4349 
  4366 
  4350 ignoreAllHaltsForever
  4367 ignoreAllHaltsForever
  4351     self addIgnoredHaltForCount:-1 orTimeDuration:nil forAll:true.
  4368     self addIgnoredHaltForCount:-1 orTimeDuration:nil orUntilShiftKey:false forAll:true.
  4352 
  4369 
  4353     "Created: / 08-05-2011 / 10:19:56 / cg"
  4370     "Created: / 08-05-2011 / 10:19:56 / cg"
  4354 !
  4371 !
  4355 
  4372 
       
  4373 ignoreAllHaltsUntilShiftKeyIsPressed
       
  4374     self addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true forAll:true.
       
  4375 
       
  4376     "Created: / 27-01-2012 / 11:32:14 / cg"
       
  4377 !
       
  4378 
  4356 ignoreHaltForever
  4379 ignoreHaltForever
  4357     self addIgnoredHaltForCount:-1 orTimeDuration:nil forAll:false.
  4380     self addIgnoredHaltForCount:-1 orTimeDuration:nil orUntilShiftKey:false forAll:false.
  4358 
  4381 
  4359     "Modified: / 08-05-2011 / 10:20:03 / cg"
  4382     "Modified: / 27-01-2012 / 11:31:37 / cg"
       
  4383 !
       
  4384 
       
  4385 ignoreHaltUntilShiftKeyIsPressed
       
  4386     self addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true forAll:false.
       
  4387 
       
  4388     "Created: / 27-01-2012 / 11:36:54 / cg"
  4360 !
  4389 !
  4361 
  4390 
  4362 inspectContext
  4391 inspectContext
  4363     "launch an inspector on the currently selected context"
  4392     "launch an inspector on the currently selected context"
  4364 
  4393 
  4365     contextView selection notNil ifTrue:[
  4394     contextView selection notNil ifTrue:[
  4366 	(contextView selectionValue startsWith:'**') ifFalse:[
  4395         (contextView selectionValue startsWith:'**') ifFalse:[
  4367 	    (contextArray at:(contextView selection)) inspect.
  4396             (contextArray at:(contextView selection)) inspect.
  4368 	]
  4397         ]
  4369     ]
  4398     ]
  4370 !
  4399 !
  4371 
  4400 
  4372 isStoppedAtHaltOrBreakPoint
  4401 isStoppedAtHaltOrBreakPoint
  4373     ^ isStoppedAtHaltOrBreakPoint
  4402     ^ isStoppedAtHaltOrBreakPoint
  4381     <resource: #programMenu >
  4410     <resource: #programMenu >
  4382 
  4411 
  4383     |items m nameOfExecutable|
  4412     |items m nameOfExecutable|
  4384 
  4413 
  4385     exclusive ifTrue:[
  4414     exclusive ifTrue:[
  4386 	items := #(
  4415         items := #(
  4387 		    ('Show More WalkBack'               showMore                )
  4416                     ('Show More WalkBack'               showMore                )
  4388 		    ('Show Verbose WalkBack'            showVerboseWalkback     )
  4417                     ('Show Verbose WalkBack'            showVerboseWalkback     )
  4389 		    ('-'                                                        )
  4418                     ('-'                                                        )
  4390 		    ('Add Breakpoint'                   addBreakpoint           )
  4419                     ('Add Breakpoint'                   addBreakpoint           )
  4391 		    ('Remove Breakpoint'                removeBreakpoint        )
  4420                     ('Remove Breakpoint'                removeBreakpoint        )
  4392 		    ('Remove all Break- && Tracepoints'  removeAllBreakpoints    )
  4421                     ('Remove all Break- && Tracepoints'  removeAllBreakpoints    )
  4393 		    ('-'                                                        )
  4422                     ('-'                                                        )
  4394 		  ).
  4423                   ).
  4395     ] ifFalse:[
  4424     ] ifFalse:[
  4396 	items := #(
  4425         items := #(
  4397 		    ('Show More WalkBack'               showMore                )
  4426                     ('Show More WalkBack'               showMore                )
  4398 		    ('Show Verbose WalkBack'            showVerboseWalkback     )
  4427                     ('Show Verbose WalkBack'            showVerboseWalkback     )
  4399 		    ('-'                                                        )
  4428                     ('-'                                                        )
  4400 		    ('Skip'                             skip                    )
  4429                     ('Skip'                             skip                    )
  4401 		    ('Step Out'                         skipForReturn           )
  4430                     ('Step Out'                         skipForReturn           )
  4402 		    ('Skip until Entering...'           skipUntilEntering       )
  4431                     ('Skip until Entering...'           skipUntilEntering       )
  4403 		    ('-'                                                        )
  4432                     ('-'                                                        )
  4404 "
  4433 "
  4405 		    ('Continue'                         doContinue              )
  4434                     ('Continue'                         doContinue              )
  4406 		    ('Terminate'                        doTerminate             )
  4435                     ('Terminate'                        doTerminate             )
  4407 		    ('Abort'                            doAbort                 )
  4436                     ('Abort'                            doAbort                 )
  4408 		    ('-'                                                        )
  4437                     ('-'                                                        )
  4409 		    ('Step'                             doStep                  )
  4438                     ('Step'                             doStep                  )
  4410 		    ('Send'                             doSend                  )
  4439                     ('Send'                             doSend                  )
  4411 		    ('-'                                                        )
  4440                     ('-'                                                        )
  4412 		    ('Return'                           doReturn                )
  4441                     ('Return'                           doReturn                )
  4413 		    ('Restart'                          doRestart               )
  4442                     ('Restart'                          doRestart               )
  4414 		    ('-'                                                        )
  4443                     ('-'                                                        )
  4415 "
  4444 "
  4416 		    ('Add Breakpoint'                   addBreakpoint           )
  4445                     ('Add Breakpoint'                   addBreakpoint           )
  4417 		    ('Remove Breakpoint'                removeBreakpoint        )
  4446                     ('Remove Breakpoint'                removeBreakpoint        )
  4418 		    ('Remove all Break- && Tracepoints'  removeAllBreakpoints    )
  4447                     ('Remove all Break- && Tracepoints'  removeAllBreakpoints    )
  4419 		).
  4448                 ).
  4420 
  4449 
  4421 	self allowBreakPointsInDebugger ifFalse:[
  4450         self allowBreakPointsInDebugger ifFalse:[
  4422 	    items := items , #(
  4451             items := items , #(
  4423 			('Allow Breakpoints && halt in Debugger'      doNotIgnoreBreakpoints  )
  4452                         ('Allow Breakpoints && halt in Debugger'      doNotIgnoreBreakpoints  )
  4424 		    ).
  4453                     ).
  4425 	] ifTrue:[
  4454         ] ifTrue:[
  4426 	    items := items , #(
  4455             items := items , #(
  4427 			('Ignore Breakpoints && halt in Debugger'     doIgnoreBreakpoints  )
  4456                         ('Ignore Breakpoints && halt in Debugger'     doIgnoreBreakpoints  )
  4428 		    ).
  4457                     ).
  4429 	].
  4458         ].
  4430 
  4459 
  4431 	items := items , #(
  4460         items := items , #(
  4432 		    ('-'                                                        )
  4461                     ('-'                                                        )
  4433 		    ('Browse Implementing Class'      browseImplementingClass )
  4462                     ('Browse Implementing Class'      browseImplementingClass )
  4434 		    ('Browse Receivers Class'             browseReceiversClass    )
  4463                     ('Browse Receivers Class'             browseReceiversClass    )
  4435 		    ('Browse Receivers Class Hierarchy'   browseClassHierarchy    )
  4464                     ('Browse Receivers Class Hierarchy'   browseClassHierarchy    )
  4436 		    ('Browse Receivers Full Protocol'     browseFullClassProtocol )
  4465                     ('Browse Receivers Full Protocol'     browseFullClassProtocol )
  4437 		    ('Implementors'                     browseImplementors      )
  4466                     ('Implementors'                     browseImplementors      )
  4438 		    ('Implementors Of...'               browseImplementorsOf    )
  4467                     ('Implementors Of...'               browseImplementorsOf    )
  4439 		    ('Senders'                          browseSenders           )
  4468                     ('Senders'                          browseSenders           )
  4440 		    ('Senders Of...'                    browseSendersOf         )
  4469                     ('Senders Of...'                    browseSendersOf         )
  4441 		    ('-'                                                        )
  4470                     ('-'                                                        )
  4442 		    ('Inspect Context'                  inspectContext          )
  4471                     ('Inspect Context'                  inspectContext          )
  4443 		  ).
  4472                   ).
  4444     ].
  4473     ].
  4445 
  4474 
  4446     items := items , #(
  4475     items := items , #(
  4447 		('Copy WalkBack Text'               copyWalkbackText        )
  4476                 ('Copy WalkBack Text'               copyWalkbackText        )
  4448 		('-'                                                        )
  4477                 ('-'                                                        )
  4449 		('QuickTerminate'                   quickTerminate          )
  4478                 ('QuickTerminate'                   quickTerminate          )
  4450 		('='                                                        )).
  4479                 ('='                                                        )).
  4451 
  4480 
  4452     nameOfExecutable := OperatingSystem nameOfSTXExecutable asFilename withoutSuffix baseName.
  4481     nameOfExecutable := OperatingSystem nameOfSTXExecutable asFilename withoutSuffix baseName.
  4453     nameOfExecutable = 'stx' ifTrue:[ nameOfExecutable := 'Smalltalk' ].
  4482     nameOfExecutable = 'stx' ifTrue:[ nameOfExecutable := 'Smalltalk' ].
  4454 
  4483 
  4455     items := items , {
  4484     items := items , {
  4456 	{ 'Exit %1 (No Confirmation)' bindWith:nameOfExecutable. #exit                 }}.
  4485         { 'Exit %1 (No Confirmation)' bindWith:nameOfExecutable. #exit                 }}.
  4457 
  4486 
  4458     m := PopUpMenu
  4487     m := PopUpMenu
  4459 		itemList:items
  4488                 itemList:items
  4460 		resources:resources
  4489                 resources:resources
  4461 		receiver:self
  4490                 receiver:self
  4462 		for:contextView.
  4491                 for:contextView.
  4463 
  4492 
  4464     verboseBacktrace ifTrue:[
  4493     verboseBacktrace ifTrue:[
  4465 	m labelAt:#showVerboseWalkback put:(resources string:'Show Dense WalkBack').
  4494         m labelAt:#showVerboseWalkback put:(resources string:'Show Dense WalkBack').
  4466 	m selectorAt:#showVerboseWalkback put:#showDenseWalkback
  4495         m selectorAt:#showVerboseWalkback put:#showDenseWalkback
  4467     ].
  4496     ].
  4468 
  4497 
  4469     inspecting ifTrue:[
  4498     inspecting ifTrue:[
  4470 	m notNil ifTrue:[
  4499         m notNil ifTrue:[
  4471 	    m disableAll:#(doTraceStep removeBreakpoint browseImplementingClass browseReceiversClass
  4500             m disableAll:#(doTraceStep removeBreakpoint browseImplementingClass browseReceiversClass
  4472 			   browseClassHierarchy browseFullClassProtocol
  4501                            browseClassHierarchy browseFullClassProtocol
  4473 			   browseImplementors browseSenders inspectContext skip doStepOut).
  4502                            browseImplementors browseSenders inspectContext skip doStepOut).
  4474 	].
  4503         ].
  4475     ].
  4504     ].
  4476     self updateMenuItems.
  4505     self updateMenuItems.
  4477 
  4506 
  4478     ^ m.
  4507     ^ m.
  4479 
  4508 
  4496 
  4525 
  4497 openIgnoreAllHaltsUntilTimeElapsedDialog
  4526 openIgnoreAllHaltsUntilTimeElapsedDialog
  4498     |answer dT|
  4527     |answer dT|
  4499 
  4528 
  4500     [
  4529     [
  4501 	answer := Dialog
  4530         answer := Dialog
  4502 		    request:(resources string:'How long should all halts/breakpoints be ignored [smh] ?')
  4531                     request:(resources string:'How long should all halts/breakpoints be ignored [smh] ?')
  4503 		    initialAnswer:(LastIgnoreHaltDuration ? '30s') printString.
  4532                     initialAnswer:(LastIgnoreHaltDuration ? '30s') printString.
  4504 	answer isEmptyOrNil ifTrue:[^ self].
  4533         answer isEmptyOrNil ifTrue:[^ self].
  4505 
  4534 
  4506 	dT := TimeDuration readFrom:answer onError:[ nil ].
  4535         dT := TimeDuration readFrom:answer onError:[ nil ].
  4507 	dT notNil ifTrue:[
  4536         dT notNil ifTrue:[
  4508 	    LastIgnoreHaltDuration := dT.
  4537             LastIgnoreHaltDuration := dT.
  4509 	    self addIgnoredHaltForCount:nil orTimeDuration:dT forAll:true.
  4538             self addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false forAll:true.
  4510 	    ^ self.
  4539             ^ self.
  4511 	].
  4540         ].
  4512     ] loop
  4541     ] loop
  4513 
  4542 
  4514     "Created: / 08-05-2011 / 10:19:20 / cg"
  4543     "Created: / 08-05-2011 / 10:19:20 / cg"
  4515 !
  4544 !
  4516 
  4545 
  4517 openIgnoreHaltNTimesDialog
  4546 openIgnoreHaltNTimesDialog
  4518     |answer n|
  4547     |answer n|
  4519 
  4548 
  4520     [
  4549     [
  4521 	answer := Dialog
  4550         answer := Dialog
  4522 		    request:(resources string:'How often should this halt be ignored ?')
  4551                     request:(resources string:'How often should this halt be ignored ?')
  4523 		    initialAnswer:(LastIgnoreHaltNTimes ? '') printString.
  4552                     initialAnswer:(LastIgnoreHaltNTimes ? '') printString.
  4524 	answer isEmptyOrNil ifTrue:[^ self].
  4553         answer isEmptyOrNil ifTrue:[^ self].
  4525 
  4554 
  4526 	n := Integer readFrom:answer onError:nil.
  4555         n := Integer readFrom:answer onError:nil.
  4527 	n notNil ifTrue:[
  4556         n notNil ifTrue:[
  4528 	    LastIgnoreHaltNTimes := n.
  4557             LastIgnoreHaltNTimes := n.
  4529 	    self addIgnoredHaltForCount:n orTimeDuration:nil forAll:false.
  4558             self addIgnoredHaltForCount:n orTimeDuration:nil orUntilShiftKey:false forAll:false.
  4530 	    ^ self.
  4559             ^ self.
  4531 	].
  4560         ].
  4532     ] loop.
  4561     ] loop.
  4533 
  4562 
  4534     "Modified: / 08-05-2011 / 10:20:19 / cg"
  4563     "Modified: / 27-01-2012 / 11:31:44 / cg"
  4535 !
  4564 !
  4536 
  4565 
  4537 openIgnoreHaltUntilTimeElapsedDialog
  4566 openIgnoreHaltUntilTimeElapsedDialog
  4538     |answer dT|
  4567     |answer dT|
  4539 
  4568 
  4540     [
  4569     [
  4541 	answer := Dialog
  4570         answer := Dialog
  4542 		    request:(resources string:'How long should this halt/breakpoint be ignored (s/m/h) ?')
  4571                     request:(resources string:'How long should this halt/breakpoint be ignored (s/m/h) ?')
  4543 		    initialAnswer:(LastIgnoreHaltDuration ? '30s') printString.
  4572                     initialAnswer:(LastIgnoreHaltDuration ? '30s') printString.
  4544 	answer isEmptyOrNil ifTrue:[^ self].
  4573         answer isEmptyOrNil ifTrue:[^ self].
  4545 
  4574 
  4546 	dT := TimeDuration readFrom:answer onError:[ nil ].
  4575         dT := TimeDuration readFrom:answer onError:[ nil ].
  4547 	dT notNil ifTrue:[
  4576         dT notNil ifTrue:[
  4548 	    LastIgnoreHaltDuration := dT.
  4577             LastIgnoreHaltDuration := dT.
  4549 	    self addIgnoredHaltForCount:nil orTimeDuration:dT forAll:false.
  4578             self addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false forAll:false.
  4550 	    ^ self.
  4579             ^ self.
  4551 	].
  4580         ].
  4552     ] loop
  4581     ] loop
  4553 
  4582 
  4554     "Modified: / 08-05-2011 / 10:20:11 / cg"
  4583     "Modified: / 27-01-2012 / 11:31:47 / cg"
  4555 !
  4584 !
  4556 
  4585 
  4557 openSettingsDialog
  4586 openSettingsDialog
  4558     |settingsList settingsApp|
  4587     |settingsList settingsApp|
  4559 
  4588 
  4560     settingsList :=
  4589     settingsList :=
  4561 	#(
  4590         #(
  4562 	   #('Debugger'       #'AbstractSettingsApplication::DebuggerSettingsAppl'            )
  4591            #('Debugger'       #'AbstractSettingsApplication::DebuggerSettingsAppl'            )
  4563 	   #('Editor'         #'AbstractSettingsApplication::EditSettingsAppl'                )
  4592            #('Editor'         #'AbstractSettingsApplication::EditSettingsAppl'                )
  4564 	   #('Syntax Color'   #'AbstractSettingsApplication::SyntaxColorSettingsAppl'         )
  4593            #('Syntax Color'   #'AbstractSettingsApplication::SyntaxColorSettingsAppl'         )
  4565 	   #('Code Format'    #'AbstractSettingsApplication::SourceCodeFormatSettingsAppl'    )
  4594            #('Code Format'    #'AbstractSettingsApplication::SourceCodeFormatSettingsAppl'    )
  4566 	).
  4595         ).
  4567 
  4596 
  4568     settingsApp := SettingsDialog new.
  4597     settingsApp := SettingsDialog new.
  4569     "/ settingsApp requestor:self.
  4598     "/ settingsApp requestor:self.
  4570     settingsApp installSettingsEntries:settingsList.
  4599     settingsApp installSettingsEntries:settingsList.
  4571     settingsApp allButOpen.
  4600     settingsApp allButOpen.
  4575 
  4604 
  4576 quickTerminate
  4605 quickTerminate
  4577     "quick terminate - the process will get no chance for cleanup actions"
  4606     "quick terminate - the process will get no chance for cleanup actions"
  4578 
  4607 
  4579     inspecting ifTrue:[
  4608     inspecting ifTrue:[
  4580 	self processPerform:#terminateNoSignal.
  4609         self processPerform:#terminateNoSignal.
  4581 	^ self
  4610         ^ self
  4582     ].
  4611     ].
  4583 
  4612 
  4584     steppedContext := wrapperContext := nil.
  4613     steppedContext := wrapperContext := nil.
  4585     haveControl := false.
  4614     haveControl := false.
  4586     exitAction := #quickTerminate.
  4615     exitAction := #quickTerminate.
  4588     "exit private event-loop"
  4617     "exit private event-loop"
  4589     catchBlock value.
  4618     catchBlock value.
  4590 
  4619 
  4591     "/ not reached (normally)
  4620     "/ not reached (normally)
  4592     inspecting ifFalse:[
  4621     inspecting ifFalse:[
  4593 	'DebugView [warning]: quick terminate failed' errorPrintCR.
  4622         'DebugView [warning]: quick terminate failed' errorPrintCR.
  4594 	(self confirm:'Regular quick terminate failed - do it the hard way ?') ifTrue:[
  4623         (self confirm:'Regular quick terminate failed - do it the hard way ?') ifTrue:[
  4595 	    Debugger newDebugger.
  4624             Debugger newDebugger.
  4596 	    Processor activeProcess terminateNoSignal.
  4625             Processor activeProcess terminateNoSignal.
  4597 	]
  4626         ]
  4598     ].
  4627     ].
  4599     terminateButton turnOff.
  4628     terminateButton turnOff.
  4600 
  4629 
  4601     "Modified: 10.1.1997 / 17:42:10 / cg"
  4630     "Modified: 10.1.1997 / 17:42:10 / cg"
  4602 !
  4631 !
  4603 
  4632 
  4604 removeAllBreakpoints
  4633 removeAllBreakpoints
  4605     "remove all trace & breakpoints - if any"
  4634     "remove all trace & breakpoints - if any"
  4606 
  4635 
  4607     (MessageTracer notNil and:[MessageTracer isLoaded]) ifTrue:[
  4636     (MessageTracer notNil and:[MessageTracer isLoaded]) ifTrue:[
  4608 	self withExecuteCursorDo:[
  4637         self withExecuteCursorDo:[
  4609 	    MessageTracer unwrapAllMethods
  4638             MessageTracer unwrapAllMethods
  4610 	]
  4639         ]
  4611     ]
  4640     ]
  4612 
  4641 
  4613     "Modified: / 21.5.1998 / 01:44:43 / cg"
  4642     "Modified: / 21.5.1998 / 01:44:43 / cg"
  4614 !
  4643 !
  4615 
  4644 
  4617     "remove breakpoint on the selected contexts method - if any"
  4646     "remove breakpoint on the selected contexts method - if any"
  4618 
  4647 
  4619     |implementorClass method|
  4648     |implementorClass method|
  4620 
  4649 
  4621     selectedContext isNil ifTrue:[
  4650     selectedContext isNil ifTrue:[
  4622 	^ self showError:'** select a context first **'
  4651         ^ self showError:'** select a context first **'
  4623     ].
  4652     ].
  4624     (MessageTracer isNil or:[MessageTracer isLoaded not]) ifTrue:[
  4653     (MessageTracer isNil or:[MessageTracer isLoaded not]) ifTrue:[
  4625 	^ self
  4654         ^ self
  4626     ].
  4655     ].
  4627 
  4656 
  4628     implementorClass := selectedContext methodClass.
  4657     implementorClass := selectedContext methodClass.
  4629     implementorClass notNil ifTrue:[
  4658     implementorClass notNil ifTrue:[
  4630 	method := implementorClass compiledMethodAt:selectedContext selector.
  4659         method := implementorClass compiledMethodAt:selectedContext selector.
  4631 	(method notNil and:[method isBreakpointed]) ifTrue:[
  4660         (method notNil and:[method isBreakpointed]) ifTrue:[
  4632 	    method clearBreakPoint
  4661             method clearBreakPoint
  4633 	]
  4662         ]
  4634     ].
  4663     ].
  4635     contextView middleButtonMenu disable:#removeBreakpoint.
  4664     contextView middleButtonMenu disable:#removeBreakpoint.
  4636     contextView middleButtonMenu enable:#addBreakpoint.
  4665     contextView middleButtonMenu enable:#addBreakpoint.
  4637 
  4666 
  4638     "Modified: / 13.1.1998 / 00:24:47 / cg"
  4667     "Modified: / 13.1.1998 / 00:24:47 / cg"
  4640 
  4669 
  4641 selectedContextIsWrapped
  4670 selectedContextIsWrapped
  4642     |con mthd|
  4671     |con mthd|
  4643 
  4672 
  4644     contextView selection notNil ifTrue:[
  4673     contextView selection notNil ifTrue:[
  4645 	(contextView selectionValue startsWith:'**') ifFalse:[
  4674         (contextView selectionValue startsWith:'**') ifFalse:[
  4646 	    con := contextArray at:(contextView selection).
  4675             con := contextArray at:(contextView selection).
  4647 	    mthd := con methodHome method.
  4676             mthd := con methodHome method.
  4648 	    ^ mthd notNil and:[mthd isWrapped]
  4677             ^ mthd notNil and:[mthd isWrapped]
  4649 	]
  4678         ]
  4650     ].
  4679     ].
  4651     ^ false.
  4680     ^ false.
  4652 !
  4681 !
  4653 
  4682 
  4654 showDenseWalkback
  4683 showDenseWalkback
  4666 
  4695 
  4667 showMore
  4696 showMore
  4668     "double the number of contexts shown"
  4697     "double the number of contexts shown"
  4669 
  4698 
  4670     contextArray notNil ifTrue:[
  4699     contextArray notNil ifTrue:[
  4671 	nChainShown := nChainShown * 2.
  4700         nChainShown := nChainShown * 2.
  4672 	self redisplayBacktrace.
  4701         self redisplayBacktrace.
  4673     ]
  4702     ]
  4674 
  4703 
  4675     "Modified: / 17.11.2001 / 20:14:31 / cg"
  4704     "Modified: / 17.11.2001 / 20:14:31 / cg"
  4676 !
  4705 !
  4677 
  4706 
  4730     "skip until some particular method is invoked."
  4759     "skip until some particular method is invoked."
  4731 
  4760 
  4732     |selector|
  4761     |selector|
  4733 
  4762 
  4734     selector := Dialog
  4763     selector := Dialog
  4735 		request:'Skip until entering what (matchpattern):'
  4764                 request:'Skip until entering what (matchpattern):'
  4736 		initialAnswer:self goodSkipUntilSelector.
  4765                 initialAnswer:self goodSkipUntilSelector.
  4737     selector size == 0 ifTrue:[^ self].
  4766     selector size == 0 ifTrue:[^ self].
  4738 
  4767 
  4739     stepUntilEntering := selector asSymbol.
  4768     stepUntilEntering := selector asSymbol.
  4740     stepHow := #send.
  4769     stepHow := #send.
  4741     self doStep:-1.
  4770     self doStep:-1.
  4747     self class stopIgnoringHalts
  4776     self class stopIgnoringHalts
  4748 !
  4777 !
  4749 
  4778 
  4750 toggleVerboseWalkback
  4779 toggleVerboseWalkback
  4751     verboseBacktrace ifFalse:[
  4780     verboseBacktrace ifFalse:[
  4752 	self showVerboseWalkback
  4781         self showVerboseWalkback
  4753     ] ifTrue:[
  4782     ] ifTrue:[
  4754 	self showDenseWalkback
  4783         self showDenseWalkback
  4755     ].
  4784     ].
  4756 
  4785 
  4757     "Modified: / 17.11.2001 / 20:07:45 / cg"
  4786     "Modified: / 17.11.2001 / 20:07:45 / cg"
  4758 ! !
  4787 ! !
  4759 
  4788 
  4833 
  4862 
  4834 contextListEntryFor:aContext
  4863 contextListEntryFor:aContext
  4835     |s|
  4864     |s|
  4836 
  4865 
  4837     aContext selector == #doIt ifTrue:[
  4866     aContext selector == #doIt ifTrue:[
  4838 	aContext receiver isNil ifTrue:[
  4867         aContext receiver isNil ifTrue:[
  4839 	    ^ 'doIt' allBold
  4868             ^ 'doIt' allBold
  4840 	]
  4869         ]
  4841     ].
  4870     ].
  4842 
  4871 
  4843     s := Text new writeStream.
  4872     s := Text new writeStream.
  4844     aContext printOn:s.
  4873     aContext printOn:s.
  4845     ^ s contents
  4874     ^ s contents
  4854 explainSelection
  4883 explainSelection
  4855     |interval crsrPos|
  4884     |interval crsrPos|
  4856 
  4885 
  4857     interval := self selectedInterval.
  4886     interval := self selectedInterval.
  4858     interval isEmpty ifTrue:[
  4887     interval isEmpty ifTrue:[
  4859 	crsrPos := codeView characterPositionOfCursor.
  4888         crsrPos := codeView characterPositionOfCursor.
  4860 	codeView characterUnderCursor isSeparator ifTrue:[
  4889         codeView characterUnderCursor isSeparator ifTrue:[
  4861 	    crsrPos := (crsrPos - 1) max:1
  4890             crsrPos := (crsrPos - 1) max:1
  4862 	].
  4891         ].
  4863 	interval := crsrPos to:crsrPos.
  4892         interval := crsrPos to:crsrPos.
  4864     ].
  4893     ].
  4865     self
  4894     self
  4866 	withNodeValueAtInterval:interval
  4895         withNodeValueAtInterval:interval
  4867 	do:[:value :description |
  4896         do:[:value :description |
  4868 	    self showValue:value
  4897             self showValue:value
  4869 	].
  4898         ].
  4870 !
  4899 !
  4871 
  4900 
  4872 findNodeForInterval:interval
  4901 findNodeForInterval:interval
  4873     |source|
  4902     |source|
  4874 
  4903 
  4890     |node|
  4919     |node|
  4891 
  4920 
  4892 self obsoleteMethodWarning.
  4921 self obsoleteMethodWarning.
  4893     node := nil.
  4922     node := nil.
  4894     tree nodesDo:[:each |
  4923     tree nodesDo:[:each |
  4895 	(each intersectsInterval:interval) ifTrue:[
  4924         (each intersectsInterval:interval) ifTrue:[
  4896 	    (node isNil or:[node == each parent]) ifTrue:[
  4925             (node isNil or:[node == each parent]) ifTrue:[
  4897 		node := each
  4926                 node := each
  4898 	    ] ifFalse:[
  4927             ] ifFalse:[
  4899 		(node parent notNil
  4928                 (node parent notNil
  4900 		    and:[node parent isCascade and:[each parent isCascade]]) ifFalse:[^ nil]
  4929                     and:[node parent isCascade and:[each parent isCascade]]) ifFalse:[^ nil]
  4901 	    ]
  4930             ]
  4902 	]
  4931         ]
  4903     ].
  4932     ].
  4904     ^ node
  4933     ^ node
  4905 !
  4934 !
  4906 
  4935 
  4907 goodSkipUntilSelector
  4936 goodSkipUntilSelector
  4910     lastStepUntilEntering notNil ifTrue:[^ lastStepUntilEntering].
  4939     lastStepUntilEntering notNil ifTrue:[^ lastStepUntilEntering].
  4911     selectedContext isNil ifTrue:[^ nil].
  4940     selectedContext isNil ifTrue:[^ nil].
  4912     current := selectedContext selector.
  4941     current := selectedContext selector.
  4913     current isNil ifTrue:[^ nil].
  4942     current isNil ifTrue:[^ nil].
  4914     ('change:*' match:current) ifTrue:[
  4943     ('change:*' match:current) ifTrue:[
  4915 	^ 'update:*'
  4944         ^ 'update:*'
  4916     ].
  4945     ].
  4917     ^ nil
  4946     ^ nil
  4918 !
  4947 !
  4919 
  4948 
  4920 haltSelectors
  4949 haltSelectors
  4935 
  4964 
  4936 interruptProcessWith:aBlock
  4965 interruptProcessWith:aBlock
  4937     "let inspected process do something, then update the context list"
  4966     "let inspected process do something, then update the context list"
  4938 
  4967 
  4939     inspectedProcess isDead ifTrue:[
  4968     inspectedProcess isDead ifTrue:[
  4940 	self showTerminated.
  4969         self showTerminated.
  4941 	^ self
  4970         ^ self
  4942     ].
  4971     ].
  4943     inspectedProcess interruptWith:aBlock.
  4972     inspectedProcess interruptWith:aBlock.
  4944     "
  4973     "
  4945      give the process a chance to run, then update
  4974      give the process a chance to run, then update
  4946     "
  4975     "
  4960 
  4989 
  4961 processPerform:aMessage
  4990 processPerform:aMessage
  4962     "do something, then update the context list"
  4991     "do something, then update the context list"
  4963 
  4992 
  4964     inspectedProcess isDead ifTrue:[
  4993     inspectedProcess isDead ifTrue:[
  4965 	self showTerminated.
  4994         self showTerminated.
  4966 	^ self
  4995         ^ self
  4967     ].
  4996     ].
  4968     inspectedProcess perform:aMessage.
  4997     inspectedProcess perform:aMessage.
  4969 
  4998 
  4970     "
  4999     "
  4971      give the process a chance to run, then update
  5000      give the process a chance to run, then update
  4979      verbose-flag setting is changed"
  5008      verbose-flag setting is changed"
  4980 
  5009 
  4981     |oldSelection oldContext con idx|
  5010     |oldSelection oldContext con idx|
  4982 
  5011 
  4983     contextArray notNil ifTrue:[
  5012     contextArray notNil ifTrue:[
  4984 	self withExecuteCursorDo:[
  5013         self withExecuteCursorDo:[
  4985 	    oldSelection := contextView selection.
  5014             oldSelection := contextView selection.
  4986 	    oldSelection notNil ifTrue:[
  5015             oldSelection notNil ifTrue:[
  4987 		oldContext := contextArray at:oldSelection ifAbsent:nil.
  5016                 oldContext := contextArray at:oldSelection ifAbsent:nil.
  4988 	    ].
  5017             ].
  4989 
  5018 
  4990 	    con := firstContext.
  5019             con := firstContext.
  4991 "/            con := contextArray at:1.
  5020 "/            con := contextArray at:1.
  4992 	    "/ force redeisplay, even if same by changing the first entry
  5021             "/ force redeisplay, even if same by changing the first entry
  4993 	    contextArray size > 0 ifTrue:[
  5022             contextArray size > 0 ifTrue:[
  4994 		contextArray at:1 put:nil.
  5023                 contextArray at:1 put:nil.
  4995 	    ].
  5024             ].
  4996 	    self setContext:con.
  5025             self setContext:con.
  4997 
  5026 
  4998 	    oldContext isNil ifTrue:[
  5027             oldContext isNil ifTrue:[
  4999 		idx := oldSelection
  5028                 idx := oldSelection
  5000 	    ] ifFalse:[
  5029             ] ifFalse:[
  5001 		idx := contextArray identityIndexOf:oldContext ifAbsent:nil.
  5030                 idx := contextArray identityIndexOf:oldContext ifAbsent:nil.
  5002 	    ].
  5031             ].
  5003 	    contextView setSelection:idx.
  5032             contextView setSelection:idx.
  5004 	    idx notNil ifTrue:[
  5033             idx notNil ifTrue:[
  5005 		self showSelection:idx
  5034                 self showSelection:idx
  5006 	    ]
  5035             ]
  5007 	]
  5036         ]
  5008     ]
  5037     ]
  5009 
  5038 
  5010     "Created: / 10.1.1997 / 21:36:46 / cg"
  5039     "Created: / 10.1.1997 / 21:36:46 / cg"
  5011     "Modified: / 21.5.1998 / 01:47:07 / cg"
  5040     "Modified: / 21.5.1998 / 01:47:07 / cg"
  5012 !
  5041 !
  5016 !
  5045 !
  5017 
  5046 
  5018 showError:message
  5047 showError:message
  5019     codeView contents:(resources string:message).
  5048     codeView contents:(resources string:message).
  5020     shown ifTrue:[
  5049     shown ifTrue:[
  5021 	exclusive ifTrue:[
  5050         exclusive ifTrue:[
  5022 	    "/ consider this a kludge:
  5051             "/ consider this a kludge:
  5023 	    "/ if exclusive, cannot use flash, since it suspends
  5052             "/ if exclusive, cannot use flash, since it suspends
  5024 	    "/ (but we cannot suspend here ...)
  5053             "/ (but we cannot suspend here ...)
  5025 	    codeView redrawInverted. device flush.
  5054             codeView redrawInverted. device flush.
  5026 	    OperatingSystem millisecondDelay:200.
  5055             OperatingSystem millisecondDelay:200.
  5027 	    codeView redraw
  5056             codeView redraw
  5028 	] ifFalse:[
  5057         ] ifFalse:[
  5029 	    codeView flash
  5058             codeView flash
  5030 	]
  5059         ]
  5031     ]
  5060     ]
  5032 
  5061 
  5033     "Modified: / 18.11.2001 / 00:01:13 / cg"
  5062     "Modified: / 18.11.2001 / 00:01:13 / cg"
  5034 !
  5063 !
  5035 
  5064 
  5058 updateButtonsAndMenuItemsForContext:aContext
  5087 updateButtonsAndMenuItemsForContext:aContext
  5059     |m|
  5088     |m|
  5060 
  5089 
  5061     m := contextView middleButtonMenu.
  5090     m := contextView middleButtonMenu.
  5062     m notNil ifTrue:[
  5091     m notNil ifTrue:[
  5063 	self updateMenuItems.
  5092         self updateMenuItems.
  5064 
  5093 
  5065 	(inspecting or:[AbortOperationRequest isHandledIn:aContext]) ifTrue:[
  5094         (inspecting or:[AbortOperationRequest isHandledIn:aContext]) ifTrue:[
  5066 	    abortButton enable.
  5095             abortButton enable.
  5067 	    m enable:#doAbort.
  5096             m enable:#doAbort.
  5068 	] ifFalse:[
  5097         ] ifFalse:[
  5069 	    abortButton disable.
  5098             abortButton disable.
  5070 	    m disable:#doAbort.
  5099             m disable:#doAbort.
  5071 	].
  5100         ].
  5072 	exclusive ifTrue:[
  5101         exclusive ifTrue:[
  5073 	    terminateButton disable.
  5102             terminateButton disable.
  5074 	    m disable:#doTerminate.
  5103             m disable:#doTerminate.
  5075 	] ifFalse:[
  5104         ] ifFalse:[
  5076 	    terminateButton enable.
  5105             terminateButton enable.
  5077 	    m enable:#doTerminate.
  5106             m enable:#doTerminate.
  5078 	].
  5107         ].
  5079     ].
  5108     ].
  5080 
  5109 
  5081     mayProceed == false ifTrue:[
  5110     mayProceed == false ifTrue:[
  5082 	continueButton disable.
  5111         continueButton disable.
  5083 	m notNil ifTrue:[m disable:#doContinue].
  5112         m notNil ifTrue:[m disable:#doContinue].
  5084     ] ifFalse:[
  5113     ] ifFalse:[
  5085 	continueButton enable.
  5114         continueButton enable.
  5086 	m notNil ifTrue:[m enable:#doContinue]
  5115         m notNil ifTrue:[m enable:#doContinue]
  5087     ].
  5116     ].
  5088 
  5117 
  5089     "Created: / 06-07-2011 / 12:24:53 / cg"
  5118     "Created: / 06-07-2011 / 12:24:53 / cg"
  5090 !
  5119 !
  5091 
  5120 
  5092 updateContext
  5121 updateContext
  5093     |oldContext idx|
  5122     |oldContext idx|
  5094 
  5123 
  5095     inspectedProcess state == #dead ifTrue:[
  5124     inspectedProcess state == #dead ifTrue:[
  5096 	self showTerminated.
  5125         self showTerminated.
  5097 	^ self
  5126         ^ self
  5098     ].
  5127     ].
  5099 
  5128 
  5100     oldContext := selectedContext.
  5129     oldContext := selectedContext.
  5101     [
  5130     [
  5102 	(self setContextSkippingInterruptContexts:inspectedProcess suspendedContext) ifTrue:[
  5131         (self setContextSkippingInterruptContexts:inspectedProcess suspendedContext) ifTrue:[
  5103 	    oldContext notNil ifTrue:[
  5132             oldContext notNil ifTrue:[
  5104 		contextArray notNil ifTrue:[
  5133                 contextArray notNil ifTrue:[
  5105 		    idx := contextArray identityIndexOf:oldContext.
  5134                     idx := contextArray identityIndexOf:oldContext.
  5106 		    idx ~~ 0 ifTrue:[
  5135                     idx ~~ 0 ifTrue:[
  5107 			self showSelection:idx
  5136                         self showSelection:idx
  5108 		    ] ifFalse:[
  5137                     ] ifFalse:[
  5109 			codeView contents:('** context returned **')
  5138                         codeView contents:('** context returned **')
  5110 		    ]
  5139                     ]
  5111 		]
  5140                 ]
  5112 	    ]
  5141             ]
  5113 	].
  5142         ].
  5114     ] valueUninterruptably.
  5143     ] valueUninterruptably.
  5115 
  5144 
  5116     "Modified: 20.10.1996 / 18:11:24 / cg"
  5145     "Modified: 20.10.1996 / 18:11:24 / cg"
  5117 !
  5146 !
  5118 
  5147 
  5122     "
  5151     "
  5123      enable/disable some menu items
  5152      enable/disable some menu items
  5124     "
  5153     "
  5125     m := contextView middleButtonMenu.
  5154     m := contextView middleButtonMenu.
  5126     m notNil ifTrue:[
  5155     m notNil ifTrue:[
  5127 	m disable:#removeBreakpoint.
  5156         m disable:#removeBreakpoint.
  5128 	m disable:#addBreakpoint.
  5157         m disable:#addBreakpoint.
  5129 	canShowMore ifFalse:[
  5158         canShowMore ifFalse:[
  5130 	    m disable:#showMore
  5159             m disable:#showMore
  5131 	].
  5160         ].
  5132 
  5161 
  5133 	selectedContext notNil ifTrue:[
  5162         selectedContext notNil ifTrue:[
  5134 	    m enableAll:#(browseImplementors browseSenders inspectContext skip skipForReturn).
  5163             m enableAll:#(browseImplementors browseSenders inspectContext skip skipForReturn).
  5135 
  5164 
  5136 	    mthd := selectedContext method.
  5165             mthd := selectedContext method.
  5137 	    mthd notNil ifTrue:[
  5166             mthd notNil ifTrue:[
  5138 		cls := mCls := mthd containingClass.
  5167                 cls := mCls := mthd containingClass.
  5139 		mthd isBreakpointed ifTrue:[
  5168                 mthd isBreakpointed ifTrue:[
  5140 		    m enable:#removeBreakpoint.
  5169                     m enable:#removeBreakpoint.
  5141 		] ifFalse:[
  5170                 ] ifFalse:[
  5142 		    m enable:#addBreakpoint.
  5171                     m enable:#addBreakpoint.
  5143 		]
  5172                 ]
  5144 	    ].
  5173             ].
  5145 	    rCls := selectedContext receiver class.
  5174             rCls := selectedContext receiver class.
  5146 	    cls isNil ifTrue:[
  5175             cls isNil ifTrue:[
  5147 		cls := rCls
  5176                 cls := rCls
  5148 	    ].
  5177             ].
  5149 	    cls notNil ifTrue:[
  5178             cls notNil ifTrue:[
  5150 		m enableAll:#(browseImplementingClass browseReceiversClass browseClassHierarchy browseFullClassProtocol).
  5179                 m enableAll:#(browseImplementingClass browseReceiversClass browseClassHierarchy browseFullClassProtocol).
  5151 		rCls == mCls ifTrue:[
  5180                 rCls == mCls ifTrue:[
  5152 		    m disable:#browseReceiversClass
  5181                     m disable:#browseReceiversClass
  5153 		].
  5182                 ].
  5154 		mCls isNil ifTrue:[
  5183                 mCls isNil ifTrue:[
  5155 		    m disable:#browseImplementingClass
  5184                     m disable:#browseImplementingClass
  5156 		]
  5185                 ]
  5157 
  5186 
  5158 	    ] ifFalse:[
  5187             ] ifFalse:[
  5159 		m disableAll:#(browseImplementingClass browseReceiversClass browseClassHierarchy browseFullClassProtocol).
  5188                 m disableAll:#(browseImplementingClass browseReceiversClass browseClassHierarchy browseFullClassProtocol).
  5160 	    ].
  5189             ].
  5161 	] ifFalse:[
  5190         ] ifFalse:[
  5162 	    m disableAll:#(browseImplementingClass browseReceiversClass browseClassHierarchy browseFullClassProtocol).
  5191             m disableAll:#(browseImplementingClass browseReceiversClass browseClassHierarchy browseFullClassProtocol).
  5163 	]
  5192         ]
  5164     ]
  5193     ]
  5165 !
  5194 !
  5166 
  5195 
  5167 withNodeValueAtInterval:interval do:aBlock
  5196 withNodeValueAtInterval:interval do:aBlock
  5168     |node definingNode nm nmBold varIdx parentNode receiver con receiversNonMetaClass|
  5197     |node definingNode nm nmBold varIdx parentNode receiver con receiversNonMetaClass|
  5169 
  5198 
  5170 "/interval printCR.
  5199 "/interval printCR.
  5171     Error
  5200     Error
  5172 	handle:[:ex | ]
  5201         handle:[:ex | ]
  5173 	do:[
  5202         do:[
  5174 	    [
  5203             [
  5175 		node := self findNodeForInterval:interval
  5204                 node := self findNodeForInterval:interval
  5176 	    ] valueWithWatchDog:[ ^ self ] afterMilliseconds:50.
  5205             ] valueWithWatchDog:[ ^ self ] afterMilliseconds:50.
  5177 	].
  5206         ].
  5178 
  5207 
  5179     node isNil ifTrue:[ ^ self ].
  5208     node isNil ifTrue:[ ^ self ].
  5180     node isVariable ifFalse:[
  5209     node isVariable ifFalse:[
  5181 	"/ Transcript showCR:node.
  5210         "/ Transcript showCR:node.
  5182 	^ self
  5211         ^ self
  5183     ].
  5212     ].
  5184 
  5213 
  5185     nm := node name.
  5214     nm := node name.
  5186     nmBold := nm allBold.
  5215     nmBold := nm allBold.
  5187     actualContext isNil ifTrue:[^ self ].
  5216     actualContext isNil ifTrue:[^ self ].
  5188     actualContext methodHome isNil ifTrue:[^ self ].
  5217     actualContext methodHome isNil ifTrue:[^ self ].
  5189     receiver := actualContext methodHome receiver.
  5218     receiver := actualContext methodHome receiver.
  5190 
  5219 
  5191     (nm = 'self') ifTrue:[
  5220     (nm = 'self') ifTrue:[
  5192 	aBlock value:receiver value:'receiver' allBold.
  5221         aBlock value:receiver value:'receiver' allBold.
  5193 	^ self
  5222         ^ self
  5194     ].
  5223     ].
  5195     (nm = 'super') ifTrue:[
  5224     (nm = 'super') ifTrue:[
  5196 	aBlock value:receiver value:'receiver' allBold.
  5225         aBlock value:receiver value:'receiver' allBold.
  5197 	^ self
  5226         ^ self
  5198     ].
  5227     ].
  5199     (nm = 'thisContext') ifTrue:[
  5228     (nm = 'thisContext') ifTrue:[
  5200 	aBlock value:actualContext value:'context' allBold.
  5229         aBlock value:actualContext value:'context' allBold.
  5201 	^ self
  5230         ^ self
  5202     ].
  5231     ].
  5203 
  5232 
  5204     definingNode := node whoDefines:nm.
  5233     definingNode := node whoDefines:nm.
  5205     definingNode isNil ifTrue:[
  5234     definingNode isNil ifTrue:[
  5206 	(receiver class allInstVarNames includes:nm) ifTrue:[
  5235         (receiver class allInstVarNames includes:nm) ifTrue:[
  5207 "/aBlock value:'xIII' value:'instVar'.
  5236 "/aBlock value:'xIII' value:'instVar'.
  5208 	    receiver class isMetaclass ifTrue:[
  5237             receiver class isMetaclass ifTrue:[
  5209 		aBlock value:(receiver instVarNamed:nm) value:'classInstVar ',nmBold.
  5238                 aBlock value:(receiver instVarNamed:nm) value:'classInstVar ',nmBold.
  5210 	    ] ifFalse:[
  5239             ] ifFalse:[
  5211 		aBlock value:(receiver instVarNamed:nm) value:'instVar ',nmBold.
  5240                 aBlock value:(receiver instVarNamed:nm) value:'instVar ',nmBold.
  5212 	    ].
  5241             ].
  5213 	    ^ self
  5242             ^ self
  5214 	].
  5243         ].
  5215 
  5244 
  5216 	receiversNonMetaClass := receiver class theNonMetaclass.
  5245         receiversNonMetaClass := receiver class theNonMetaclass.
  5217 	(receiversNonMetaClass privateClasses contains:[:cls | cls nameWithoutPrefix = nm]) ifTrue:[
  5246         (receiversNonMetaClass privateClasses contains:[:cls | cls nameWithoutPrefix = nm]) ifTrue:[
  5218 	    aBlock value:'' value:'private class ',nmBold.
  5247             aBlock value:'' value:'private class ',nmBold.
  5219 	    ^ self
  5248             ^ self
  5220 	].
  5249         ].
  5221 	(receiversNonMetaClass classVarNames includes:nm) ifTrue:[
  5250         (receiversNonMetaClass classVarNames includes:nm) ifTrue:[
  5222 	    aBlock value:((currentMethod mclass ? receiversNonMetaClass) theNonMetaclass classVarAt:nm) value:'classVar ',nmBold.
  5251             aBlock value:((currentMethod mclass ? receiversNonMetaClass) theNonMetaclass classVarAt:nm) value:'classVar ',nmBold.
  5223 	    ^ self
  5252             ^ self
  5224 	].
  5253         ].
  5225 	receiversNonMetaClass sharedPoolNames do:[:eachPoolName |
  5254         receiversNonMetaClass sharedPoolNames do:[:eachPoolName |
  5226 	    |pool|
  5255             |pool|
  5227 
  5256 
  5228 	    pool := Smalltalk at:eachPoolName.
  5257             pool := Smalltalk at:eachPoolName.
  5229 	    pool isNil ifTrue:[ pool := receiversNonMetaClass topNameSpace at:eachPoolName].
  5258             pool isNil ifTrue:[ pool := receiversNonMetaClass topNameSpace at:eachPoolName].
  5230 	    (pool classVarNames includes:nm) ifTrue:[
  5259             (pool classVarNames includes:nm) ifTrue:[
  5231 		aBlock value:(pool classVarAt:nm) value:'poolVar ',nm allBold,' in ',eachPoolName allBold,' '.
  5260                 aBlock value:(pool classVarAt:nm) value:'poolVar ',nm allBold,' in ',eachPoolName allBold,' '.
  5232 		^ self
  5261                 ^ self
  5233 	    ].
  5262             ].
  5234 	].
  5263         ].
  5235 	(Smalltalk includesKey:nm asSymbol) ifTrue:[
  5264         (Smalltalk includesKey:nm asSymbol) ifTrue:[
  5236 	    (Smalltalk at:nm asSymbol) isClass ifTrue:[
  5265             (Smalltalk at:nm asSymbol) isClass ifTrue:[
  5237 		aBlock value:'class: ',nmBold value:nil.
  5266                 aBlock value:'class: ',nmBold value:nil.
  5238 	    ] ifFalse:[
  5267             ] ifFalse:[
  5239 		aBlock value:(Smalltalk at:nm asSymbol) value:'global ',nmBold.
  5268                 aBlock value:(Smalltalk at:nm asSymbol) value:'global ',nmBold.
  5240 	    ].
  5269             ].
  5241 	    ^ self
  5270             ^ self
  5242 	].
  5271         ].
  5243 	aBlock value:'' value:'unknown'.
  5272         aBlock value:'' value:'unknown'.
  5244 	^ self
  5273         ^ self
  5245     ].
  5274     ].
  5246 "/definingNode printCR.
  5275 "/definingNode printCR.
  5247 
  5276 
  5248     definingNode isMethod ifTrue:[
  5277     definingNode isMethod ifTrue:[
  5249 	varIdx := definingNode arguments findFirst:[:arg | arg name = nm].
  5278         varIdx := definingNode arguments findFirst:[:arg | arg name = nm].
  5250 	varIdx ~~ 0 ifTrue:[
  5279         varIdx ~~ 0 ifTrue:[
  5251 	    Error
  5280             Error
  5252 		handle:[:ex | ]
  5281                 handle:[:ex | ]
  5253 		do:[ aBlock value:(actualContext methodHome argAt:varIdx) value:'methodArg ',nmBold ].
  5282                 do:[ aBlock value:(actualContext methodHome argAt:varIdx) value:'methodArg ',nmBold ].
  5254 	    ^ self
  5283             ^ self
  5255 	].
  5284         ].
  5256 	varIdx := definingNode temporaries findFirst:[:var | var name = nm].
  5285         varIdx := definingNode temporaries findFirst:[:var | var name = nm].
  5257 	varIdx ~~ 0 ifTrue:[
  5286         varIdx ~~ 0 ifTrue:[
  5258 	    actualContext methodHome numVars >= varIdx ifTrue:[
  5287             actualContext methodHome numVars >= varIdx ifTrue:[
  5259 		Error
  5288                 Error
  5260 		    handle:[:ex | ]
  5289                     handle:[:ex | ]
  5261 		    do:[ aBlock value:(actualContext methodHome varAt:varIdx) value:'methodVar ',nmBold ].
  5290                     do:[ aBlock value:(actualContext methodHome varAt:varIdx) value:'methodVar ',nmBold ].
  5262 		^ self
  5291                 ^ self
  5263 	    ]
  5292             ]
  5264 	].
  5293         ].
  5265     ].
  5294     ].
  5266 
  5295 
  5267     definingNode isBlock ifTrue:[
  5296     definingNode isBlock ifTrue:[
  5268 	varIdx := definingNode arguments findFirst:[:arg | arg name = nm].
  5297         varIdx := definingNode arguments findFirst:[:arg | arg name = nm].
  5269 	(definingNode arguments contains:[:arg | arg name = nm]) ifTrue:[
  5298         (definingNode arguments contains:[:arg | arg name = nm]) ifTrue:[
  5270 	    varIdx ~~ 0 ifTrue:[
  5299             varIdx ~~ 0 ifTrue:[
  5271 		"/ am I in this block ?
  5300                 "/ am I in this block ?
  5272 		(actualContext lineNumber notNil
  5301                 (actualContext lineNumber notNil
  5273 		and:[ definingNode lastLineNumber notNil
  5302                 and:[ definingNode lastLineNumber notNil
  5274 		and:[ (actualContext lineNumber
  5303                 and:[ (actualContext lineNumber
  5275 			    between:definingNode firstLineNumber
  5304                             between:definingNode firstLineNumber
  5276 			    and:definingNode lastLineNumber)
  5305                             and:definingNode lastLineNumber)
  5277 		and:[ varIdx <= actualContext numArgs ] ]])
  5306                 and:[ varIdx <= actualContext numArgs ] ]])
  5278 		ifTrue:[
  5307                 ifTrue:[
  5279 		    aBlock value:(actualContext argAt:varIdx) value:'blockArg ',nmBold .
  5308                     aBlock value:(actualContext argAt:varIdx) value:'blockArg ',nmBold .
  5280 		    ^ self
  5309                     ^ self
  5281 		].
  5310                 ].
  5282 aBlock value:nmBold , ' is not in scope of selected context' value:nil.
  5311 aBlock value:nmBold , ' is not in scope of selected context' value:nil.
  5283 		^ self
  5312                 ^ self
  5284 	    ]
  5313             ]
  5285 	].
  5314         ].
  5286     ].
  5315     ].
  5287 
  5316 
  5288     parentNode := definingNode parent.
  5317     parentNode := definingNode parent.
  5289 
  5318 
  5290     [parentNode notNil] whileTrue:[
  5319     [parentNode notNil] whileTrue:[
  5291 "/'isMethod ' print. parentNode isMethod printCR.
  5320 "/'isMethod ' print. parentNode isMethod printCR.
  5292 	parentNode isMethod ifTrue:[
  5321         parentNode isMethod ifTrue:[
  5293 	    varIdx := parentNode temporaries findFirst:[:var | var name = nm].
  5322             varIdx := parentNode temporaries findFirst:[:var | var name = nm].
  5294 	    varIdx ~~ 0 ifTrue:[
  5323             varIdx ~~ 0 ifTrue:[
  5295 		actualContext methodHome numVars >= varIdx ifTrue:[
  5324                 actualContext methodHome numVars >= varIdx ifTrue:[
  5296 		    Error
  5325                     Error
  5297 			handle:[:ex | ]
  5326                         handle:[:ex | ]
  5298 			do:[ aBlock value:(actualContext methodHome varAt:varIdx) value:'methodVar ',nmBold ].
  5327                         do:[ aBlock value:(actualContext methodHome varAt:varIdx) value:'methodVar ',nmBold ].
  5299 		    ^ self
  5328                     ^ self
  5300 		]
  5329                 ]
  5301 	    ].
  5330             ].
  5302 	].
  5331         ].
  5303 "/'isBlock ' print. parentNode isBlock printCR.
  5332 "/'isBlock ' print. parentNode isBlock printCR.
  5304 	parentNode isBlock ifTrue:[
  5333         parentNode isBlock ifTrue:[
  5305 	    "/ we dont have any information on the inlineability
  5334             "/ we dont have any information on the inlineability
  5306 	    "/ of this block here (RBParser does not know what
  5335             "/ of this block here (RBParser does not know what
  5307 	    "/ the compiler does.
  5336             "/ the compiler does.
  5308 	    "/ therefore, it is questionable if we can use the
  5337             "/ therefore, it is questionable if we can use the
  5309 	    "/ contexts home context here.
  5338             "/ contexts home context here.
  5310 	    "/ am I in this block ?
  5339             "/ am I in this block ?
  5311 	    con := actualContext.
  5340             con := actualContext.
  5312 	    [con notNil
  5341             [con notNil
  5313 	    and:[ parentNode lastLineNumber notNil
  5342             and:[ parentNode lastLineNumber notNil
  5314 	    and:[ con lineNumber notNil
  5343             and:[ con lineNumber notNil
  5315 	    and:[ con lineNumber
  5344             and:[ con lineNumber
  5316 		    between:parentNode firstLineNumber
  5345                     between:parentNode firstLineNumber
  5317 		    and:parentNode lastLineNumber ]]]] whileTrue:[
  5346                     and:parentNode lastLineNumber ]]]] whileTrue:[
  5318 		con := con sender.
  5347                 con := con sender.
  5319 	    ].
  5348             ].
  5320 	    con notNil ifTrue:[
  5349             con notNil ifTrue:[
  5321 		varIdx := parentNode arguments findFirst:[:arg | arg name = nm].
  5350                 varIdx := parentNode arguments findFirst:[:arg | arg name = nm].
  5322 		varIdx ~~ 0 ifTrue:[
  5351                 varIdx ~~ 0 ifTrue:[
  5323 		    Error
  5352                     Error
  5324 			handle:[:ex | ]
  5353                         handle:[:ex | ]
  5325 			do:[ aBlock value:(con argAt:varIdx) value:'blockArg ',nmBold ].
  5354                         do:[ aBlock value:(con argAt:varIdx) value:'blockArg ',nmBold ].
  5326 		    ^ self
  5355                     ^ self
  5327 		].
  5356                 ].
  5328 		varIdx := parentNode body temporaries findFirst:[:var | var name = nm].
  5357                 varIdx := parentNode body temporaries findFirst:[:var | var name = nm].
  5329 		varIdx ~~ 0 ifTrue:[
  5358                 varIdx ~~ 0 ifTrue:[
  5330 		    Error
  5359                     Error
  5331 			handle:[:ex | ]
  5360                         handle:[:ex | ]
  5332 			do:[ aBlock value:(con varAt:varIdx) value:'blockVar ',nmBold ].
  5361                         do:[ aBlock value:(con varAt:varIdx) value:'blockVar ',nmBold ].
  5333 		    ^ self
  5362                     ^ self
  5334 		].
  5363                 ].
  5335 	    ].
  5364             ].
  5336 	].
  5365         ].
  5337 	parentNode := parentNode parent.
  5366         parentNode := parentNode parent.
  5338     ].
  5367     ].
  5339     aBlock value:nmBold , ' is not in scope of selected context' value:nil.
  5368     aBlock value:nmBold , ' is not in scope of selected context' value:nil.
  5340 
  5369 
  5341     "Modified: / 18-01-2011 / 17:57:34 / cg"
  5370     "Modified: / 18-01-2011 / 17:57:34 / cg"
  5342 ! !
  5371 ! !
  5355     setOfHiddenCallingSelectors := aCollectionOfSymbols
  5384     setOfHiddenCallingSelectors := aCollectionOfSymbols
  5356 ! !
  5385 ! !
  5357 
  5386 
  5358 !DebugView methodsFor:'private-breakpoints'!
  5387 !DebugView methodsFor:'private-breakpoints'!
  5359 
  5388 
  5360 addIgnoredHaltForCount:countOrNil orTimeDuration:dTOrNil forAll:aBoolean
  5389 addIgnoredHaltForCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey forAll:aBoolean
  5361     |haltingContext haltingMethod lineNrOfHalt|
  5390     |haltingContext haltingMethod lineNrOfHalt|
  5362 
  5391 
  5363     aBoolean ifTrue:[
  5392     aBoolean ifTrue:[
  5364         haltingMethod := #all
  5393         haltingMethod := #all
  5365     ] ifFalse:[
  5394     ] ifFalse:[
  5373         lineNrOfHalt := haltingContext lineNumber.
  5402         lineNrOfHalt := haltingContext lineNumber.
  5374     ].
  5403     ].
  5375 
  5404 
  5376     self class
  5405     self class
  5377         ignoreHaltIn:haltingMethod at:lineNrOfHalt
  5406         ignoreHaltIn:haltingMethod at:lineNrOfHalt
  5378         forCount:countOrNil orTimeDuration:dTOrNil
  5407         forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
  5379 
  5408 
  5380     "Created: / 08-05-2011 / 10:20:31 / cg"
  5409     "Created: / 27-01-2012 / 11:31:12 / cg"
  5381 !
  5410 !
  5382 
  5411 
  5383 canAddBreakpoint
  5412 canAddBreakpoint
  5384     |m|
  5413     |m|
  5385 
  5414 
  5445      faster, since no resources have to be allocated in the display.
  5474      faster, since no resources have to be allocated in the display.
  5446      We have to be careful to release all refs to the debuggee, though.
  5475      We have to be careful to release all refs to the debuggee, though.
  5447      Otherwise, the GC will not be able to release it."
  5476      Otherwise, the GC will not be able to release it."
  5448 
  5477 
  5449     windowGroup notNil ifTrue:[
  5478     windowGroup notNil ifTrue:[
  5450 	windowGroup setProcess:nil.
  5479         windowGroup setProcess:nil.
  5451     ].
  5480     ].
  5452 
  5481 
  5453     self releaseDebuggee.
  5482     self releaseDebuggee.
  5454 
  5483 
  5455     cachable ~~ true ifTrue:[^ self].
  5484     cachable ~~ true ifTrue:[^ self].
  5456 
  5485 
  5457     "/
  5486     "/
  5458     "/ only cache if I am on the Display
  5487     "/ only cache if I am on the Display
  5459     "/
  5488     "/
  5460     device == Display ifTrue:[
  5489     device == Display ifTrue:[
  5461 	exclusive ifTrue:[
  5490         exclusive ifTrue:[
  5462 	    CachedExclusive := self
  5491             CachedExclusive := self
  5463 	] ifFalse:[
  5492         ] ifFalse:[
  5464 	    CachedDebugger := self
  5493             CachedDebugger := self
  5465 	].
  5494         ].
  5466     ].
  5495     ].
  5467 
  5496 
  5468     ObjectMemory stepInterruptHandler == self ifTrue:[
  5497     ObjectMemory stepInterruptHandler == self ifTrue:[
  5469 	ObjectMemory stepInterruptHandler:nil
  5498         ObjectMemory stepInterruptHandler:nil
  5470     ].
  5499     ].
  5471 
  5500 
  5472     "Modified: 10.7.1997 / 15:50:46 / stefan"
  5501     "Modified: 10.7.1997 / 15:50:46 / stefan"
  5473     "Modified: 31.7.1997 / 21:20:14 / cg"
  5502     "Modified: 31.7.1997 / 21:20:14 / cg"
  5474 !
  5503 !
  5475 
  5504 
  5476 isCached
  5505 isCached
  5477     "tell wether we are a cached debugger"
  5506     "tell wether we are a cached debugger"
  5478 
  5507 
  5479     CachedExclusive == self ifTrue:[
  5508     CachedExclusive == self ifTrue:[
  5480 	^ true.
  5509         ^ true.
  5481     ].
  5510     ].
  5482     CachedDebugger == self ifTrue:[
  5511     CachedDebugger == self ifTrue:[
  5483 	^ true.
  5512         ^ true.
  5484     ].
  5513     ].
  5485 
  5514 
  5486     ^ false.
  5515     ^ false.
  5487 
  5516 
  5488     "Created: 10.7.1997 / 15:22:43 / stefan"
  5517     "Created: 10.7.1997 / 15:22:43 / stefan"
  5518     "do not remember myself any longer for next debug session"
  5547     "do not remember myself any longer for next debug session"
  5519 
  5548 
  5520     cachable := false.
  5549     cachable := false.
  5521 
  5550 
  5522     CachedExclusive == self ifTrue:[
  5551     CachedExclusive == self ifTrue:[
  5523 	CachedExclusive := nil.
  5552         CachedExclusive := nil.
  5524     ].
  5553     ].
  5525     CachedDebugger == self ifTrue:[
  5554     CachedDebugger == self ifTrue:[
  5526 	CachedDebugger := nil.
  5555         CachedDebugger := nil.
  5527     ].
  5556     ].
  5528     OpenDebuggers notNil ifTrue:[
  5557     OpenDebuggers notNil ifTrue:[
  5529 	OpenDebuggers remove:self ifAbsent:[].
  5558         OpenDebuggers remove:self ifAbsent:[].
  5530     ].
  5559     ].
  5531 
  5560 
  5532     "Modified: 31.7.1997 / 21:20:11 / cg"
  5561     "Modified: 31.7.1997 / 21:20:11 / cg"
  5533 ! !
  5562 ! !
  5534 
  5563 
  5803 
  5832 
  5804     |con|
  5833     |con|
  5805 
  5834 
  5806     con := aContext.
  5835     con := aContext.
  5807     verboseBacktrace ifFalse:[
  5836     verboseBacktrace ifFalse:[
  5808 	(con notNil and:[con selector == #threadSwitch:]) ifTrue:[
  5837         (con notNil and:[con selector == #threadSwitch:]) ifTrue:[
  5809 	    con := con sender.
  5838             con := con sender.
  5810 	    (con notNil and:[con selector == #timerInterrupt]) ifTrue:[
  5839             (con notNil and:[con selector == #timerInterrupt]) ifTrue:[
  5811 		con := con sender.
  5840                 con := con sender.
  5812 	    ].
  5841             ].
  5813 	].
  5842         ].
  5814     ].
  5843     ].
  5815     ^ self setContext:con releaseInspectors:true
  5844     ^ self setContext:con releaseInspectors:true
  5816 
  5845 
  5817     "Created: / 20.10.1996 / 18:10:21 / cg"
  5846     "Created: / 20.10.1996 / 18:10:21 / cg"
  5818     "Modified: / 17.1.1998 / 12:43:19 / cg"
  5847     "Modified: / 17.1.1998 / 12:43:19 / cg"
  5834     mthd notNil ifTrue:[ mthdClass := mthd mclass ].
  5863     mthd notNil ifTrue:[ mthdClass := mthd mclass ].
  5835 
  5864 
  5836     "/ to avoid firing/waiting the lazy or future
  5865     "/ to avoid firing/waiting the lazy or future
  5837     recIsException := (rec isLazyValue not) and:[rec isException].
  5866     recIsException := (rec isLazyValue not) and:[rec isException].
  5838     aContext sender notNil ifTrue:[
  5867     aContext sender notNil ifTrue:[
  5839 	senderRec := aContext sender receiver
  5868         senderRec := aContext sender receiver
  5840     ].
  5869     ].
  5841 
  5870 
  5842     DebuggingDebugger == true ifTrue:[
  5871     DebuggingDebugger == true ifTrue:[
  5843 	'showingContext1: (' print. aContext print.
  5872         'showingContext1: (' print. aContext print.
  5844 	') calling: (' print. calledContext print.
  5873         ') calling: (' print. calledContext print.
  5845 	')' printCR.
  5874         ')' printCR.
  5846     ].
  5875     ].
  5847 
  5876 
  5848     (#(doCallHandler: doRaise
  5877     (#(doCallHandler: doRaise
  5849     ) includes:sel)
  5878     ) includes:sel)
  5850 	ifTrue:[
  5879         ifTrue:[
  5851 	    recIsException ifTrue:[ ^ false].
  5880             recIsException ifTrue:[ ^ false].
  5852 	].
  5881         ].
  5853 
  5882 
  5854     (#(raise raiseRequest
  5883     (#(raise raiseRequest
  5855     ) includes:sel)
  5884     ) includes:sel)
  5856 	ifTrue:[
  5885         ifTrue:[
  5857 	    recIsException ifTrue:[
  5886             recIsException ifTrue:[
  5858 		(senderRec isLazyValue not
  5887                 (senderRec isLazyValue not
  5859 		and:[ senderRec isExceptionCreator]) ifTrue:[^ false].
  5888                 and:[ senderRec isExceptionCreator]) ifTrue:[^ false].
  5860 	    ].
  5889             ].
  5861 	].
  5890         ].
  5862 
  5891 
  5863     (#(doWhile:
  5892     (#(doWhile:
  5864     ) includes:sel)
  5893     ) includes:sel)
  5865 	ifTrue:[
  5894         ifTrue:[
  5866 	    rec isBlock ifTrue:[
  5895             rec isBlock ifTrue:[
  5867 		true "aContext sender isBlockContext" ifTrue:[^ false].
  5896                 true "aContext sender isBlockContext" ifTrue:[^ false].
  5868 	    ].
  5897             ].
  5869 	].
  5898         ].
  5870 
  5899 
  5871     calledContext notNil ifTrue:[
  5900     calledContext notNil ifTrue:[
  5872 	calledSel := calledContext selector.
  5901         calledSel := calledContext selector.
  5873 	calledRec := calledContext receiver.
  5902         calledRec := calledContext receiver.
  5874 
  5903 
  5875 	calledRec isBlock ifTrue:[
  5904         calledRec isBlock ifTrue:[
  5876 	    (calledSel == #ensure:) ifTrue:[^ false].
  5905             (calledSel == #ensure:) ifTrue:[^ false].
  5877 	    (calledSel == #ifCurtailed:) ifTrue:[^ false].
  5906             (calledSel == #ifCurtailed:) ifTrue:[^ false].
  5878 	].
  5907         ].
  5879 	(calledSel == #handle:do:) ifTrue:[^ false].
  5908         (calledSel == #handle:do:) ifTrue:[^ false].
  5880 	(calledSel == #answer:do:) ifTrue:[^ false].
  5909         (calledSel == #answer:do:) ifTrue:[^ false].
  5881 
  5910 
  5882 "/        calledRec isLazyValue ifFalse:[
  5911 "/        calledRec isLazyValue ifFalse:[
  5883 "/            ((calledSel == #doWhile:)
  5912 "/            ((calledSel == #doWhile:)
  5884 "/            and:[calledRec isBlock])
  5913 "/            and:[calledRec isBlock])
  5885 "/                ifTrue:[^ false].
  5914 "/                ifTrue:[^ false].
  5894 "/                ifTrue:[^ false].
  5923 "/                ifTrue:[^ false].
  5895 "/        ].
  5924 "/        ].
  5896     ].
  5925     ].
  5897 
  5926 
  5898     (#(handleDo:) includes:sel)
  5927     (#(handleDo:) includes:sel)
  5899 	ifTrue:[
  5928         ifTrue:[
  5900 	    (calledRec isLazyValue not and:[calledRec isExceptionHandler]) ifTrue:[^ false].
  5929             (calledRec isLazyValue not and:[calledRec isExceptionHandler]) ifTrue:[^ false].
  5901 	].
  5930         ].
  5902     (#(
  5931     (#(
  5903 	withCursor:do:
  5932         withCursor:do:
  5904 	withWaitCursorDo:
  5933         withWaitCursorDo:
  5905       ) includes:sel)
  5934       ) includes:sel)
  5906 	ifTrue:[
  5935         ifTrue:[
  5907 	    (mthdClass == TopView) ifTrue:[^ false].
  5936             (mthdClass == TopView) ifTrue:[^ false].
  5908 	    (mthdClass == ApplicationModel) ifTrue:[^ false].
  5937             (mthdClass == ApplicationModel) ifTrue:[^ false].
  5909 	    (mthdClass == WindowGroup) ifTrue:[^ false].
  5938             (mthdClass == WindowGroup) ifTrue:[^ false].
  5910 	].
  5939         ].
  5911 
  5940 
  5912     (#(
  5941     (#(
  5913 	wait
  5942         wait
  5914 	waitWithTimeout:
  5943         waitWithTimeout:
  5915 	waitWithTimeoutMs:
  5944         waitWithTimeoutMs:
  5916       ) includes:sel)
  5945       ) includes:sel)
  5917 	ifTrue:[
  5946         ifTrue:[
  5918 	    (mthdClass == Semaphore) ifTrue:[^ false].
  5947             (mthdClass == Semaphore) ifTrue:[^ false].
  5919 	    (mthdClass == SemaphoreSet) ifTrue:[^ false].
  5948             (mthdClass == SemaphoreSet) ifTrue:[^ false].
  5920 	].
  5949         ].
  5921 
  5950 
  5922     ^ true
  5951     ^ true
  5923 
  5952 
  5924     "Created: / 17-11-2001 / 22:24:06 / cg"
  5953     "Created: / 17-11-2001 / 22:24:06 / cg"
  5925     "Modified: / 08-12-2010 / 18:21:02 / cg"
  5954     "Modified: / 08-12-2010 / 18:21:02 / cg"
  5941     sel := aContext selector.
  5970     sel := aContext selector.
  5942     mClass := aContext methodClass.
  5971     mClass := aContext methodClass.
  5943 
  5972 
  5944     sender := aContext sender.
  5973     sender := aContext sender.
  5945     sender notNil ifTrue:[
  5974     sender notNil ifTrue:[
  5946 	senderSelector := sender selector.
  5975         senderSelector := sender selector.
  5947 	senderReceiver := sender receiver.
  5976         senderReceiver := sender receiver.
  5948 	senderReceiverClass := senderReceiver class.
  5977         senderReceiverClass := senderReceiver class.
  5949     ].
  5978     ].
  5950 
  5979 
  5951     sel == #withCursor:do: ifTrue:[
  5980     sel == #withCursor:do: ifTrue:[
  5952 	(mClass == WindowGroup) ifTrue:[^ false].
  5981         (mClass == WindowGroup) ifTrue:[^ false].
  5953 	(mClass == TopView) ifTrue:[^ false].
  5982         (mClass == TopView) ifTrue:[^ false].
  5954     ].
  5983     ].
  5955     (sel == #withExecuteCursorDo:
  5984     (sel == #withExecuteCursorDo:
  5956     or:[sel == #withWaitCursorDo:]) ifTrue:[
  5985     or:[sel == #withWaitCursorDo:]) ifTrue:[
  5957 	(mClass == DisplaySurface) ifTrue:[^ false].
  5986         (mClass == DisplaySurface) ifTrue:[^ false].
  5958     ].
  5987     ].
  5959 
  5988 
  5960     (sel == #do:
  5989     (sel == #do:
  5961     or:[sel == #from:to:do:
  5990     or:[sel == #from:to:do:
  5962     or:[sel == #keysAndValuesDo:
  5991     or:[sel == #keysAndValuesDo:
  5963     or:[sel == #doWithIndex:]]]) ifTrue:[
  5992     or:[sel == #doWithIndex:]]]) ifTrue:[
  5964 	mClass == Array ifTrue:[^ false].
  5993         mClass == Array ifTrue:[^ false].
  5965 	mClass == OrderedCollection ifTrue:[^ false].
  5994         mClass == OrderedCollection ifTrue:[^ false].
  5966 	mClass == Set ifTrue:[^ false].
  5995         mClass == Set ifTrue:[^ false].
  5967 	mClass == Dictionary ifTrue:[^ false].
  5996         mClass == Dictionary ifTrue:[^ false].
  5968 	mClass == Interval ifTrue:[^ false].
  5997         mClass == Interval ifTrue:[^ false].
  5969     ].
  5998     ].
  5970     (sel == #perform:
  5999     (sel == #perform:
  5971     or:[sel == #perform:with:
  6000     or:[sel == #perform:with:
  5972     or:[sel == #perform:with:with:
  6001     or:[sel == #perform:with:with:
  5973     or:[sel == #perform:with:with:with:
  6002     or:[sel == #perform:with:with:with:
  5974     or:[sel == #perform:with:with:with:with:]]]])
  6003     or:[sel == #perform:with:with:with:with:]]]])
  5975     ifTrue:[
  6004     ifTrue:[
  5976 	nesting == 0 ifTrue:[^ true].
  6005         nesting == 0 ifTrue:[^ true].
  5977 	mClass == Array ifTrue:[^ false].
  6006         mClass == Array ifTrue:[^ false].
  5978 	mClass == OrderedCollection ifTrue:[^ false].
  6007         mClass == OrderedCollection ifTrue:[^ false].
  5979     ].
  6008     ].
  5980 
  6009 
  5981     sel == #valueWithReceiver:arguments:selector:search:sender: ifTrue:[^ false].
  6010     sel == #valueWithReceiver:arguments:selector:search:sender: ifTrue:[^ false].
  5982 
  6011 
  5983     (mClass == Object) ifTrue:[
  6012     (mClass == Object) ifTrue:[
  5984 	(sel startsWith:'perform:') ifTrue:[^ false]
  6013         (sel startsWith:'perform:') ifTrue:[^ false]
  5985     ].
  6014     ].
  5986 
  6015 
  5987     (mClass == Method) ifTrue:[
  6016     (mClass == Method) ifTrue:[
  5988 	(sel startsWith:'valueWithReceiver:') ifTrue:[^ false]
  6017         (sel startsWith:'valueWithReceiver:') ifTrue:[^ false]
  5989     ].
  6018     ].
  5990 
  6019 
  5991     (mClass == SmallInteger) ifTrue:[
  6020     (mClass == SmallInteger) ifTrue:[
  5992 	(sel == #to:do:) ifTrue:[^ false].
  6021         (sel == #to:do:) ifTrue:[^ false].
  5993 	(sel == #to:by:do:) ifTrue:[^ false].
  6022         (sel == #to:by:do:) ifTrue:[^ false].
  5994     ].
  6023     ].
  5995 
  6024 
  5996     (mClass == Block) ifTrue:[
  6025     (mClass == Block) ifTrue:[
  5997 	sel == #ensure: ifTrue:[^ false].
  6026         sel == #ensure: ifTrue:[^ false].
  5998 	sel == #ifCurtailed: ifTrue:[^ false].
  6027         sel == #ifCurtailed: ifTrue:[^ false].
  5999 	sel == #valueNowOrOnUnwindDo: ifTrue:[^ false].
  6028         sel == #valueNowOrOnUnwindDo: ifTrue:[^ false].
  6000 	sel == #valueOnUnwindDo: ifTrue:[^ false].
  6029         sel == #valueOnUnwindDo: ifTrue:[^ false].
  6001 	sel == #on:do: ifTrue:[^ false].
  6030         sel == #on:do: ifTrue:[^ false].
  6002 
  6031 
  6003 	sel == #value ifTrue:[^ false].
  6032         sel == #value ifTrue:[^ false].
  6004 	sel == #value: ifTrue:[^ false].
  6033         sel == #value: ifTrue:[^ false].
  6005 	sel == #value:value: ifTrue:[^ false].
  6034         sel == #value:value: ifTrue:[^ false].
  6006 	sel == #value:value:value: ifTrue:[^ false].
  6035         sel == #value:value:value: ifTrue:[^ false].
  6007 	sel == #value:value:value:value: ifTrue:[^ false].
  6036         sel == #value:value:value:value: ifTrue:[^ false].
  6008 	sel == #value:value:value:value:Value: ifTrue:[^ false].
  6037         sel == #value:value:value:value:Value: ifTrue:[^ false].
  6009 	sel == #value:value:value:value:value:value: ifTrue:[^ false].
  6038         sel == #value:value:value:value:value:value: ifTrue:[^ false].
  6010     ].
  6039     ].
  6011 
  6040 
  6012     aContext isBlockContext ifTrue:[
  6041     aContext isBlockContext ifTrue:[
  6013 "/        sel == #value ifTrue:[^ false].
  6042 "/        sel == #value ifTrue:[^ false].
  6014 "/        sel == #value: ifTrue:[^ false].
  6043 "/        sel == #value: ifTrue:[^ false].
  6022 "/            senderReceiverClass == QuerySignal ifTrue:[
  6051 "/            senderReceiverClass == QuerySignal ifTrue:[
  6023 "/                ^ false
  6052 "/                ^ false
  6024 "/            ]
  6053 "/            ]
  6025 "/        ]
  6054 "/        ]
  6026 
  6055 
  6027 	aContext home notNil ifTrue:[
  6056         aContext home notNil ifTrue:[
  6028 	    aContext home receiver isLazyValue ifFalse:[
  6057             aContext home receiver isLazyValue ifFalse:[
  6029 		(aContext home receiver isMemberOf:Semaphore) ifTrue:[
  6058                 (aContext home receiver isMemberOf:Semaphore) ifTrue:[
  6030 		    (aContext home selector == #wait) ifTrue:[^ false].
  6059                     (aContext home selector == #wait) ifTrue:[^ false].
  6031 		    (aContext home selector == #waitWithTimeoutMs:) ifTrue:[^ false].
  6060                     (aContext home selector == #waitWithTimeoutMs:) ifTrue:[^ false].
  6032 		]
  6061                 ]
  6033 	    ]
  6062             ]
  6034 	]
  6063         ]
  6035     ].
  6064     ].
  6036 
  6065 
  6037     (rec isExceptionHandler) ifTrue:[
  6066     (rec isExceptionHandler) ifTrue:[
  6038 	sel == #handle:do: ifTrue:[^ false].
  6067         sel == #handle:do: ifTrue:[^ false].
  6039 	sel == #handleDo: ifTrue:[^ false].
  6068         sel == #handleDo: ifTrue:[^ false].
  6040 	(sel startsWith:#raise) ifTrue:[^ false].
  6069         (sel startsWith:#raise) ifTrue:[^ false].
  6041 	sel == #answer:do: ifTrue:[^ false].
  6070         sel == #answer:do: ifTrue:[^ false].
  6042     ].
  6071     ].
  6043     (rec isLazyValue not and:[ rec isException] ) ifTrue:[
  6072     (rec isLazyValue not and:[ rec isException] ) ifTrue:[
  6044 	sel == #doRaise ifTrue:[^ false].
  6073         sel == #doRaise ifTrue:[^ false].
  6045 	sel == #doCallHandler: ifTrue:[^ false].
  6074         sel == #doCallHandler: ifTrue:[^ false].
  6046 	(sel == #raise or:[sel == #raiseRequest]) ifTrue:[
  6075         (sel == #raise or:[sel == #raiseRequest]) ifTrue:[
  6047 	    senderReceiverClass == Signal ifTrue:[^ false].
  6076             senderReceiverClass == Signal ifTrue:[^ false].
  6048 	]
  6077         ]
  6049     ].
  6078     ].
  6050     (mClass == Context) ifTrue:[
  6079     (mClass == Context) ifTrue:[
  6051 	sel == #unwind ifTrue:[^ false].
  6080         sel == #unwind ifTrue:[^ false].
  6052 	sel == #unwind: ifTrue:[^ false].
  6081         sel == #unwind: ifTrue:[^ false].
  6053     ].
  6082     ].
  6054     (mClass == ProcessorScheduler) ifTrue:[
  6083     (mClass == ProcessorScheduler) ifTrue:[
  6055 	sel == #interruptActive ifTrue:[^ false].
  6084         sel == #interruptActive ifTrue:[^ false].
  6056 	sel == #threadSwitch: ifTrue:[^ false].
  6085         sel == #threadSwitch: ifTrue:[^ false].
  6057 	sel == #suspend: ifTrue:[^ false].
  6086         sel == #suspend: ifTrue:[^ false].
  6058     ].
  6087     ].
  6059     mClass == Process ifTrue:[
  6088     mClass == Process ifTrue:[
  6060 	sel == #suspendWithState: ifTrue:[^ false].
  6089         sel == #suspendWithState: ifTrue:[^ false].
  6061     ].
  6090     ].
  6062     ^ true.
  6091     ^ true.
  6063 
  6092 
  6064     "Created: / 17-11-2001 / 19:34:20 / cg"
  6093     "Created: / 17-11-2001 / 19:34:20 / cg"
  6065     "Modified: / 08-12-2010 / 18:21:45 / cg"
  6094     "Modified: / 08-12-2010 / 18:21:45 / cg"
  6067 
  6096 
  6068 !DebugView methodsFor:'private-control loop'!
  6097 !DebugView methodsFor:'private-control loop'!
  6069 
  6098 
  6070 controlLoop
  6099 controlLoop
  6071     "this is a kludge:
  6100     "this is a kludge:
  6072 	start a dispatchloop which exits when
  6101         start a dispatchloop which exits when
  6073 	either continue, return or step is pressed
  6102         either continue, return or step is pressed
  6074     "
  6103     "
  6075 
  6104 
  6076     haveControl := true.
  6105     haveControl := true.
  6077     [
  6106     [
  6078 	[haveControl] whileTrue:[
  6107         [haveControl] whileTrue:[
  6079 	    self controlLoopCatchingErrors
  6108             self controlLoopCatchingErrors
  6080 	].
  6109         ].
  6081     ] ensure:[
  6110     ] ensure:[
  6082 	catchBlock := nil.
  6111         catchBlock := nil.
  6083 	haveControl := false
  6112         haveControl := false
  6084     ].
  6113     ].
  6085 
  6114 
  6086     "Modified: 9.7.1996 / 18:29:09 / cg"
  6115     "Modified: 9.7.1996 / 18:29:09 / cg"
  6087 !
  6116 !
  6088 
  6117 
  6092 
  6121 
  6093     "setup a self removing catch-block"
  6122     "setup a self removing catch-block"
  6094     catchBlock := [catchBlock := nil. ^ nil].
  6123     catchBlock := [catchBlock := nil. ^ nil].
  6095 
  6124 
  6096     (exclusive or:[windowGroup isNil]) ifTrue:[
  6125     (exclusive or:[windowGroup isNil]) ifTrue:[
  6097 	"if we do not have multiple processes or its a system process
  6126         "if we do not have multiple processes or its a system process
  6098 	 we start another dispatch loop, which exits when
  6127          we start another dispatch loop, which exits when
  6099 	 either continue, return or step is pressed
  6128          either continue, return or step is pressed
  6100 	 or (via the catchBlock) if an error occurs.
  6129          or (via the catchBlock) if an error occurs.
  6101 	 Since our display is an extra exclusive one,
  6130          Since our display is an extra exclusive one,
  6102 	 all processing for normal views stops here ...
  6131          all processing for normal views stops here ...
  6103 	"
  6132         "
  6104 
  6133 
  6105 	WindowGroup setActiveGroup:windowGroup.
  6134         WindowGroup setActiveGroup:windowGroup.
  6106 	SignalSet anySignal handle:[:ex |
  6135         SignalSet anySignal handle:[:ex |
  6107 	    |signal|
  6136             |signal|
  6108 
  6137 
  6109 	    signal := ex signal.
  6138             signal := ex signal.
  6110 
  6139 
  6111 	    self showError:'*** Error in modal debugger:
  6140             self showError:'*** Error in modal debugger:
  6112 
  6141 
  6113 >>>> Signal:  ' , signal printString , '
  6142 >>>> Signal:  ' , signal printString , '
  6114 >>>> In:      ' , ex suspendedContext printString , '
  6143 >>>> In:      ' , ex suspendedContext printString , '
  6115 >>>> From:    ' , ex suspendedContext sender printString , '
  6144 >>>> From:    ' , ex suspendedContext sender printString , '
  6116 >>>>     :    ' , ex suspendedContext sender sender printString , '
  6145 >>>>     :    ' , ex suspendedContext sender sender printString , '
  6127 >>>>     :    ' , ex suspendedContext sender sender sender sender sender sender sender sender sender sender sender sender sender printString , '
  6156 >>>>     :    ' , ex suspendedContext sender sender sender sender sender sender sender sender sender sender sender sender sender printString , '
  6128 >>>>     :    ' , ex suspendedContext sender sender sender sender sender sender sender sender sender sender sender sender sender sender printString , '
  6157 >>>>     :    ' , ex suspendedContext sender sender sender sender sender sender sender sender sender sender sender sender sender sender printString , '
  6129 >>>> Message: ' , ex description , '
  6158 >>>> Message: ' , ex description , '
  6130 
  6159 
  6131 caught & ignored.'.
  6160 caught & ignored.'.
  6132 	    ex return.
  6161             ex return.
  6133 	] do:[
  6162         ] do:[
  6134 	    UserNotification handle:[:ex |
  6163             UserNotification handle:[:ex |
  6135 		(ex signal == ActivityNotificationSignal) ifTrue:[
  6164                 (ex signal == ActivityNotificationSignal) ifTrue:[
  6136 		    ex proceed
  6165                     ex proceed
  6137 		].
  6166                 ].
  6138 		self showError:ex description.
  6167                 self showError:ex description.
  6139 		ex proceed.
  6168                 ex proceed.
  6140 	    ] do:[
  6169             ] do:[
  6141 		device dispatchModalWhile:[Processor activeProcess state:#debug.
  6170                 device dispatchModalWhile:[Processor activeProcess state:#debug.
  6142 					   haveControl].
  6171                                            haveControl].
  6143 	    ]
  6172             ]
  6144 	].
  6173         ].
  6145 	WindowGroup setActiveGroup:nil.
  6174         WindowGroup setActiveGroup:nil.
  6146     ] ifFalse:[
  6175     ] ifFalse:[
  6147 	"we do have multiple processes -
  6176         "we do have multiple processes -
  6148 	 simply enter the DebugViews-Windowgroup event loop.
  6177          simply enter the DebugViews-Windowgroup event loop.
  6149 	 effectively suspending event processing for the currently
  6178          effectively suspending event processing for the currently
  6150 	 active group.
  6179          active group.
  6151 	"
  6180         "
  6152 	SignalSet anySignal handle:[:ex |
  6181         SignalSet anySignal handle:[:ex |
  6153 	    |answer signal eMsg|
  6182             |answer signal eMsg|
  6154 
  6183 
  6155 	    signal := ex signal.
  6184             signal := ex signal.
  6156 
  6185 
  6157 	    DebuggingDebugger ~~ true ifTrue:[
  6186             DebuggingDebugger ~~ true ifTrue:[
  6158 		(signal == ActivityNotification) ifTrue:[
  6187                 (signal == ActivityNotification) ifTrue:[
  6159 		    ex proceed
  6188                     ex proceed
  6160 		].
  6189                 ].
  6161 		"/
  6190                 "/
  6162 		"/ ignore exceptions which say they explicitly have to be ignored
  6191                 "/ ignore exceptions which say they explicitly have to be ignored
  6163 		"/
  6192                 "/
  6164 		ex catchInDebugger ifTrue:[
  6193                 ex catchInDebugger ifTrue:[
  6165 		    'DebugView [info]: ',signal printString,'-signal in debugger cought for close' infoPrintCR.
  6194                     'DebugView [info]: ',signal printString,'-signal in debugger cought for close' infoPrintCR.
  6166 		    self destroy.
  6195                     self destroy.
  6167 		    ex reject
  6196                     ex reject
  6168 		].
  6197                 ].
  6169 
  6198 
  6170 		"/
  6199                 "/
  6171 		"/ ignore recursive breakpoints
  6200                 "/ ignore recursive breakpoints
  6172 		"/
  6201                 "/
  6173 		(signal isControlInterrupt) ifTrue:[
  6202                 (signal isControlInterrupt) ifTrue:[
  6174 		    ignoreBreakpoints == true ifTrue:[
  6203                     ignoreBreakpoints == true ifTrue:[
  6175 			'DebugView [info]: halt/break in debugger ignored 1' infoPrintCR.
  6204                         'DebugView [info]: halt/break in debugger ignored 1' infoPrintCR.
  6176 			('DebugView [info]: ',ex suspendedContext printString) infoPrintCR.
  6205                         ('DebugView [info]: ',ex suspendedContext printString) infoPrintCR.
  6177 			ex proceed
  6206                         ex proceed
  6178 		    ].
  6207                     ].
  6179 		].
  6208                 ].
  6180 		(signal == TerminateProcessRequest) ifTrue:[
  6209                 (signal == TerminateProcessRequest) ifTrue:[
  6181 		    "/ mhm - someone wants to shoot me down while debugging ...
  6210                     "/ mhm - someone wants to shoot me down while debugging ...
  6182 		    answer := Dialog
  6211                     answer := Dialog
  6183 				choose:('Process termination signal arrived while debugging\\close debugger ?') withCRs
  6212                                 choose:('Process termination signal arrived while debugging\\close debugger ?') withCRs
  6184 				labels:#( 'Ignore' 'Close & terminate' )
  6213                                 labels:#( 'Ignore' 'Close & terminate' )
  6185 				values:#( #proceed #close )
  6214                                 values:#( #proceed #close )
  6186 				default:#close.
  6215                                 default:#close.
  6187 		    answer == #close ifTrue:[
  6216                     answer == #close ifTrue:[
  6188 			self destroy.
  6217                         self destroy.
  6189 			ex reject
  6218                         ex reject
  6190 		    ].
  6219                     ].
  6191 		    ex return.
  6220                     ex return.
  6192 		].
  6221                 ].
  6193 		signal == RecursiveExceptionError ifTrue:[
  6222                 signal == RecursiveExceptionError ifTrue:[
  6194 		    (ex parameter signal == BreakPointInterrupt)
  6223                     (ex parameter signal == BreakPointInterrupt)
  6195 		    ifTrue:[
  6224                     ifTrue:[
  6196 			'DebugView [info]: recursive breakpoint in debugger ignored' infoPrintCR.
  6225                         'DebugView [info]: recursive breakpoint in debugger ignored' infoPrintCR.
  6197 			ex proceed.
  6226                         ex proceed.
  6198 		    ].
  6227                     ].
  6199 
  6228 
  6200 		    self showError:'*** Recursive error in debugger:
  6229                     self showError:'*** Recursive error in debugger:
  6201 
  6230 
  6202 >>>> Signal:  ' , ex signal printString , '
  6231 >>>> Signal:  ' , ex signal printString , '
  6203 >>>>          ' , ex parameter signal printString , '
  6232 >>>>          ' , ex parameter signal printString , '
  6204 >>>> In:      ' , ex suspendedContext printString , '
  6233 >>>> In:      ' , ex suspendedContext printString , '
  6205 >>>> From:    ' , ex suspendedContext sender printString , '
  6234 >>>> From:    ' , ex suspendedContext sender printString , '
  6207 >>>>     :    ' , ex suspendedContext sender sender sender printString , '
  6236 >>>>     :    ' , ex suspendedContext sender sender sender printString , '
  6208 >>>>     :    ' , ex suspendedContext sender sender sender sender printString , '
  6237 >>>>     :    ' , ex suspendedContext sender sender sender sender printString , '
  6209 >>>> Message: ' , ex description , '
  6238 >>>> Message: ' , ex description , '
  6210 
  6239 
  6211 caught & ignored.'.
  6240 caught & ignored.'.
  6212 		    ex return
  6241                     ex return
  6213 		].
  6242                 ].
  6214 	    ].
  6243             ].
  6215 
  6244 
  6216 	    self topView raiseDeiconified.
  6245             self topView raiseDeiconified.
  6217 
  6246 
  6218 	    eMsg := ex description.
  6247             eMsg := ex description.
  6219 	    (ex signal isControlInterrupt) ifTrue:[
  6248             (ex signal isControlInterrupt) ifTrue:[
  6220 		eMsg := eMsg , Character cr asString , 'in ' , ex suspendedContext printString
  6249                 eMsg := eMsg , Character cr asString , 'in ' , ex suspendedContext printString
  6221 	    ].
  6250             ].
  6222 	    Dialog aboutToOpenBoxNotificationSignal
  6251             Dialog aboutToOpenBoxNotificationSignal
  6223 		handle:[:ex | ex proceed ]
  6252                 handle:[:ex | ex proceed ]
  6224 		do:[
  6253                 do:[
  6225 		    answer := Dialog
  6254                     answer := Dialog
  6226 			choose:('Error in debugger:\' withCRs , eMsg , '\\debug again ?' withCRs)
  6255                         choose:('Error in debugger:\' withCRs , eMsg , '\\debug again ?' withCRs)
  6227 			labels:#( 'Proceed' 'Cancel' 'Debug' )
  6256                         labels:#( 'Proceed' 'Cancel' 'Debug' )
  6228 			values:#( #proceed #cancel #debug )
  6257                         values:#( #proceed #cancel #debug )
  6229 			default:#cancel.
  6258                         default:#cancel.
  6230 		].
  6259                 ].
  6231 	    answer == #debug ifTrue:[
  6260             answer == #debug ifTrue:[
  6232 		'DebugView [info]: cought exception - debugging' infoPrintCR.
  6261                 'DebugView [info]: cought exception - debugging' infoPrintCR.
  6233 		Debugger
  6262                 Debugger
  6234 		    enterUnconditional:(ex suspendedContext)
  6263                     enterUnconditional:(ex suspendedContext)
  6235 		    withMessage:'Error in debugger: ' , eMsg
  6264                     withMessage:'Error in debugger: ' , eMsg
  6236 		    mayProceed:true.
  6265                     mayProceed:true.
  6237 		ex proceed.
  6266                 ex proceed.
  6238 	    ].
  6267             ].
  6239 	    answer == #proceed ifTrue:[
  6268             answer == #proceed ifTrue:[
  6240 		'DebugView [info]: ignored exception - proceeding' infoPrintCR.
  6269                 'DebugView [info]: ignored exception - proceeding' infoPrintCR.
  6241 		ex proceed.
  6270                 ex proceed.
  6242 	    ].
  6271             ].
  6243 	    'DebugView [info]: cought exception - returning' infoPrintCR.
  6272             'DebugView [info]: cought exception - returning' infoPrintCR.
  6244 	    ex return.
  6273             ex return.
  6245 	] do:[
  6274         ] do:[
  6246 	    "/ make certain that sub-debuggers, inspectors etc.
  6275             "/ make certain that sub-debuggers, inspectors etc.
  6247 	    "/ come up on my device.
  6276             "/ come up on my device.
  6248 	    Screen currentScreenQuerySignal answer:device
  6277             Screen currentScreenQuerySignal answer:device
  6249 	    do:[
  6278             do:[
  6250 		windowGroup
  6279                 windowGroup
  6251 		    eventLoopWhile:[Processor activeProcess state:#debug.
  6280                     eventLoopWhile:[Processor activeProcess state:#debug.
  6252 				      true]
  6281                                       true]
  6253 		    onLeave:[]
  6282                     onLeave:[]
  6254 	    ]
  6283             ]
  6255 	].
  6284         ].
  6256     ].
  6285     ].
  6257     catchBlock := nil.
  6286     catchBlock := nil.
  6258 
  6287 
  6259     "Created: / 24.11.1995 / 20:33:45 / cg"
  6288     "Created: / 24.11.1995 / 20:33:45 / cg"
  6260     "Modified: / 18.11.2001 / 01:04:17 / cg"
  6289     "Modified: / 18.11.2001 / 01:04:17 / cg"
  6266     |source|
  6295     |source|
  6267 
  6296 
  6268     codeView modified ifFalse:[^ false].
  6297     codeView modified ifFalse:[^ false].
  6269 
  6298 
  6270     currentMethod isNil ifTrue:[
  6299     currentMethod isNil ifTrue:[
  6271 	^ false
  6300         ^ false
  6272     ].
  6301     ].
  6273     source := currentMethod source.
  6302     source := currentMethod source.
  6274     source notNil ifTrue:[
  6303     source notNil ifTrue:[
  6275 	source string = codeView contents string ifTrue:[
  6304         source string = codeView contents string ifTrue:[
  6276 	    ^ false
  6305             ^ false
  6277 	].
  6306         ].
  6278 	(source string withTabsExpanded:8) = (codeView contents string withTabsExpanded:8) ifTrue:[
  6307         (source string withTabsExpanded:8) = (codeView contents string withTabsExpanded:8) ifTrue:[
  6279 	    ^ false
  6308             ^ false
  6280 	].
  6309         ].
  6281     ].
  6310     ].
  6282     ^ true
  6311     ^ true
  6283 !
  6312 !
  6284 
  6313 
  6285 checkSelectionChangeAllowed
  6314 checkSelectionChangeAllowed
  6289 checkSelectionChangeAllowed:newSelection
  6318 checkSelectionChangeAllowed:newSelection
  6290     self checkIfCodeIsReallyModified ifFalse:[^ true].
  6319     self checkIfCodeIsReallyModified ifFalse:[^ true].
  6291 
  6320 
  6292     (newSelection notNil
  6321     (newSelection notNil
  6293     and:[newSelection = contextView selection]) ifTrue:[
  6322     and:[newSelection = contextView selection]) ifTrue:[
  6294 	^ true
  6323         ^ true
  6295     ].
  6324     ].
  6296 
  6325 
  6297     (self confirm:('Code modified - change selection anyway ?')) ifFalse:[
  6326     (self confirm:('Code modified - change selection anyway ?')) ifFalse:[
  6298 	^ false
  6327         ^ false
  6299     ].
  6328     ].
  6300     codeView modified:false.
  6329     codeView modified:false.
  6301 
  6330 
  6302     ^ true
  6331     ^ true
  6303 !
  6332 !
  6326      or - if its a block-context - whose home is the selected context"
  6355      or - if its a block-context - whose home is the selected context"
  6327 
  6356 
  6328     |con top newMethod|
  6357     |con top newMethod|
  6329 
  6358 
  6330     codeView withWaitCursorDo:[
  6359     codeView withWaitCursorDo:[
  6331 	"
  6360         "
  6332 	 find the method-home context for this one
  6361          find the method-home context for this one
  6333 	"
  6362         "
  6334 	doUnwind ifTrue:[
  6363         doUnwind ifTrue:[
  6335 	    con := selectedContext.
  6364             con := selectedContext.
  6336 	    top := con.
  6365             top := con.
  6337 	    [con notNil] whileTrue:[
  6366             [con notNil] whileTrue:[
  6338 		(con methodHome == selectedContext) ifTrue:[
  6367                 (con methodHome == selectedContext) ifTrue:[
  6339 		    top := con
  6368                     top := con
  6340 		].
  6369                 ].
  6341 		con := con sender
  6370                 con := con sender
  6342 	    ].
  6371             ].
  6343 	].
  6372         ].
  6344 
  6373 
  6345 	"/
  6374         "/
  6346 	"/ provide the classes nameSpace on a query;
  6375         "/ provide the classes nameSpace on a query;
  6347 	"/ in case we accept while in another nameSpace context,
  6376         "/ in case we accept while in another nameSpace context,
  6348 	"/ (but for a class which is somewhere else)
  6377         "/ (but for a class which is somewhere else)
  6349 	"/
  6378         "/
  6350 	(Class updateChangeFileQuerySignal,
  6379         (Class updateChangeFileQuerySignal,
  6351 	 Class updateChangeListQuerySignal,
  6380          Class updateChangeListQuerySignal,
  6352 	 Class updateHistoryLineQuerySignal) answer:true
  6381          Class updateHistoryLineQuerySignal) answer:true
  6353 	do:[
  6382         do:[
  6354 	    Class nameSpaceQuerySignal
  6383             Class nameSpaceQuerySignal
  6355 	    answer:(aClass nameSpace)
  6384             answer:(aClass nameSpace)
  6356 	    do:[
  6385             do:[
  6357 		Class packageQuerySignal
  6386                 Class packageQuerySignal
  6358 		answer:(aClass package ? PackageId noProjectID)
  6387                 answer:(aClass package ? PackageId noProjectID)
  6359 		do:[
  6388                 do:[
  6360 		    codeView contents:someCode.
  6389                     codeView contents:someCode.
  6361 		    newMethod := aClass compilerClass
  6390                     newMethod := aClass compilerClass
  6362 				     compile:someCode
  6391                                      compile:someCode
  6363 				     forClass:aClass
  6392                                      forClass:aClass
  6364 				     inCategory:category
  6393                                      inCategory:category
  6365 				     notifying:codeView.
  6394                                      notifying:codeView.
  6366 		].
  6395                 ].
  6367 	    ].
  6396             ].
  6368 	].
  6397         ].
  6369 
  6398 
  6370 	inspecting ifFalse:[
  6399         inspecting ifFalse:[
  6371 	    "
  6400             "
  6372 	     if it worked, remove everything up to and including top
  6401              if it worked, remove everything up to and including top
  6373 	     from context chain
  6402              from context chain
  6374 	    "
  6403             "
  6375 	    (newMethod notNil and:[newMethod ~~ #Error]) ifTrue:[
  6404             (newMethod notNil and:[newMethod ~~ #Error]) ifTrue:[
  6376 		codeView modified:false.
  6405                 codeView modified:false.
  6377 
  6406 
  6378 		doUnwind ifTrue:[
  6407                 doUnwind ifTrue:[
  6379 		    selectedContext canReturn ifTrue:[
  6408                     selectedContext canReturn ifTrue:[
  6380 			self setContext:(top "sender").
  6409                         self setContext:(top "sender").
  6381 			exitAction := #restart.
  6410                         exitAction := #restart.
  6382 			selectedContext setLineNumber:1.
  6411                         selectedContext setLineNumber:1.
  6383 			self doRestart.
  6412                         self doRestart.
  6384 		    ] ifFalse:[
  6413                     ] ifFalse:[
  6385 			self setContext:(top sender).
  6414                         self setContext:(top sender).
  6386 			exitAction := #return.
  6415                         exitAction := #return.
  6387 		    ].
  6416                     ].
  6388 
  6417 
  6389 		    "
  6418                     "
  6390 		     continue/step is no longer possible
  6419                      continue/step is no longer possible
  6391 		    "
  6420                     "
  6392 		    "/ continueButton disable.
  6421                     "/ continueButton disable.
  6393 		    "/ canContinue := false.
  6422                     "/ canContinue := false.
  6394 		].
  6423                 ].
  6395 
  6424 
  6396 		contextView selection:1.
  6425                 contextView selection:1.
  6397 		"/ self showSelection:1.
  6426                 "/ self showSelection:1.
  6398 		"/ contextView makeSelectionVisible. "/ scrollToLine:(selection - 1)
  6427                 "/ contextView makeSelectionVisible. "/ scrollToLine:(selection - 1)
  6399 	    ] ifFalse:[
  6428             ] ifFalse:[
  6400 		^ cancelAction value
  6429                 ^ cancelAction value
  6401 	    ]
  6430             ]
  6402 	].
  6431         ].
  6403     ].
  6432     ].
  6404 
  6433 
  6405     "Created: / 17-11-2001 / 21:50:55 / cg"
  6434     "Created: / 17-11-2001 / 21:50:55 / cg"
  6406     "Modified: / 29-08-2006 / 14:22:22 / cg"
  6435     "Modified: / 29-08-2006 / 14:22:22 / cg"
  6407 !
  6436 !
  6487 
  6516 
  6488     cls := currentMethod mclass.
  6517     cls := currentMethod mclass.
  6489     cls isNil ifTrue:[ ^ self ].
  6518     cls isNil ifTrue:[ ^ self ].
  6490 
  6519 
  6491     UserInformation handle:[:ex |
  6520     UserInformation handle:[:ex |
  6492 	ex proceed.
  6521         ex proceed.
  6493     ] do:[
  6522     ] do:[
  6494 	DoWhatIMeanSupport codeCompletionForClass:cls context:selectedContext codeView:codeView.
  6523         DoWhatIMeanSupport codeCompletionForClass:cls context:selectedContext codeView:codeView.
  6495     ].
  6524     ].
  6496 !
  6525 !
  6497 
  6526 
  6498 confirm:aString
  6527 confirm:aString
  6499     "open a modal yes-no dialog.
  6528     "open a modal yes-no dialog.
  6500      Redefined here, to answer true, if exclusice Debugger, which cannot handle popup boxes"
  6529      Redefined here, to answer true, if exclusice Debugger, which cannot handle popup boxes"
  6501 
  6530 
  6502     (exclusive or:[windowGroup isNil]) ifTrue:[
  6531     (exclusive or:[windowGroup isNil]) ifTrue:[
  6503 	^ true
  6532         ^ true
  6504     ].
  6533     ].
  6505     ^ super confirm:aString.
  6534     ^ super confirm:aString.
  6506 !
  6535 !
  6507 
  6536 
  6508 doShowSelection:lineNr
  6537 doShowSelection:lineNr
  6509     "user clicked on a header line - show selected code in textView.
  6538     "user clicked on a header line - show selected code in textView.
  6510      Also sent to autoselect an interesting context on entry."
  6539      Also sent to autoselect an interesting context on entry."
  6511 
  6540 
  6512     HaltInterrupt handle:[:ex |
  6541     HaltInterrupt handle:[:ex |
  6513 	ignoreBreakpoints ifFalse:[ex reject].
  6542         ignoreBreakpoints ifFalse:[ex reject].
  6514 	('DebugView [info]: halt/breakpoint in debugger at %1 ignored [doShowSelection.]' bindWith:ex suspendedContext) infoPrintCR.
  6543         ('DebugView [info]: halt/breakpoint in debugger at %1 ignored [doShowSelection.]' bindWith:ex suspendedContext) infoPrintCR.
  6515 	ex proceed
  6544         ex proceed
  6516     ] do:[
  6545     ] do:[
  6517 	self updateForContext:lineNr
  6546         self updateForContext:lineNr
  6518     ].
  6547     ].
  6519     self updateMenuItems
  6548     self updateMenuItems
  6520 
  6549 
  6521     "Modified: / 17.11.2001 / 22:12:16 / cg"
  6550     "Modified: / 17.11.2001 / 22:12:16 / cg"
  6522 !
  6551 !
  6523 
  6552 
  6524 hideStackInspector
  6553 hideStackInspector
  6525     stackInspector notNil ifTrue:[
  6554     stackInspector notNil ifTrue:[
  6526 	stackInspector destroy.
  6555         stackInspector destroy.
  6527 	stackInspector := nil.
  6556         stackInspector := nil.
  6528 	receiverInspector origin:(0.0 @ 0.0) corner:0.5 @ 1.0.
  6557         receiverInspector origin:(0.0 @ 0.0) corner:0.5 @ 1.0.
  6529 	contextInspector origin:(0.5 @ 0.0) corner:(1.0 @ 1.0)
  6558         contextInspector origin:(0.5 @ 0.0) corner:(1.0 @ 1.0)
  6530     ]
  6559     ]
  6531 !
  6560 !
  6532 
  6561 
  6533 methodCodeToggleChanged
  6562 methodCodeToggleChanged
  6534     |sel|
  6563     |sel|
  6535 
  6564 
  6536     sel := contextView selection.
  6565     sel := contextView selection.
  6537     sel notNil ifTrue:[
  6566     sel notNil ifTrue:[
  6538 	self showSelection:sel
  6567         self showSelection:sel
  6539     ]
  6568     ]
  6540 
  6569 
  6541     "Created: / 18-06-2010 / 12:29:21 / cg"
  6570     "Created: / 18-06-2010 / 12:29:21 / cg"
  6542 !
  6571 !
  6543 
  6572 
  6547 
  6576 
  6548     |evView focusView key rawKey inCodeView|
  6577     |evView focusView key rawKey inCodeView|
  6549 
  6578 
  6550     evView := anEvent view.
  6579     evView := anEvent view.
  6551     evView notNil ifTrue:[
  6580     evView notNil ifTrue:[
  6552 	focusView := evView windowGroup focusView.
  6581         focusView := evView windowGroup focusView.
  6553 	focusView isNil ifTrue:[
  6582         focusView isNil ifTrue:[
  6554 	    focusView := evView.
  6583             focusView := evView.
  6555 	].
  6584         ].
  6556 
  6585 
  6557 	anEvent isKeyPressEvent ifTrue:[
  6586         anEvent isKeyPressEvent ifTrue:[
  6558 	    key := anEvent key.
  6587             key := anEvent key.
  6559 	    rawKey := anEvent rawKey.
  6588             rawKey := anEvent rawKey.
  6560 
  6589 
  6561 	    inCodeView := (focusView == codeView
  6590             inCodeView := (focusView == codeView
  6562 			  or:[focusView isComponentOf:codeView]).
  6591                           or:[focusView isComponentOf:codeView]).
  6563 	    inCodeView ifTrue:[
  6592             inCodeView ifTrue:[
  6564 		key == #CodeCompletion ifTrue:[
  6593                 key == #CodeCompletion ifTrue:[
  6565 		    "/ complete the word before/under the cursor.
  6594                     "/ complete the word before/under the cursor.
  6566 		    self sensor
  6595                     self sensor
  6567 			pushUserEvent:#codeCompletion
  6596                         pushUserEvent:#codeCompletion
  6568 			for:self
  6597                         for:self
  6569 			withArguments:#().
  6598                         withArguments:#().
  6570 		    ^ true
  6599                     ^ true
  6571 		].
  6600                 ].
  6572 	    ].
  6601             ].
  6573 	].
  6602         ].
  6574 
  6603 
  6575 false ifTrue:[
  6604 false ifTrue:[
  6576 	anEvent isButtonReleaseEvent ifTrue:[
  6605         anEvent isButtonReleaseEvent ifTrue:[
  6577 	    anEvent view == codeView ifTrue:[
  6606             anEvent view == codeView ifTrue:[
  6578 		(RBParser notNil and:[RBParser isLoaded])
  6607                 (RBParser notNil and:[RBParser isLoaded])
  6579 		ifTrue:[
  6608                 ifTrue:[
  6580 		    self sensor
  6609                     self sensor
  6581 			pushEvent:anEvent.  "/ must be first in queue
  6610                         pushEvent:anEvent.  "/ must be first in queue
  6582 
  6611 
  6583 		    self sensor
  6612                     self sensor
  6584 		      pushUserEvent:#explainSelection
  6613                       pushUserEvent:#explainSelection
  6585 		      for:self
  6614                       for:self
  6586 		      withArguments:nil.
  6615                       withArguments:nil.
  6587 		    ^ true  "/ eaten
  6616                     ^ true  "/ eaten
  6588 		]
  6617                 ]
  6589 	    ]
  6618             ]
  6590 	].
  6619         ].
  6591 ].
  6620 ].
  6592 
  6621 
  6593     ].
  6622     ].
  6594     ^ false
  6623     ^ false
  6595 !
  6624 !
  6601 showSelection:lineNr
  6630 showSelection:lineNr
  6602     "user clicked on a header line - show selected code in textView.
  6631     "user clicked on a header line - show selected code in textView.
  6603      Also sent to autoselect an interesting context on entry."
  6632      Also sent to autoselect an interesting context on entry."
  6604 
  6633 
  6605     Notification
  6634     Notification
  6606 	handle:
  6635         handle:
  6607 	    [:ex |
  6636             [:ex |
  6608 		"/ ex suspendedContext fullPrintAll.
  6637                 "/ ex suspendedContext fullPrintAll.
  6609 		Transcript showCR:ex description.
  6638                 Transcript showCR:ex description.
  6610 		"/ Transcript showCR:ex parameter.
  6639                 "/ Transcript showCR:ex parameter.
  6611 		ex proceed
  6640                 ex proceed
  6612 	    ]
  6641             ]
  6613 	do:
  6642         do:
  6614 	    [
  6643             [
  6615 		Error
  6644                 Error
  6616 		    handle:
  6645                     handle:
  6617 			[:ex |
  6646                         [:ex |
  6618 			    |s con|
  6647                             |s con|
  6619 
  6648 
  6620 			    ex signal isControlInterrupt
  6649                             ex signal isControlInterrupt
  6621 				ifTrue:[
  6650                                 ifTrue:[
  6622 				    'DebugView [info]: halt/break ignored - while showing selection in debugger' infoPrintCR.
  6651                                     'DebugView [info]: halt/break ignored - while showing selection in debugger' infoPrintCR.
  6623 				    ex proceed
  6652                                     ex proceed
  6624 				].
  6653                                 ].
  6625 
  6654 
  6626 			    ('DebugView [info]: error at %1 when showing selection in debugger ignored' bindWith:ex suspendedContext) infoPrintCR.
  6655                             ('DebugView [info]: error at %1 when showing selection in debugger ignored' bindWith:ex suspendedContext) infoPrintCR.
  6627 
  6656 
  6628 			    s := '' writeStream.
  6657                             s := '' writeStream.
  6629 			    s nextPutLine:'**** error in debugger, while extracting source'.
  6658                             s nextPutLine:'**** error in debugger, while extracting source'.
  6630 			    s nextPutLine:'****'.
  6659                             s nextPutLine:'****'.
  6631 			    s nextPutAll: '**** '; nextPutLine:(ex description "withCRs").
  6660                             s nextPutAll: '**** '; nextPutLine:(ex description "withCRs").
  6632 			    s nextPutLine:'****'.
  6661                             s nextPutLine:'****'.
  6633 			    con := ex suspendedContext.
  6662                             con := ex suspendedContext.
  6634 			    s nextPutAll: '**** '; nextPutLine:(con printString).
  6663                             s nextPutAll: '**** '; nextPutLine:(con printString).
  6635 			    con := con sender.
  6664                             con := con sender.
  6636 			    HaltInterrupt ignoreIn:[
  6665                             HaltInterrupt ignoreIn:[
  6637 				con fullPrintAllOn:s.
  6666                                 con fullPrintAllOn:s.
  6638 			    ].
  6667                             ].
  6639 "/                            [con notNil] whileTrue:[
  6668 "/                            [con notNil] whileTrue:[
  6640 "/                                Error catch:[:ex |
  6669 "/                                Error catch:[:ex |
  6641 "/                                    s nextPutAll: '**** '; nextPutLine:(con printString).
  6670 "/                                    s nextPutAll: '**** '; nextPutLine:(con printString).
  6642 "/                                ].
  6671 "/                                ].
  6643 "/
  6672 "/
  6645 "/                                    con := nil
  6674 "/                                    con := nil
  6646 "/                                ] ifFalse:[
  6675 "/                                ] ifFalse:[
  6647 "/                                    con := con sender.
  6676 "/                                    con := con sender.
  6648 "/                                ]
  6677 "/                                ]
  6649 "/                            ].
  6678 "/                            ].
  6650 			    codeView contents:(s contents).
  6679                             codeView contents:(s contents).
  6651 			    ex return.
  6680                             ex return.
  6652 			]
  6681                         ]
  6653 		    do:
  6682                     do:
  6654 			[
  6683                         [
  6655 			    self doShowSelection:lineNr
  6684                             self doShowSelection:lineNr
  6656 			]
  6685                         ]
  6657 	    ]
  6686             ]
  6658 
  6687 
  6659     "Modified: / 04-07-2006 / 14:50:06 / cg"
  6688     "Modified: / 04-07-2006 / 14:50:06 / cg"
  6660 !
  6689 !
  6661 
  6690 
  6662 showStackInspectorFor:con
  6691 showStackInspectorFor:con
  6663     stackInspector isNil ifTrue:[
  6692     stackInspector isNil ifTrue:[
  6664 	receiverInspector origin:(0.0 @ 0.0) corner:0.3 @ 1.0.
  6693         receiverInspector origin:(0.0 @ 0.0) corner:0.3 @ 1.0.
  6665 	contextInspector origin:(0.3 @ 0.0) corner:(0.6 @ 1.0).
  6694         contextInspector origin:(0.3 @ 0.0) corner:(0.6 @ 1.0).
  6666 	stackInspector := InspectorView
  6695         stackInspector := InspectorView
  6667 		    origin:(0.6 @ 0.0)
  6696                     origin:(0.6 @ 0.0)
  6668 		    corner:(1.0 @ 1.0)
  6697                     corner:(1.0 @ 1.0)
  6669 		    in:contextInspector superView.
  6698                     in:contextInspector superView.
  6670 	stackInspector realize.
  6699         stackInspector realize.
  6671 	stackInspector fieldListLabel:'Stack'.
  6700         stackInspector fieldListLabel:'Stack'.
  6672 	stackInspector hideReceiver:true
  6701         stackInspector hideReceiver:true
  6673     ].
  6702     ].
  6674     stackInspector inspect:(con stackFrame asArray).
  6703     stackInspector inspect:(con stackFrame asArray).
  6675     stackInspector showLast
  6704     stackInspector showLast
  6676 !
  6705 !
  6677 
  6706 
  7088 
  7117 
  7089 ignoreEndTime:something
  7118 ignoreEndTime:something
  7090     ignoreEndTime := something.
  7119     ignoreEndTime := something.
  7091 !
  7120 !
  7092 
  7121 
       
  7122 ignoreUntilShiftKeyPressed:aBoolean
       
  7123     ignoreUntilShiftKeyPressed := aBoolean.
       
  7124 
       
  7125     "Created: / 27-01-2012 / 11:35:23 / cg"
       
  7126 !
       
  7127 
  7093 method
  7128 method
  7094     |m|
  7129     |m|
  7095 
  7130 
  7096     weakMethodHolder == #all ifTrue:[^ weakMethodHolder ].
  7131     weakMethodHolder == #all ifTrue:[^ weakMethodHolder ].
  7097 
  7132 
  7112 
  7147 
  7113 method:methodArg lineNumber:lineNumberArg
  7148 method:methodArg lineNumber:lineNumberArg
  7114     "/ self assert:(methodArg mclass notNil).
  7149     "/ self assert:(methodArg mclass notNil).
  7115 
  7150 
  7116     methodArg == #all ifTrue:[
  7151     methodArg == #all ifTrue:[
  7117 	weakMethodHolder := methodArg
  7152         weakMethodHolder := methodArg
  7118     ] ifFalse:[
  7153     ] ifFalse:[
  7119 	weakMethodHolder := WeakArray with:methodArg.
  7154         weakMethodHolder := WeakArray with:methodArg.
  7120     ].
  7155     ].
  7121     lineNumber := lineNumberArg.
  7156     lineNumber := lineNumberArg.
  7122 
  7157 
  7123     "Modified: / 08-05-2011 / 10:28:41 / cg"
  7158     "Modified: / 08-05-2011 / 10:28:41 / cg"
  7124 ! !
  7159 ! !
  7125 
  7160 
  7126 !DebugView::IgnoredHalt methodsFor:'misc'!
  7161 !DebugView::IgnoredHalt methodsFor:'misc'!
  7127 
  7162 
  7128 decrementIgnoreCount
  7163 decrementIgnoreCount
  7129     ignoreCount notNil ifTrue:[
  7164     ignoreCount notNil ifTrue:[
  7130 	ignoreCount > 0 ifTrue:[
  7165         ignoreCount > 0 ifTrue:[
  7131 	    ignoreCount := ignoreCount - 1
  7166             ignoreCount := ignoreCount - 1
  7132 	]
  7167         ]
  7133     ]
  7168     ]
  7134 ! !
  7169 ! !
  7135 
  7170 
  7136 !DebugView::IgnoredHalt methodsFor:'printing'!
  7171 !DebugView::IgnoredHalt methodsFor:'printing'!
  7137 
  7172 
  7138 printOn:aStream
  7173 printOn:aStream
  7139     |method|
  7174     |method|
  7140 
  7175 
  7141     (method := self method) isNil ifTrue:[
  7176     (method := self method) isNil ifTrue:[
  7142 	aStream nextPutAll:'an obsolete IgnoredHalt'.
  7177         aStream nextPutAll:'an obsolete IgnoredHalt'.
  7143 	^ self
  7178         ^ self
  7144     ].
  7179     ].
  7145 
  7180 
  7146     aStream nextPutAll:'Ignore '.
  7181     aStream nextPutAll:'Ignore '.
  7147     method printOn:aStream.
  7182     method whoString printOn:aStream.
  7148 
  7183 
  7149     ignoreEndTime notNil ifTrue:[
  7184     ignoreUntilShiftKeyPressed == true ifTrue:[
  7150 	aStream nextPutAll:'until '.
  7185         aStream nextPutAll:' until shiftKey pressed'.
  7151 	ignoreEndTime printOn:aStream.
       
  7152     ] ifFalse:[
  7186     ] ifFalse:[
  7153 	(ignoreCount > 0) ifTrue:[
  7187         ignoreEndTime notNil ifTrue:[
  7154 	    aStream nextPutAll:'for '.
  7188             aStream nextPutAll:' until '.
  7155 	    ignoreCount printOn:aStream.
  7189             ignoreEndTime printOn:aStream.
  7156 	] ifFalse:[
  7190         ] ifFalse:[
  7157 	    (ignoreCount < 0) ifTrue:[
  7191             (ignoreCount > 0) ifTrue:[
  7158 		aStream nextPutAll:'forEver'.
  7192                 aStream nextPutAll:' for '.
  7159 	    ] ifFalse:[
  7193                 ignoreCount printOn:aStream.
  7160 		aStream nextPutAll:' no longer'.
  7194             ] ifFalse:[
  7161 	    ].
  7195                 (ignoreCount < 0) ifTrue:[
  7162 	].
  7196                     aStream nextPutAll:' forEver'.
  7163     ].
  7197                 ] ifFalse:[
  7164 
  7198                     aStream nextPutAll:' no longer'.
  7165     "Modified: / 08-05-2011 / 10:29:11 / cg"
  7199                 ].
       
  7200             ].
       
  7201         ].
       
  7202     ].
       
  7203 
       
  7204     "Modified: / 27-01-2012 / 11:43:10 / cg"
  7166 ! !
  7205 ! !
  7167 
  7206 
  7168 !DebugView::IgnoredHalt methodsFor:'queries'!
  7207 !DebugView::IgnoredHalt methodsFor:'queries'!
  7169 
  7208 
  7170 haltIgnoredInfoString
  7209 haltIgnoredInfoString
  7171     "some string describing why and how this halt is ignored;
  7210     "some string describing why and how this halt is ignored;
  7172      nil if not ignored"
  7211      nil if not ignored"
  7173 
  7212 
  7174     ignoreCount notNil ifTrue:[
  7213     ignoreCount notNil ifTrue:[
  7175 	ignoreCount > 0 ifTrue:[
  7214         ignoreCount > 0 ifTrue:[
  7176 	    ^ '%1 more calls ignored' bindWith:ignoreCount
  7215             ^ '%1 more calls ignored' bindWith:ignoreCount
  7177 	].
  7216         ].
  7178 	^ nil
  7217         ^ nil
  7179     ].
  7218     ].
  7180     ignoreEndTime notNil ifTrue:[
  7219     ignoreEndTime notNil ifTrue:[
  7181 	(ignoreEndTime > Timestamp now) ifTrue:[
  7220         (ignoreEndTime > Timestamp now) ifTrue:[
  7182 	    ^ 'ignored until %1' bindWith:ignoreEndTime
  7221             ^ 'ignored until %1' bindWith:ignoreEndTime
  7183 	].
  7222         ].
  7184 	^ nil
  7223         ^ nil
       
  7224     ].
       
  7225     ignoreUntilShiftKeyPressed == true ifTrue:[
       
  7226         Display shiftDown ifFalse:[
       
  7227             ^ 'ignored until shiftKey is pressed'
       
  7228         ].
       
  7229         ^ nil
  7185     ].
  7230     ].
  7186 
  7231 
  7187     ^ 'ignored until reenabled'
  7232     ^ 'ignored until reenabled'
       
  7233 
       
  7234     "Modified: / 27-01-2012 / 11:35:48 / cg"
  7188 !
  7235 !
  7189 
  7236 
  7190 isActive
  7237 isActive
  7191     "true if this ignore-entry is still active"
  7238     "true if this ignore-entry is still active"
  7192 
  7239 
  7193     self method isNil ifTrue:[self halt. ^ false ].    "/ method no longer valid
  7240     self method isNil ifTrue:[self halt. ^ false ].    "/ method no longer valid
       
  7241 
  7194     ignoreEndTime notNil ifTrue:[
  7242     ignoreEndTime notNil ifTrue:[
  7195 	^ ignoreEndTime > Timestamp now
  7243         ^ ignoreEndTime > Timestamp now
  7196     ].
  7244     ].
  7197     ignoreCount notNil ifTrue:[
  7245     ignoreCount notNil ifTrue:[
  7198 	^ ignoreCount > 0
  7246         ^ ignoreCount > 0
  7199     ].
  7247     ].
  7200     ^ false
  7248     ^ false
  7201 
  7249 
  7202     "Modified: / 23-03-2011 / 15:21:02 / cg"
  7250     "Modified: / 23-03-2011 / 15:21:02 / cg"
       
  7251     "Modified (format): / 27-01-2012 / 11:25:30 / cg"
  7203 !
  7252 !
  7204 
  7253 
  7205 isForMethod:aMethod line:line
  7254 isForMethod:aMethod line:line
  7206     "/ check in this order - method has a flushing side-effect, which is useful here...
  7255     "/ check in this order - method has a flushing side-effect, which is useful here...
  7207     weakMethodHolder == #all ifTrue:[^ true].
  7256     weakMethodHolder == #all ifTrue:[^ true].
  7212 !
  7261 !
  7213 
  7262 
  7214 isHaltIgnored
  7263 isHaltIgnored
  7215     "true if this halt should be ignored"
  7264     "true if this halt should be ignored"
  7216 
  7265 
       
  7266     ignoreUntilShiftKeyPressed == true ifTrue:[
       
  7267         ^ Display shiftDown not
       
  7268     ].
  7217     ignoreCount notNil ifTrue:[
  7269     ignoreCount notNil ifTrue:[
  7218 	^ ignoreCount > 0
  7270         ^ ignoreCount > 0
  7219     ].
  7271     ].
  7220     ignoreEndTime notNil ifTrue:[
  7272     ignoreEndTime notNil ifTrue:[
  7221 	^ ignoreEndTime > Timestamp now
  7273         ^ ignoreEndTime > Timestamp now
  7222     ].
  7274     ].
  7223 
  7275 
  7224     ^ true
  7276     ^ true
       
  7277 
       
  7278     "Modified: / 27-01-2012 / 11:36:01 / cg"
  7225 !
  7279 !
  7226 
  7280 
  7227 isHaltIgnoredInMethod:aMethod line:line
  7281 isHaltIgnoredInMethod:aMethod line:line
  7228     "/ Transcript show:'?same as ign '; show:(weakMethodHolder at:1); show:' at '; showCR:lineNumber.
  7282     "/ Transcript show:'?same as ign '; show:(weakMethodHolder at:1); show:' at '; showCR:lineNumber.
  7229 
  7283 
  7234 ! !
  7288 ! !
  7235 
  7289 
  7236 !DebugView class methodsFor:'documentation'!
  7290 !DebugView class methodsFor:'documentation'!
  7237 
  7291 
  7238 version_CVS
  7292 version_CVS
  7239     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.526 2012-01-27 10:13:48 cg Exp $'
  7293     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.527 2012-01-27 10:50:31 cg Exp $'
  7240 !
  7294 !
  7241 
  7295 
  7242 version_SVN
  7296 version_SVN
  7243     ^ '§Id: DebugView.st 7818 2011-08-18 11:42:39Z vranyj1 §'
  7297     ^ '§Id: DebugView.st 7818 2011-08-18 11:42:39Z vranyj1 §'
  7244 ! !
  7298 ! !