GDBThread.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 08 Sep 2014 10:02:31 +0100
changeset 37 a85f0c91f164
parent 36 095c4b0b74d3
child 39 2b9d2f75906f
permissions -rw-r--r--
Some more work on threads (thread status)

"{ Package: 'jv:libgdbs' }"

GDBDebuggerObject subclass:#GDBThread
	instanceVariableNames:'id group status'
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Core'
!

!GDBThread class methodsFor:'instance creation'!

newWithDebugger: debugger id: id group: group
    ^ self new
        setDebugger: debugger;
        setId: id;
        setGroup: group;
        yourself.

    "Created: / 07-09-2014 / 21:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBThread class methodsFor:'accessing - GDB value descriptors'!

gdbValueDescriptor
    ^ (super gdbValueDescriptor)
        define: #id as: Integer;
        yourself

    "Created: / 06-09-2014 / 02:21:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBThread methodsFor:'accessing'!

id
    ^ id

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

!GDBThread methodsFor:'initialization'!

setGroup: aGDBThreadGroup
    self assert: group isNil.
    group := aGDBThreadGroup.

    "Created: / 07-09-2014 / 21:32:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

setId: tid
    self assert: id isNil.
    id := tid.
    status := GDBThreadStatusRunning theOneAndOnlyInstance

    "Created: / 07-09-2014 / 21:31:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 07-09-2014 / 23:27:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

setStatus: aGDBThreadStatus
    status := aGDBThreadStatus

    "Created: / 07-09-2014 / 23:25:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

setTerminated
    status := GDBThreadStatusTerminated theOneAndOnlyInstance

    "Created: / 07-09-2014 / 21:37:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 07-09-2014 / 23:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBThread methodsFor:'testing'!

isRunning
    ^ status isRunning

    "Created: / 07-09-2014 / 23:23:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isStopped
    ^ status isStopped

    "Created: / 07-09-2014 / 23:23:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isTerminated
    ^ status isTerminated

    "Created: / 07-09-2014 / 23:23:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !