--- a/DebugView.st Thu Jun 13 12:23:07 2013 +0100
+++ b/DebugView.st Fri Jun 21 19:05:40 2013 +0100
@@ -40,7 +40,8 @@
!
Object subclass:#IgnoredHaltOrBreakpoint
- instanceVariableNames:'ignoreEndTime ignoreCount ignoreUntilShiftKeyPressed'
+ instanceVariableNames:'ignoreEndTime ignoreCount ignoreUntilShiftKeyPressed
+ ignoredReceiverClasses ignoredProcesses'
classVariableNames:''
poolDictionaries:''
privateIn:DebugView
@@ -228,7 +229,9 @@
IgnoredHalts isNil ifTrue:[^ nil].
IgnoredHalts do:[:ign |
- (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod) ifTrue:[
+ (ign isForMethod:haltingMethod line:lineNrInHaltingMethod)
+ "/ (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod)
+ ifTrue:[
^ ign
].
].
@@ -240,7 +243,36 @@
^ IgnoredHalts notEmptyOrNil
!
-ignoreBreakpointWithParameter:parameterOrNil forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
+ignoreBreakpointWithParameter:parameterOrNil forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey orReceiverClass:receiverClassOrNil orProcess:processOrNil
+ "remember to ignore a breakpoint with a parameter (i.e. breakpoint:#cg) for some number of invocations
+ or until some time has elapsed.
+ With nil count and time arguments, such an ignored breakpoint is reactivated"
+
+ self
+ ignoreHaltOrBreakpoint:#halt
+ method:nil line:nil
+ parameter:parameterOrNil
+ forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
+ orReceiverClass:receiverClassOrNil orProcess:processOrNil
+!
+
+ignoreHaltIn:haltingMethod at:lineNrOfHalt forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey orReceiverClass:receiverClassOrNil orProcess:processOrNil
+ "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"
+
+ self
+ ignoreHaltOrBreakpoint:#halt
+ method:haltingMethod line:lineNrOfHalt
+ parameter:nil
+ forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
+ orReceiverClass:receiverClassOrNil orProcess:processOrNil
+!
+
+ignoreHaltOrBreakpoint:type method:methodOrNil line:lineNrOfHaltOrNil parameter:parameterOrNil
+ forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
+ orReceiverClass:receiverClassOrNil orProcess:processOrNil
+
"remember to ignore a breakpoint with a parameter (i.e. breakpoint:#cg) for some number of invocations
or until some time has elapsed.
With nil count and time arguments, such an ignored breakpoint is reactivated"
@@ -249,19 +281,43 @@
IgnoredHalts notNil ifTrue:[
self removeInactiveIgnores.
- oldEntry := IgnoredHalts
- detect:[:ign | ign isForBreakpointWithParameter:parameterOrNil]
- ifNone:nil.
+ type == #halt ifTrue:[
+ oldEntry := IgnoredHalts
+ detect:[:ign | ign isForMethod:methodOrNil line:lineNrOfHaltOrNil]
+ ifNone:nil.
+ ] ifFalse:[
+ oldEntry := IgnoredHalts
+ detect:[:ign | ign isForBreakpointWithParameter:parameterOrNil]
+ ifNone:nil.
+ ].
oldEntry notNil ifTrue:[
+ (processOrNil notNil or:[receiverClassOrNil notNil]) ifTrue:[
+ receiverClassOrNil notNil ifTrue:[
+ oldEntry ignoreForReceiverClass:receiverClassOrNil.
+ ].
+ processOrNil notNil ifTrue:[
+ oldEntry ignoreForProcess:processOrNil.
+ ].
+ ^ self.
+ ].
IgnoredHalts remove:oldEntry ifAbsent:[].
]
].
- (countOrNil notNil or:[dTOrNil notNil or:[untilShiftKey == true]]) ifTrue:[
+ (countOrNil notNil
+ or:[dTOrNil notNil
+ or:[untilShiftKey == true
+ or:[receiverClassOrNil notNil
+ or:[processOrNil notNil]]]]
+ ) ifTrue:[
IgnoredHalts isNil ifTrue:[
IgnoredHalts := OrderedCollection new.
].
- ign := IgnoredHalt new breakpointWithParameter:parameterOrNil.
+ type == #halt ifTrue:[
+ ign := IgnoredHalt new method:methodOrNil lineNumber:lineNrOfHaltOrNil.
+ ] ifFalse:[
+ ign := IgnoredHalt new breakpointWithParameter:parameterOrNil.
+ ].
(countOrNil notNil and:[countOrNil > 0]) ifTrue:[
ign ignoreCount:countOrNil.
@@ -272,6 +328,12 @@
untilShiftKey == true ifTrue:[
ign ignoreUntilShiftKeyPressed:true.
].
+ receiverClassOrNil notNil ifTrue:[
+ ign ignoreForReceiverClass:receiverClassOrNil.
+ ].
+ processOrNil notNil ifTrue:[
+ ign ignoreForProcess:processOrNil.
+ ].
IgnoredHalts add:ign.
].
Smalltalk changed:#ignoredHalts.
@@ -279,46 +341,7 @@
"Created: / 06-03-2012 / 12:37:58 / cg"
!
-ignoreHaltIn:haltingMethod at:lineNrOfHalt forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
- "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:[
- self removeInactiveIgnores.
- oldEntry := IgnoredHalts
- detect:[:ign | ign isForMethod:haltingMethod line:lineNrOfHalt]
- ifNone:nil.
- oldEntry notNil ifTrue:[
- IgnoredHalts remove:oldEntry ifAbsent:[].
- ]
- ].
-
- (countOrNil notNil or:[dTOrNil notNil or:[untilShiftKey == true]]) 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).
- ].
- untilShiftKey == true ifTrue:[
- ign ignoreUntilShiftKeyPressed:true.
- ].
- IgnoredHalts add:ign.
- ].
- Smalltalk changed:#ignoredHalts.
-
- "Created: / 27-01-2012 / 11:33:38 / cg"
-!
-
-isBreakpointToBeIgnoredForParameter:parameter modifyEntryCount:modifyCount
+isBreakpointToBeIgnoredForParameter:parameter context:aContext modifyEntryCount:modifyCount
"/ should a breakpoint be ignored ?
IgnoredHalts isNil ifTrue:[^ false].
@@ -347,14 +370,14 @@
"Created: / 06-03-2012 / 12:50:30 / cg"
!
-isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod modifyEntryCount:modifyCount
+isHaltToBeIgnoredIn:haltingMethod atLineNr:lineNrInHaltingMethod context:aContext 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:[
+ (ign isHaltIgnoredInMethod:haltingMethod line:lineNrInHaltingMethod context:aContext) ifTrue:[
Transcript show:'Debugger [info]: halt/break ignored in ', haltingMethod whoString.
Transcript show:' ('; show:ign; showCR:')'.
@@ -712,6 +735,16 @@
)
(MenuItem
enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
+ label: 'For this Receiver Class'
+ itemValue: ignoreHaltForThisReceiverClass
+ )
+ (MenuItem
+ enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
+ label: 'In Current Process'
+ itemValue: ignoreHaltForCurrentProcess
+ )
+ (MenuItem
+ enabled: isStoppedAtHaltOrBreakPointOrSelectedContextIsWrapped
label: 'Until Shift-Key is Pressed'
itemValue: ignoreHaltUntilShiftKeyIsPressed
)
@@ -4866,7 +4899,7 @@
context:currentContext
originator:nil) notNil]
) ifTrue:[
-self halt.
+ self breakPoint:#cg.
].
currentContext := currentContext findSpecialHandle:true raise:true. "search starts at currentContext sender"
"/ Transcript showCR:currentContext.
@@ -5311,13 +5344,19 @@
!
ignoreAllHaltsForever
- self addIgnoredHaltForCount:-1 orTimeDuration:nil orUntilShiftKey:false forAll:true.
+ self
+ addIgnoredHaltForCount:-1 orTimeDuration:nil orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:true.
"Created: / 08-05-2011 / 10:19:56 / cg"
!
ignoreAllHaltsUntilShiftKeyIsPressed
- self addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true forAll:true.
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:true.
"Created: / 27-01-2012 / 11:32:14 / cg"
!
@@ -5330,19 +5369,46 @@
!
ignoreBreakpointsWithThisParameterUntilShiftKeyIsPressed
- self addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true forAll:false.
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:false.
"Created: / 06-03-2012 / 12:35:22 / cg"
!
+ignoreHaltForCurrentProcess
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:true
+ forAll:false.
+
+ "Created: / 27-01-2012 / 11:32:14 / cg"
+!
+
+ignoreHaltForThisReceiverClass
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:false
+ orThisReceiverClass:true orCurrentProcess:false
+ forAll:false.
+
+ "Created: / 27-01-2012 / 11:32:14 / cg"
+!
+
ignoreHaltForever
- self addIgnoredHaltForCount:-1 orTimeDuration:nil orUntilShiftKey:false forAll:false.
+ self
+ addIgnoredHaltForCount:-1 orTimeDuration:nil orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:false.
"Modified: / 27-01-2012 / 11:31:37 / cg"
!
ignoreHaltUntilShiftKeyIsPressed
- self addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true forAll:false.
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:nil orUntilShiftKey:true
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:false.
"Created: / 27-01-2012 / 11:36:54 / cg"
!
@@ -5365,7 +5431,10 @@
dT := TimeDuration readFrom:answer onError:[ nil ].
dT notNil ifTrue:[
LastIgnoreHaltDuration := dT.
- self addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false forAll:true.
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:true.
^ self.
].
] loop
@@ -5387,7 +5456,10 @@
n := Integer readFrom:answer onError:nil.
n notNil ifTrue:[
LastIgnoreHaltNTimes := n.
- self addIgnoredHaltForCount:n orTimeDuration:nil orUntilShiftKey:false forAll:false.
+ self
+ addIgnoredHaltForCount:n orTimeDuration:nil orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:false.
^ self.
].
] loop.
@@ -5410,7 +5482,10 @@
dT := TimeDuration readFrom:answer onError:[ nil ].
dT notNil ifTrue:[
LastIgnoreHaltDuration := dT.
- self addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false forAll:false.
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:false.
^ self.
].
] loop
@@ -5430,7 +5505,10 @@
n := Integer readFrom:answer onError:nil.
n notNil ifTrue:[
LastIgnoreHaltNTimes := n.
- self addIgnoredHaltForCount:n orTimeDuration:nil orUntilShiftKey:false forAll:false.
+ self
+ addIgnoredHaltForCount:n orTimeDuration:nil orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:false.
^ self.
].
] loop.
@@ -5450,7 +5528,10 @@
dT := TimeDuration readFrom:answer onError:[ nil ].
dT notNil ifTrue:[
LastIgnoreHaltDuration := dT.
- self addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false forAll:false.
+ self
+ addIgnoredHaltForCount:nil orTimeDuration:dT orUntilShiftKey:false
+ orThisReceiverClass:false orCurrentProcess:false
+ forAll:false.
^ self.
].
] loop
@@ -6087,8 +6168,10 @@
!DebugView methodsFor:'private-breakpoints'!
-addIgnoredHaltForCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey forAll:aBoolean
- |haltingContext haltingMethod lineNrOfHalt|
+addIgnoredHaltForCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
+ orThisReceiverClass:forThisReceiverClass orCurrentProcess:forCurrentProcess
+ forAll:aBoolean
+ |haltingContext haltingMethod lineNrOfHalt receiverClassOrNil processOrNil|
aBoolean ifTrue:[
haltingMethod := #all
@@ -6105,11 +6188,18 @@
Transcript showCR:'no halt lineNr found'.
^ self
].
+ forThisReceiverClass ifTrue:[
+ receiverClassOrNil := haltingContext receiver class
+ ].
+ forCurrentProcess ifTrue:[
+ processOrNil := Processor activeProcess
+ ].
].
self class
ignoreHaltIn:haltingMethod at:lineNrOfHalt
forCount:countOrNil orTimeDuration:dTOrNil orUntilShiftKey:untilShiftKey
+ orReceiverClass:receiverClassOrNil orProcess:processOrNil
"Created: / 27-01-2012 / 11:31:12 / cg"
!
@@ -6348,7 +6438,11 @@
^ false
].
breakpointParameter := c argAt:1.
- (self class isBreakpointToBeIgnoredForParameter:breakpointParameter modifyEntryCount:true) ifTrue:[
+ (self class
+ isBreakpointToBeIgnoredForParameter:breakpointParameter
+ context:(c sender)
+ modifyEntryCount:true
+ ) ifTrue:[
^ true.
].
].
@@ -6371,6 +6465,7 @@
^ self class
isHaltToBeIgnoredIn:haltingMethod
atLineNr:lineNrInHaltingMethod
+ context:c
modifyEntryCount:true.
"Created: / 22-10-2010 / 12:09:53 / cg"
@@ -7998,7 +8093,7 @@
code size < 100000 ifTrue:[
Error handle:[:ex |
] do:[
- code := highlighter formatMethod:code in:implementorClass.
+ code := highlighter formatMethodSource:code in:implementorClass.
]
]
]
@@ -8061,15 +8156,19 @@
].
].
- codeView doItAction:[:theCode |
- evaluatorClass
- evaluate:theCode
- in:actualContext
- receiver:rec
- notifying:codeView
- logged:true
- ifFail:nil
- ].
+ codeView
+ doItAction:
+ [:theCode |
+ evaluatorClass
+ evaluate:theCode
+ in:actualContext
+ receiver:rec
+ notifying:codeView
+ logged:true
+ ifFail:nil
+ ];
+ editedMethodOrClass:(method ? rec class).
+
self setCurrentMethod:method.
selectedContext := homeContext ? con.
@@ -8127,6 +8226,20 @@
ignoreEndTime := something.
!
+ignoreForProcess:aProcess
+ ignoredProcesses isNil ifTrue:[
+ ignoredProcesses := WeakIdentitySet new.
+ ].
+ ignoredProcesses add:aProcess
+!
+
+ignoreForReceiverClass:aClass
+ ignoredReceiverClasses isNil ifTrue:[
+ ignoredReceiverClasses := WeakIdentitySet new.
+ ].
+ ignoredReceiverClasses add:aClass
+!
+
ignoreUntilShiftKeyPressed:aBoolean
ignoreUntilShiftKeyPressed := aBoolean.
@@ -8148,25 +8261,37 @@
!DebugView::IgnoredHaltOrBreakpoint methodsFor:'printing'!
printConditionOn:aStream
- ignoreUntilShiftKeyPressed == true ifTrue:[
- aStream nextPutAll:' until shiftKey pressed'.
+ ignoredProcesses notEmptyOrNil ifTrue:[
+ aStream nextPutAll:(' in %1 processes (%2)'
+ bindWith:ignoredProcesses size
+ with:((ignoredProcesses collect:[:each | each name] as:OrderedCollection) asStringWith:', ')).
] ifFalse:[
- ignoreEndTime notNil ifTrue:[
- aStream nextPutAll:' until '.
- ignoreEndTime printOn:aStream.
+ ignoredReceiverClasses notNil ifTrue:[
+ aStream nextPutAll:(' for %1 classes (%2)'
+ bindWith:ignoredReceiverClasses size
+ with:((ignoredReceiverClasses collect:[:each | each name] as:OrderedCollection) asStringWith:', '))
] ifFalse:[
- (ignoreCount notNil) ifTrue:[
- (ignoreCount > 0) ifTrue:[
- aStream nextPutAll:' for '.
- ignoreCount printOn:aStream.
+ ignoreUntilShiftKeyPressed == true ifTrue:[
+ aStream nextPutAll:' until shiftKey pressed'.
+ ] ifFalse:[
+ ignoreEndTime notNil ifTrue:[
+ aStream nextPutAll:' until '.
+ ignoreEndTime printOn:aStream.
] ifFalse:[
- (ignoreCount < 0) ifTrue:[
- aStream nextPutAll:' forEver'.
- ] ifFalse:[
- aStream nextPutAll:' no longer'.
- ].
+ (ignoreCount notNil) ifTrue:[
+ (ignoreCount > 0) ifTrue:[
+ aStream nextPutAll:' for '.
+ ignoreCount printOn:aStream.
+ ] ifFalse:[
+ (ignoreCount < 0) ifTrue:[
+ aStream nextPutAll:' forEver'.
+ ] ifFalse:[
+ aStream nextPutAll:' no longer'.
+ ].
+ ].
+ ]
].
- ]
+ ].
].
].
@@ -8181,6 +8306,11 @@
"some string describing why and how this halt is ignored;
nil if not ignored"
+ ^ String streamContents:[:s |
+ s nextPutAll:'ignored '.
+ self printConditionOn:s
+ ].
+
ignoreCount notNil ifTrue:[
ignoreCount > 0 ifTrue:[
^ '%1 more calls ignored' bindWith:ignoreCount
@@ -8199,6 +8329,12 @@
].
^ nil
].
+ ignoredProcesses notNil ifTrue:[
+ ^ 'ignored in some processes'
+ ].
+ ignoredReceiverClasses notNil ifTrue:[
+ ^ 'ignored for some receiver classes'
+ ].
^ 'ignored until reenabled'
@@ -8214,6 +8350,13 @@
ignoreCount notNil ifTrue:[
^ ignoreCount == -1 or:[ ignoreCount > 0 ]
].
+ ignoredProcesses notNil ifTrue:[
+ ignoredProcesses := ignoredProcesses reject:[:p | p notNil and:[p isDead]].
+ ignoredProcesses isEmpty ifTrue:[
+ ignoredProcesses := nil.
+ ^ false
+ ].
+ ].
^ true
"Created: / 06-03-2012 / 12:39:46 / cg"
@@ -8234,7 +8377,7 @@
!
isHaltIgnored
- "true if this halt should be ignored"
+ "true if this halt should be ignored (sometimes)"
ignoreUntilShiftKeyPressed == true ifTrue:[
^ Display shiftDown not
@@ -8315,7 +8458,7 @@
isActive
"true if this ignore-entry is still active"
- self method isNil ifTrue:[self halt. ^ false ]. "/ method no longer valid
+ self method isNil ifTrue:[self breakPoint:#cg. ^ false ]. "/ method no longer valid
^ super isActive
"Modified: / 06-03-2012 / 12:40:20 / cg"
@@ -8331,11 +8474,30 @@
!
isHaltIgnoredInMethod:aMethod line:line
+ ^ self isHaltIgnoredInMethod:aMethod line:line context:nil
+!
+
+isHaltIgnoredInMethod:aMethod line:line context:context
"/ Transcript show:'?same as ign '; show:(weakMethodHolder at:1); show:' at '; showCR:lineNumber.
+Transcript showCR:'-----------------------------'.
+Transcript showCR:aMethod.
+Transcript showCR:line.
+Transcript showCR:context.
(self isForMethod:aMethod line:line) ifFalse:[^ false].
"/ Transcript show:'is same; ignored: '; showCR:self isHaltIgnored.
+ context notNil ifTrue:[
+ ignoredReceiverClasses notNil ifTrue:[
+ ^ ignoredReceiverClasses includes:(context receiver class)
+ ].
+ ].
+Transcript showCR:ignoredProcesses.
+Transcript showCR:Processor activeProcess.
+ ignoredProcesses notNil ifTrue:[
+ ^ ignoredProcesses includes:(Processor activeProcess)
+ ].
+
^ self isHaltIgnored
! !
@@ -8379,11 +8541,11 @@
!DebugView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.590 2013-06-07 13:30:56 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.596 2013-06-20 23:00:24 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.590 2013-06-07 13:30:56 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.596 2013-06-20 23:00:24 cg Exp $'
!
version_HG
@@ -8392,7 +8554,7 @@
!
version_SVN
- ^ '$Id: DebugView.st,v 1.590 2013-06-07 13:30:56 stefan Exp $'
+ ^ '$Id: DebugView.st,v 1.596 2013-06-20 23:00:24 cg Exp $'
! !