Breakpoint.st
author Claus Gittinger <cg@exept.de>
Fri, 27 Jan 2012 14:00:42 +0100
changeset 2795 69ab29839a96
parent 2792 41047dab5b11
child 2797 8236426dfe4e
permissions -rw-r--r--
tracing (shift-click in gutter)

"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libcomp' }"

Object subclass:#Breakpoint
	instanceVariableNames:'position description line isReached'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Compiler-Debugging'
!

!Breakpoint class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!Breakpoint class methodsFor:'instance creation'!

new
    "return an initialized instance"

    ^ self basicNew initialize.
! !

!Breakpoint methodsFor:'accessing'!

description
    ^ description
!

description:aBreakpointDescription
    description := aBreakpointDescription.
!

isReached
    ^ isReached
!

isReached:aBoolean
    isReached := aBoolean.
!

line
    ^ line
!

line:anInteger
    line := anInteger.
!

position
    ^ position
!

position:something
    position := something.
! !

!Breakpoint methodsFor:'initialization'!

initialize
    "Invoked when a new instance is created."

    "/ please change as required (and remove this comment)
    "/ method := nil.
    "/ position := nil.
    description := BreakpointDescription new.
    "/ line := nil.

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

    "Modified: / 11-07-2011 / 18:19:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Breakpoint methodsFor:'printing & storing'!

printOn:aStream
    "append a printed representation if the receiver to the argument, aStream"

    aStream
        nextPutAll: 'BPNT';
        nextPut:    $(;
        nextPutAll: position printString;
        nextPut:    $).

    "Modified: / 16-06-2011 / 14:48:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Breakpoint methodsFor:'support'!

beTracepoint
    "make this breakpoint a tracepoint"

    description beTracepoint

    "Created: / 27-01-2012 / 13:56:11 / cg"
!

break
    "invoked by the breakPoint's code (see BreakPointNode)"

    <resource: #skipInDebuggersWalkBack>

    |sender|

    sender := thisContext sender.
    (description shouldBreakIn: sender) ifTrue:[
        BreakPointInterrupt
            raiseRequestWith: self
            errorString:('Breakpoint encountered at line %1' bindWith:self line)
            in:sender.
    ].
    (description shouldTraceIn: sender) ifTrue:[
        Transcript showCR:('Trace line %1 in %2' bindWith:self line with:sender methodPrintString)
    ].

    "Created: / 15-06-2011 / 12:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 11-07-2011 / 18:17:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 27-01-2012 / 14:00:18 / cg"
!

toggle
    "toggle this breakpoint"

    description toggle

    "Created: / 17-06-2011 / 13:40:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 11-07-2011 / 18:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (comment): / 27-01-2012 / 10:41:03 / cg"
!

toggleTracing
    "toggle this breakpoint"

    description toggleTracing

    "Created: / 27-01-2012 / 13:56:05 / cg"
! !

!Breakpoint methodsFor:'testing'!

isEnabled

    "Bad coding here, state should be full object"

    ^description isEnabled

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

!Breakpoint class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libcomp/Breakpoint.st,v 1.7 2012-01-27 13:00:42 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libcomp/Breakpoint.st,v 1.7 2012-01-27 13:00:42 cg Exp $'
!

version_SVN
    ^ '§ Id §'
! !