GDBTransientDataHolder.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 10 Mar 2015 09:07:27 +0000
changeset 68 633494860f35
parent 41 fb48207b6104
child 91 472a4841a8b6
permissions -rw-r--r--
Fix in transient data holder: remember the last sequence number Due to this bug the factory was evaluated every time a holder's value has been read. The reading routine (#value) must remember the current sequence number when a factory is called in order to properly cache data.

"{ Package: 'jv:libgdbs' }"

"{ NameSpace: Smalltalk }"

Object subclass:#GDBTransientDataHolder
	instanceVariableNames:'debugger factory value seqno'
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Private'
!


!GDBTransientDataHolder class methodsFor:'instance creation'!

debugger: aGDBDebugger factory: aBlock
    ^ self new setDebugger: aGDBDebugger factory: aBlock

    "Created: / 17-09-2014 / 22:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBTransientDataHolder methodsFor:'accessing'!

value
    (value notNil and:[debugger currentInferiorStateSequnceNumber == seqno]) ifTrue:[ 
        ^ value.
    ].
    seqno := debugger currentInferiorStateSequnceNumber.
    value := factory value.
    ^ value

    "Created: / 17-09-2014 / 22:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 10-03-2015 / 00:18:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBTransientDataHolder methodsFor:'initialization'!

setDebugger: aGDBDebugger factory: aBlock
    debugger := aGDBDebugger.
    factory := aBlock.

    "Created: / 17-09-2014 / 22:08:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBTransientDataHolder class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !