DebugView.st
changeset 9590 41587c52f59c
parent 9586 592d4c8dad46
child 9593 62d7ae50438e
equal deleted inserted replaced
9589:80523e9db49f 9590:41587c52f59c
   494         ign := IgnoredHalt new method:haltingMethod lineNumber:lineNrOfHalt.
   494         ign := IgnoredHalt new method:haltingMethod lineNumber:lineNrOfHalt.
   495 
   495 
   496         (countOrNil notNil and:[countOrNil > 0]) ifTrue:[
   496         (countOrNil notNil and:[countOrNil > 0]) ifTrue:[
   497             ign ignoreCount:countOrNil.
   497             ign ignoreCount:countOrNil.
   498         ].
   498         ].
   499 
       
   500         (dTOrNil notNil) ifTrue:[
   499         (dTOrNil notNil) ifTrue:[
   501             ign ignoreEndTime:(Timestamp now + dTOrNil).
   500             ign ignoreEndTime:(Timestamp now + dTOrNil).
   502         ].
   501         ].
   503         IgnoredHalts add:ign.
   502         IgnoredHalts add:ign.
   504     ].
   503     ].
   505     Smalltalk changed:#ignoredHalts.
   504     Smalltalk changed:#ignoredHalts.
       
   505 
       
   506     "Modified: / 22-10-2010 / 13:52:02 / cg"
       
   507 !
       
   508 
       
   509 isHaltToBeIgnored
       
   510     |c haltingMethod lineNrInHaltingMethod|
       
   511 
       
   512     "/ should a halt be ignored ?
       
   513     IgnoredHalts isNil ifTrue:[^ false].
       
   514 
       
   515     "/ look for a breakpoint-wrapper's context
       
   516     c := thisContext findNextContextWithSelector:#doRaise or:nil or:nil.
       
   517     c notNil ifTrue:[
       
   518         (c receiver isKindOf:NoHandlerError) ifTrue:[
       
   519             c := c sender findNextContextWithSelector:#doRaise or:nil or:nil.
       
   520         ].
       
   521         (c receiver isKindOf:BreakPointInterrupt) ifFalse:[
       
   522             c := nil
       
   523         ] ifTrue:[
       
   524             [ (c sender receiver isKindOf:BreakPointInterrupt)
       
   525             or:[ c sender receiver == BreakPointInterrupt ]] whileTrue:[
       
   526                 c := c sender
       
   527             ].
       
   528             [ c sender isBlockContext ] whileTrue:[
       
   529                 c := c sender
       
   530             ].
       
   531         ].
       
   532     ].
       
   533 
       
   534     c isNil ifTrue:[
       
   535         "/ look for halts or explicit breakpoints
       
   536         c := thisContext findNextContextWithSelector:#halt or:#halt: or:nil.
       
   537         c isNil ifTrue:[
       
   538             c := thisContext findNextContextWithSelector:#breakPoint: or:#breakPoint:info: or:nil.
       
   539             c isNil ifTrue:[
       
   540                ^ false
       
   541             ].
       
   542         ].
       
   543     ].
       
   544 
       
   545     c := c sender.
       
   546     haltingMethod := c method.
       
   547 
       
   548     haltingMethod isWrapped ifTrue:[
       
   549         lineNrInHaltingMethod := 1.
       
   550     ] ifFalse:[
       
   551         lineNrInHaltingMethod := c lineNumber.
       
   552         "/ Transcript showCR:c.
       
   553     ].
       
   554 
       
   555     ^ self 
       
   556         isHaltToBeIgnoredIn:haltingMethod
       
   557         atLineNr:lineNrInHaltingMethod
       
   558         modifyEntryCount:true.
       
   559 
       
   560     "Created: / 22-10-2010 / 12:09:53 / cg"
       
   561     "Modified: / 22-10-2010 / 13:51:25 / cg"
   506 !
   562 !
   507 
   563 
   508 isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod
   564 isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod
   509     ^ self
   565     ^ self
   510         isHaltToBeIgnoredIn:haltingMethod 
   566         isHaltToBeIgnoredIn:haltingMethod 
   527                 IgnoredHalts remove:ign ifAbsent:[].    
   583                 IgnoredHalts remove:ign ifAbsent:[].    
   528             ].
   584             ].
   529             ^ true.
   585             ^ true.
   530         ].
   586         ].
   531     ].
   587     ].
       
   588 
   532     IgnoredHalts := IgnoredHalts 
   589     IgnoredHalts := IgnoredHalts 
   533         select:[:ign | 
   590         select:[:ign | 
   534             ign isActive 
   591             ign isActive and:[ (ign isForMethod:haltingMethod line:lineNrInHaltingMethod) not ]
   535             and:[ (ign isForMethod:haltingMethod line:lineNrInHaltingMethod) not ]
       
   536         ].
   592         ].
   537     IgnoredHalts isEmpty ifTrue:[
   593     IgnoredHalts isEmpty ifTrue:[
   538         IgnoredHalts := nil.
   594         IgnoredHalts := nil.
   539     ].
   595     ].
   540 
   596 
   541     ^ false.
   597     ^ false.
       
   598 
       
   599     "Modified: / 22-10-2010 / 13:51:45 / cg"
   542 !
   600 !
   543 
   601 
   544 removeInactiveIgnores
   602 removeInactiveIgnores
   545     IgnoredHalts notNil ifTrue:[
   603     IgnoredHalts notNil ifTrue:[
   546         IgnoredHalts := IgnoredHalts select:[:i | i isActive].
   604         IgnoredHalts := IgnoredHalts select:[:i | i isActive].
   659               (
   717               (
   660                (MenuItem
   718                (MenuItem
   661                   label: 'Continue'
   719                   label: 'Continue'
   662                   itemValue: doContinue
   720                   itemValue: doContinue
   663                   translateLabel: true
   721                   translateLabel: true
       
   722                   shortcutKey: Cmdc
       
   723                 )
       
   724                (MenuItem
       
   725                   label: 'Next (Line-Step)'
       
   726                   itemValue: doNext
       
   727                   translateLabel: true
       
   728                   shortcutKey: Cmdn
       
   729                 )
       
   730                (MenuItem
       
   731                   label: 'Step'
       
   732                   itemValue: doStep
       
   733                   translateLabel: true
       
   734                   shortcutKey: Cmds
   664                 )
   735                 )
   665                (MenuItem
   736                (MenuItem
   666                   label: '-'
   737                   label: '-'
   667                 )
   738                 )
   668                (MenuItem
   739                (MenuItem
   669                   label: 'Abort'
   740                   label: 'Abort'
   670                   itemValue: doAbort
   741                   itemValue: doAbort
   671                   translateLabel: true
   742                   translateLabel: true
       
   743                   shortcutKey: Cmdx
   672                 )
   744                 )
   673                (MenuItem
   745                (MenuItem
   674                   enabled: abortAllIsHandled
   746                   enabled: abortAllIsHandled
   675                   label: 'Abort All'
   747                   label: 'Abort All'
   676                   itemValue: doAbortAll
   748                   itemValue: doAbortAll
   914           )
   986           )
   915          )
   987          )
   916         nil
   988         nil
   917         nil
   989         nil
   918       )
   990       )
   919 
       
   920     "Modified: / 19-10-2010 / 12:59:06 / cg"
       
   921 ! !
   991 ! !
   922 
   992 
   923 !DebugView class methodsFor:'misc'!
   993 !DebugView class methodsFor:'misc'!
   924 
   994 
   925 interestingContextFrom:aContext
   995 interestingContextFrom:aContext
  1269 
  1339 
  1270 "/'entering: ' print. aContext printCR.
  1340 "/'entering: ' print. aContext printCR.
  1271 "/'initial: ' print. initialSelectionOrNil printCR.
  1341 "/'initial: ' print. initialSelectionOrNil printCR.
  1272     thisContext sender fixAllLineNumbers. "/ _CONTEXTLINENOS(s)
  1342     thisContext sender fixAllLineNumbers. "/ _CONTEXTLINENOS(s)
  1273 
  1343 
  1274     self isHaltToBeIgnored ifTrue:[
  1344     self class isHaltToBeIgnored ifTrue:[
  1275         ^ self.
  1345         ^ self.
  1276     ].
  1346     ].
  1277 
  1347 
  1278     iAmNew := drawableId isNil.
  1348     iAmNew := drawableId isNil.
  1279 
  1349 
  1548     ]
  1618     ]
  1549 
  1619 
  1550     "Modified: / 17-04-1997 / 13:01:32 / stefan"
  1620     "Modified: / 17-04-1997 / 13:01:32 / stefan"
  1551     "Created: / 30-10-1997 / 21:08:18 / cg"
  1621     "Created: / 30-10-1997 / 21:08:18 / cg"
  1552     "Modified: / 13-10-1998 / 19:56:59 / ps"
  1622     "Modified: / 13-10-1998 / 19:56:59 / ps"
  1553     "Modified: / 28-07-2007 / 12:12:03 / cg"
  1623     "Modified: / 22-10-2010 / 12:10:09 / cg"
  1554 !
  1624 !
  1555 
  1625 
  1556 exit_abort
  1626 exit_abort
  1557     "/ cannot simply raise an abort here, because if there is an abortHandler somewhere,
  1627     "/ cannot simply raise an abort here, because if there is an abortHandler somewhere,
  1558     "/ that one would run on top of this context.
  1628     "/ that one would run on top of this context.
  4615 
  4685 
  4616 addIgnoredHaltForCount:countOrNil orTimeDuration:dTOrNil
  4686 addIgnoredHaltForCount:countOrNil orTimeDuration:dTOrNil
  4617     |haltingContext haltingMethod lineNrOfHalt|
  4687     |haltingContext haltingMethod lineNrOfHalt|
  4618 
  4688 
  4619     haltingContext := self findHaltingContext.
  4689     haltingContext := self findHaltingContext.
  4620     haltingContext isNil ifTrue:[ ^ self ].
  4690     haltingContext isNil ifTrue:[ Transcript showCR:'no halting context found'. ^ self ].
  4621 
  4691 
  4622     haltingMethod := haltingContext method.
  4692     haltingMethod := haltingContext method.
  4623     lineNrOfHalt := haltingContext lineNumber.
  4693     lineNrOfHalt := haltingContext lineNumber.
  4624 
  4694 
  4625     self class
  4695     self class
  4626         ignoreHaltIn:haltingMethod at:lineNrOfHalt 
  4696         ignoreHaltIn:haltingMethod at:lineNrOfHalt 
  4627         forCount:countOrNil orTimeDuration:dTOrNil
  4697         forCount:countOrNil orTimeDuration:dTOrNil
  4628 
  4698 
  4629     "Modified: / 20-10-2010 / 10:18:19 / cg"
  4699     "Modified: / 22-10-2010 / 13:50:47 / cg"
  4630 !
  4700 !
  4631 
  4701 
  4632 busy
  4702 busy
  4633     ^ busy
  4703     ^ busy
  4634 !
  4704 !
  5173 
  5243 
  5174 !DebugView methodsFor:'private queries'!
  5244 !DebugView methodsFor:'private queries'!
  5175 
  5245 
  5176 isAborting
  5246 isAborting
  5177     ^ exitAction == #abort
  5247     ^ exitAction == #abort
  5178 !
       
  5179 
       
  5180 isHaltToBeIgnored
       
  5181     |c haltingMethod lineNrInHaltingMethod|
       
  5182 
       
  5183     "/ should a halt be ignored ?
       
  5184     IgnoredHalts isNil ifTrue:[^ false].
       
  5185 
       
  5186     c := thisContext findNextContextWithSelector:#halt or:#halt: or:nil.
       
  5187     c isNil ifTrue:[
       
  5188         c := thisContext findNextContextWithSelector:#breakPoint: or:#breakPoint:info: or:nil.
       
  5189     ].
       
  5190     c isNil ifTrue:[^ false].
       
  5191 
       
  5192     c := c sender.
       
  5193     haltingMethod := c method.
       
  5194     lineNrInHaltingMethod := c lineNumber.
       
  5195     "/ Transcript showCR:c.
       
  5196 
       
  5197     ^ self class 
       
  5198         isHaltToBeIgnoredIn:haltingMethod 
       
  5199         atLineNr:lineNrInHaltingMethod
       
  5200         modifyEntryCount:true.
       
  5201 !
  5248 !
  5202 
  5249 
  5203 setOfHiddenCallingSelectors
  5250 setOfHiddenCallingSelectors
  5204     ^ setOfHiddenCallingSelectors ? #( #'doIt' #'doIt:' )
  5251     ^ setOfHiddenCallingSelectors ? #( #'doIt' #'doIt:' )
  5205 !
  5252 !
  6880             "/ no longer valid
  6927             "/ no longer valid
  6881             weakMethodHolder at:1 put:nil.
  6928             weakMethodHolder at:1 put:nil.
  6882             ^ nil
  6929             ^ nil
  6883         ].
  6930         ].
  6884     ].
  6931     ].
  6885     ^ m 
  6932     ^ m
       
  6933 
       
  6934     "Modified: / 22-10-2010 / 13:50:29 / cg"
  6886 !
  6935 !
  6887 
  6936 
  6888 method:methodArg lineNumber:lineNumberArg
  6937 method:methodArg lineNumber:lineNumberArg
  6889     self assert:(methodArg mclass notNil).
  6938     "/ self assert:(methodArg mclass notNil).
  6890 
  6939 
  6891     weakMethodHolder := WeakArray with:methodArg.
  6940     weakMethodHolder := WeakArray with:methodArg.
  6892     lineNumber := lineNumberArg.
  6941     lineNumber := lineNumberArg.
       
  6942 
       
  6943     "Modified: / 22-10-2010 / 12:01:19 / cg"
  6893 ! !
  6944 ! !
  6894 
  6945 
  6895 !DebugView::IgnoredHalt methodsFor:'misc'!
  6946 !DebugView::IgnoredHalt methodsFor:'misc'!
  6896 
  6947 
  6897 decrementIgnoreCount
  6948 decrementIgnoreCount
  6907 printOn:aStream
  6958 printOn:aStream
  6908     self method isNil ifTrue:[
  6959     self method isNil ifTrue:[
  6909         aStream nextPutAll:'an obsolete IgnoredHalt'.
  6960         aStream nextPutAll:'an obsolete IgnoredHalt'.
  6910         ^ self
  6961         ^ self
  6911     ].
  6962     ].
       
  6963 
  6912     aStream nextPutAll:'Ignore '.
  6964     aStream nextPutAll:'Ignore '.
  6913     self method printOn:aStream.
  6965     self method printOn:aStream.
  6914     ignoreEndTime notNil ifTrue:[
  6966     ignoreEndTime notNil ifTrue:[
  6915         aStream nextPutAll:'until '.
  6967         aStream nextPutAll:'until '.
  6916         ignoreEndTime printOn:aStream.
  6968         ignoreEndTime printOn:aStream.
  6924             ] ifFalse:[
  6976             ] ifFalse:[
  6925                 aStream nextPutAll:' no longer'.
  6977                 aStream nextPutAll:' no longer'.
  6926             ].
  6978             ].
  6927         ].
  6979         ].
  6928     ].
  6980     ].
       
  6981 
       
  6982     "Modified: / 22-10-2010 / 13:34:20 / cg"
  6929 ! !
  6983 ! !
  6930 
  6984 
  6931 !DebugView::IgnoredHalt methodsFor:'queries'!
  6985 !DebugView::IgnoredHalt methodsFor:'queries'!
  6932 
  6986 
  6933 haltIgnoredInfoString
  6987 haltIgnoredInfoString
  6991 ! !
  7045 ! !
  6992 
  7046 
  6993 !DebugView class methodsFor:'documentation'!
  7047 !DebugView class methodsFor:'documentation'!
  6994 
  7048 
  6995 version
  7049 version
  6996     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.506 2010-10-20 09:04:28 cg Exp $'
  7050     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.507 2010-10-22 11:53:56 cg Exp $'
  6997 !
  7051 !
  6998 
  7052 
  6999 version_CVS
  7053 version_CVS
  7000     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.506 2010-10-20 09:04:28 cg Exp $'
  7054     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.507 2010-10-22 11:53:56 cg Exp $'
  7001 ! !
  7055 ! !
  7002 
  7056 
  7003 DebugView initialize!
  7057 DebugView initialize!