changed:
#moveBreakpointsAfterLine:by:
#recompile
#setOrToggleBreakpointAtLine:
generate instances of MethodWithBreakpoints...
--- a/Tools__BreakpointService.st Thu Aug 02 14:46:10 2012 +0200
+++ b/Tools__BreakpointService.st Thu Aug 02 14:47:48 2012 +0200
@@ -167,87 +167,90 @@
!
moveBreakpointsAfterLine:line by: delta
-
|pos |
-
breakpoints do:[:bpnt|
- bpnt line >= line ifTrue:[
- pos := textView characterPositionOfLine:bpnt line + delta col:1.
- bpnt line: bpnt line + delta; position: pos
- ]
+ bpnt line >= line ifTrue:[
+ pos := textView characterPositionOfLine:bpnt line + delta col:1.
+ bpnt position:pos line:(bpnt line + delta).
+ ]
].
"/gutterView redrawLinesFrom: line.
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 05-07-2011 / 21:32:49 / cg"
"Created: / 06-07-2011 / 17:26:30 / jv"
+ "Modified: / 02-08-2012 / 09:27:10 / cg"
!
recompile
"recompile the current method for changed breakpoints"
- |method newMethod compiler class selector|
+ |oldMethod newMethod compiler class selector|
- method := codeView methodHolder value.
- (method notNil and:[method hasPrimitiveCode not]) ifTrue:[
- "/ be careful: if the text has been edited/modified, do not compile
- textView modified ifTrue:[
- self breakPoint: #cg.
- self breakPoint: #jv.
- ^self.
- ] ifFalse:[
- "/ prepare to get reachable bpts
- breakpoints do:[:bp | bp isReached:false].
+ oldMethod := codeView methodHolder value.
+ (oldMethod notNil and:[oldMethod hasPrimitiveCode not]) ifTrue:[
+ "/ be careful: if the text has been edited/modified, do not compile
+ textView modified ifTrue:[
+ self breakPoint: #cg.
+ self breakPoint: #jv.
+ ^self.
+ ] ifFalse:[
+ "/ prepare to get reachable bpts
+ breakpoints do:[:bp | bp isReached:false].
+
+ class := oldMethod mclass.
+ class isNil ifTrue:[
+ class := codeView classHolder value.
+ ].
+ selector := oldMethod selector.
- class := method mclass.
- class isNil ifTrue:[
- class := codeView classHolder value.
- ].
- selector := method selector.
- Class withoutUpdatingChangesDo:[
- compiler := ByteCodeCompilerWithBreakpointSupport new.
- compiler breakpoints:breakpoints.
- newMethod := compiler
- compile:method source
- forClass:class
- inCategory:method category
- notifying:nil
- install:false
- skipIfSame:false
- silent:true
- foldConstants:true
- ifFail:[ self halt ].
- selector isNil ifTrue:[
- "/May happen as the selector is not stored in the method but
- "/searches through method's mclass methodDictionary.
- "/Following should be save as breakpoint is not installed when
- "/the code is modified...
- selector := compiler selector.
- ].
+ Class withoutUpdatingChangesDo:[
+ compiler := ByteCodeCompilerWithBreakpointSupport new.
+ compiler breakpoints:breakpoints.
+ compiler methodClass:MethodWithBreakpoints.
+ newMethod := compiler
+ compile:oldMethod source
+ forClass:class
+ inCategory:oldMethod category
+ notifying:nil
+ install:false
+ skipIfSame:false
+ silent:true
+ foldConstants:true
+ ifFail:[ Transcript showCR:'failed to recompile for breakpoint' ].
+ newMethod originalMethod: oldMethod.
- (class primAddSelector: selector withMethod:newMethod) ifFalse:[
- self breakPoint: #cg.
- self breakPoint: #jv.
- ^ self
- ].
- codeView methodHolder value:newMethod.
- method mclass isNil ifTrue:[
- method mclass:class.
- ].
- ].
+ selector isNil ifTrue:[
+ "/ May happen as the selector is not stored in the method but
+ "/ searches through method's mclass methodDictionary.
+ "/ Following should be save as breakpoint is not installed when
+ "/ the code is modified...
+ selector := compiler selector.
+ ].
+
+ (class primAddSelector: selector withMethod:newMethod) ifFalse:[
+ self breakPoint: #cg.
+ self breakPoint: #jv.
+ ^ self
+ ].
+ codeView methodHolder value:newMethod.
+ oldMethod mclass isNil ifTrue:[
+ oldMethod mclass:class.
+ ].
+ ].
"/ self halt.
- breakpoints := breakpoints
- select:[:bp |
- bp isReached ifFalse:[ Transcript show:'remove unreached:'; showCR:bp ].
- bp isReached
- ]
- ]
+ breakpoints := breakpoints
+ select:[:bp |
+ bp isReached ifFalse:[ Transcript show:'remove unreached:'; showCR:bp ].
+ bp isReached
+ ]
+ ]
]
"Created: / 05-07-2011 / 21:33:13 / cg"
"Modified: / 18-07-2012 / 10:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-08-2012 / 09:35:41 / cg"
!
setOrToggleBreakpointAtLine:line
@@ -256,28 +259,26 @@
pos := textView characterPositionOfLine:line col:1.
bpnt := self breakpointAtLine:line.
bpnt isNil ifTrue:[
- (codeView topView class ~~ DebugView) ifTrue:[
- breakpoints add:((bpnt := Breakpoint new)
- position:pos;
- line:line).
- Display shiftDown ifTrue:[
- "/ trace
- bpnt beTracepoint
- ].
- self recompile.
- ].
+ (codeView topView class ~~ DebugView) ifTrue:[
+ breakpoints add:((bpnt := Breakpoint new) position:pos line:line).
+ Display shiftDown ifTrue:[
+ "/ trace
+ bpnt beTracepoint
+ ].
+ self recompile.
+ ].
] ifFalse:[
- Display shiftDown ifTrue:[
- bpnt toggleTracing
- ] ifFalse:[
- bpnt toggle.
- ]
+ Display shiftDown ifTrue:[
+ bpnt toggleTracing
+ ] ifFalse:[
+ bpnt toggle.
+ ]
].
gutterView redrawLine:line.
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 27-07-2011 / 13:27:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-01-2012 / 13:55:12 / cg"
+ "Modified: / 02-08-2012 / 09:26:38 / cg"
! !
!BreakpointService methodsFor:'redrawing'!
@@ -317,7 +318,7 @@
!BreakpointService class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.15 2012-07-18 17:06:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.16 2012-08-02 12:47:48 cg Exp $'
!