Breakpoint.st
author Claus Gittinger <cg@exept.de>
Fri, 26 Oct 2012 11:48:52 +0200
changeset 2958 4bb6acd04cfe
parent 2894 1520aa38f2f3
child 2968 e69a084842cc
permissions -rw-r--r--
added: #compilePackage: changed: #compileClass:

"
 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:anInteger
    position := anInteger.

    "Modified (format): / 02-08-2012 / 09:26:03 / cg"
!

position:positionArg line:lineArg
    position := positionArg.
    line := lineArg.

    "Created: / 02-08-2012 / 09:26:27 / cg"
! !

!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 
            show:Timestamp now;
            showCR:(' Trace %1 [%2]' bindWith:sender methodPrintString with:self line)
    ].

    "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:10:22 / 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.9 2012-08-02 12:47:10 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libcomp/Breakpoint.st,v 1.9 2012-08-02 12:47:10 cg Exp $'
!

version_SVN
    ^ '§ Id §'
! !