BreakpointDescription.st
author Claus Gittinger <cg@exept.de>
Sat, 08 Jun 2019 19:13:07 +0200
changeset 4441 a834368786b5
parent 4360 023577f390b9
child 4723 524785227024
permissions -rw-r--r--
#FEATURE by cg class: Scanner changed: #invalidCharacter: #nextIdentifier

"{ Encoding: utf8 }"

"{ Package: 'stx:libcomp' }"

"{ NameSpace: Smalltalk }"

Object subclass:#BreakpointDescription
	instanceVariableNames:'state condition icon'
	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:aBlockCheckingItsContextArg
    condition := aBlockCheckingItsContextArg.

    "Modified (format): / 20-02-2019 / 10:58:54 / Claus Gittinger"
! !

!BreakpointDescription methodsFor:'initialization'!

initialize
    "Invoked when a new instance is created."

    "/ state is one of #hidden, #enabled, #tracing, #deleted, #disabled
    state := #enabled

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

    "Modified: / 17-06-2011 / 13:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (comment): / 20-02-2019 / 10:56:18 / Claus Gittinger"
! !

!BreakpointDescription methodsFor:'support'!

beInvisible
    state := #hidden.
!

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:aContext]

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

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

    ^ condition isNil or:[condition value:aContext]

    "Created: / 27-01-2012 / 13:41:58 / cg"
    "Modified: / 20-02-2019 / 10:57:14 / Claus Gittinger"
!

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 or:[ state == #tracing ]

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

isTracepoint
    ^ condition isNil and:[state == #tracing]
!

isVisible
    "Bad coding here, state should be full object"

    ^state ~~ #hidden
! !

!BreakpointDescription class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !