added:8 methods
authorClaus Gittinger <cg@exept.de>
Mon, 26 Oct 2009 11:46:01 +0100
changeset 9078 a5b4f1a443f5
parent 9077 c936c0fc8ef4
child 9079 8f59fc950e8f
added:8 methods changed: #addIgnoredHaltForCount:orTimeDuration: #isHaltToBeIgnored #stopIgnoringHalts category of:
DebugView.st
--- a/DebugView.st	Mon Oct 26 11:10:41 2009 +0100
+++ b/DebugView.st	Mon Oct 26 11:46:01 2009 +0100
@@ -446,11 +446,91 @@
 
 !DebugView class methodsFor:'ignoring halts'!
 
+haltIgnoreInformationFor:haltingMethod atLineNr:lineNrInHaltingMethod
+    "the information (if any) about the ignore-state of a halt"
+
+    IgnoredHalts isNil ifTrue:[^ nil].
+
+    IgnoredHalts do:[:ign | 
+        (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
+            ^ ign
+        ].
+    ].
+    ^ nil.
+!
+
 hasIgnoredHalts
     ^ IgnoredHalts notEmptyOrNil
 !
 
+ignoreHaltIn:haltingMethod at:lineNrOfHalt forCount:countOrNil orTimeDuration:dTOrNil
+    "remember to ignore a halt in some method for some number of invocations
+     or until some time has elapsed.
+     With nil count and time arguments, such an ignored halt is reactivated"
+
+    |oldEntry ign|
+
+    IgnoredHalts notNil ifTrue:[
+        oldEntry := IgnoredHalts 
+                        detect:[:ign | ign isForMethod:haltingMethod line:lineNrOfHalt]
+                        ifNone:nil.
+        IgnoredHalts remove:oldEntry ifAbsent:[].
+    ].
+
+    (countOrNil notNil or:[dTOrNil notNil]) ifTrue:[
+        IgnoredHalts isNil ifTrue:[
+            IgnoredHalts := OrderedCollection new.
+        ].
+        ign := IgnoredHalt new method:haltingMethod lineNumber:lineNrOfHalt.
+
+        (countOrNil notNil and:[countOrNil > 0]) ifTrue:[
+            ign ignoreCount:countOrNil.
+        ].
+
+        (dTOrNil notNil) ifTrue:[
+            ign ignoreEndTime:(Timestamp now + dTOrNil).
+        ].
+        IgnoredHalts add:ign.
+    ].
+!
+
+isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod
+    ^ self
+        isHaltToBeIgnoredIn:haltingMethod 
+        atLineNr:lineNrInHaltingMethod 
+        modifyEntryCount:false
+!
+
+isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod modifyEntryCount:modifyCount
+    "/ should a halt be ignored ?
+
+    IgnoredHalts isNil ifTrue:[^ false].
+
+"/ Transcript showCR:'halt/break in ',haltingMethod printString,' at ',lineNrInHaltingMethod printString.
+    IgnoredHalts do:[:ign | 
+        (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
+            Transcript showCR:'Debugger [info]: halt ignored in ', haltingMethod whoString.
+            modifyCount ifTrue:[ ign decrementIgnoreCount ].
+            ign isHaltIgnored ifFalse:[
+                Transcript showCR:'Debugger [info]: no longer ignore halt in ', haltingMethod whoString.
+                IgnoredHalts remove:ign ifAbsent:[].    
+            ].
+            ^ true.
+        ].
+    ].
+    IgnoredHalts do:[:ign | 
+        (ign method isNil
+        or:[ ign isForMethod:haltingMethod line:lineNrInHaltingMethod ]) ifTrue:[
+            IgnoredHalts remove:ign ifAbsent:[].    
+        ].
+    ].
+
+    ^ false.
+!
+
 stopIgnoringHalts
+    "forget about all ignored halts"
+
     IgnoredHalts := nil
 ! !
 
@@ -1069,35 +1149,6 @@
     "Modified: / 15-10-2007 / 16:50:27 / cg"
 ! !
 
