BreakpointDescription.st
author Stefan Vogel <sv@exept.de>
Fri, 10 May 2013 15:35:10 +0200
changeset 3164 f11d0862c65e
parent 3113 4d7936f562c2
child 3197 fe2be038af11
permissions -rw-r--r--
Emit #lineno16 byte codes only, if line number really changes

"{ Package: 'stx:libcomp' }"

Object subclass:#BreakpointDescription
	instanceVariableNames:'state condition'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Compiler-Debugging'
!

!BreakpointDescription class methodsFor:'documentation'!

documentation
"
    I describe a breakpoint: its state (enabled/disabled),
    condition, etc.

    I may be shared by multiple instances of Breakpoint,
    since there may be multiple version of same method
    with breakpoints on different position but representing
    the same logical breakpoint (the one set by the user).

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!BreakpointDescription class methodsFor:'instance creation'!

new
    "return an initialized instance"

    ^ self basicNew initialize.
! !

!BreakpointDescription methodsFor:'accessing'!

condition
    ^ condition
!

condition:something
    condition := something.
! !

!BreakpointDescription methodsFor:'initialization'!

initialize
    "Invoked when a new instance is created."

    "/ please change as required (and remove this comment)
    "/ method := nil.
    "/ position := nil.
    "/ condition := nil.
    state := #enabled
    "/ line := nil.

    "/ super initialize.   -- commented since inherited method does nothing

    "Modified: / 17-06-2011 / 13:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BreakpointDescription methodsFor:'support'!

beTracepoint
    state := #tracing.

    "Created: / 27-01-2012 / 13:55:20 / cg"
!

disable
    state == #deleted ifTrue:[^self].

    state := #disabled.
!

shouldBreakIn: aContext
    state ~~ #enabled ifTrue:[^false].

    ^ condition isNil or:[condition value: thisContext sender]

    "Created: / 11-07-2011 / 18:16:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 27-01-2012 / 13:42:28 / cg"
!

shouldTraceIn: aContext
    state ~~ #tracing ifTrue:[^false].

    ^ condition isNil or:[condition value: thisContext sender]

    "Created: / 27-01-2012 / 13:41:58 / cg"
!

toggle
    state == #deleted ifTrue:[^self].

    (state == #enabled) ifTrue:[
        state := #disabled.
    ] ifFalse:[
        state := #enabled
    ].

    "Created: / 17-06-2011 / 13:40:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 27-01-2012 / 13:52:54 / cg"
!

toggleTracing
    state == #deleted ifTrue:[^self].

    (state == #tracing) ifTrue:[ 
        state := #disabled 
    ] ifFalse:[
        state := #tracing.
    ].

    "Created: / 27-01-2012 / 13:52:41 / cg"
! !

!BreakpointDescription methodsFor:'testing'!

isEnabled

    "Bad coding here, state should be full object"

    ^state == #enabled

    "Created: / 28-06-2011 / 08:27:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!BreakpointDescription class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libcomp/BreakpointDescription.st,v 1.8 2013-04-15 15:36:53 vrany Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libcomp/BreakpointDescription.st,v 1.8 2013-04-15 15:36:53 vrany Exp $'
! !