-!DebugView class methodsFor:'private queries'!
-
-isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod
-    "/ should a halt be ignored ?
-
-    IgnoredHalts isNil ifTrue:[^ false].
-
-"/ Transcript showCR:'halt/break in ',haltingMethod printString,' at ',lineNrInHaltingMethod printString.
-    IgnoredHalts do:[:ign | 
-        (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
-            Transcript showCR:'Debugger [info]: halt ignored in ', haltingMethod whoString.
-            ign decrementIgnoreCount.
-            ign isHaltIgnored ifFalse:[
-                Transcript showCR:'Debugger [info]: no longer ignore halt in ', haltingMethod whoString.
-                IgnoredHalts remove:ign ifAbsent:[].    
-            ].
-            ^ true.
-        ].
-    ].
-    IgnoredHalts do:[:ign | 
-        (ign method isNil
-        or:[ ign isForMethod:haltingMethod line:lineNrInHaltingMethod ]) ifTrue:[
-            IgnoredHalts remove:ign ifAbsent:[].    
-        ].
-    ].
-
-    ^ false.
-! !
-
 !DebugView methodsFor:'basic'!
 
 enableDisableActions
@@ -4430,35 +4481,15 @@
 !
 
 addIgnoredHaltForCount:countOrNil orTimeDuration:dTOrNil
-    |haltingContext haltingMethod lineNrOfHalt
-     oldEntry ign|
+    |haltingContext haltingMethod lineNrOfHalt|
 
     haltingContext := self findHaltingContext.
     haltingMethod := haltingContext method.
     lineNrOfHalt := haltingContext lineNumber.
 
-    IgnoredHalts notNil ifTrue:[
-        oldEntry := IgnoredHalts 
-                        detect:[:ign | ign isForMethod:haltingMethod line:lineNrOfHalt]
-                        ifNone:nil.
-        IgnoredHalts remove:oldEntry ifAbsent:[].
-    ].
-
-    (countOrNil notNil or:[dTOrNil notNil]) ifTrue:[
-        IgnoredHalts isNil ifTrue:[
-            IgnoredHalts := OrderedCollection new.
-        ].
-        ign := IgnoredHalt new method:haltingMethod lineNumber:lineNrOfHalt.
-
-        (countOrNil notNil and:[countOrNil > 0]) ifTrue:[
-            ign ignoreCount:countOrNil.
-        ].
-
-        (dTOrNil notNil) ifTrue:[
-            ign ignoreEndTime:(Timestamp now + dTOrNil).
-        ].
-        IgnoredHalts add:ign.
-    ].
+    self class
+        ignoreHaltIn:haltingMethod at:lineNrOfHalt 
+        forCount:countOrNil orTimeDuration:dTOrNil
 !
 
 busy
@@ -4975,7 +5006,6 @@
 isHaltToBeIgnored
     |c haltingMethod lineNrInHaltingMethod|
 
-'1' infoPrintCR.
     "/ should a halt be ignored ?
     IgnoredHalts isNil ifTrue:[^ false].
 
@@ -4985,11 +5015,13 @@
     ].
     c isNil ifTrue:[^ false].
 
-'2' infoPrintCR.
     c := c sender.
     haltingMethod := c method.
     lineNrInHaltingMethod := c lineNumber.
-    ^ self class isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod.
+    ^ self class 
+        isHaltToBeIgnoredIn:haltingMethod 
+        atLineNr:lineNrInHaltingMethod
+        modifyEntryCount:true.
 !
 
 setOfHiddenCallingSelectors
@@ -6651,6 +6683,26 @@
 
 !DebugView::IgnoredHalt methodsFor:'queries'!
 
+haltIgnoredInfoString
+    "some string describing why and how this halt is ignored;
+     nil if not ignored"
+
+    ignoreCount notNil ifTrue:[
+        ignoreCount > 0 ifTrue:[    
+            ^ '%1 more calls ignored' bindWith:ignoreCount
+        ].
+        ^ nil
+    ].
+    ignoreEndTime notNil ifTrue:[
+        (ignoreEndTime > Timestamp now) ifTrue:[
+            ^ 'ignored until %1' bindWith:ignoreEndTime
+        ].
+        ^ nil
+    ].
+
+    ^ 'ignored until reenabled'
+!
+
 isForMethod:aMethod line:line
     line = lineNumber ifFalse:[^ false].
     (weakMethodHolder at:1) == aMethod ifFalse:[^ false].
@@ -6659,6 +6711,8 @@
 !
 
 isHaltIgnored
+    "true if this halt should be ignored"
+
     ignoreCount notNil ifTrue:[
         ^ ignoreCount > 0 
     ].
@@ -6680,11 +6734,11 @@
 !DebugView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.476 2009-10-25 16:18:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.477 2009-10-26 10:46:01 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.476 2009-10-25 16:18:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.477 2009-10-26 10:46:01 cg Exp $'
 ! !
 
 DebugView initialize!