GDBThreadGroup.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 07 Sep 2014 14:42:02 +0100
changeset 35 c17ecf90e446
child 36 095c4b0b74d3
permissions -rw-r--r--
Initial support for thread groups, threads and breakpoints.

"{ Package: 'jv:libgdbs' }"

GDBObject subclass:#GDBThreadGroup
	instanceVariableNames:'id pid exit_code threads'
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Core'
!

!GDBThreadGroup class methodsFor:'instance creation'!

newWithId: aString
    ^ self new setId: aString; yourself

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

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

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

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

!GDBThreadGroup methodsFor:'accessing'!

exitCode
    ^ exit_code

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

id
    ^ id
!

pid
    ^ pid
!

threads
    threads isNil ifTrue:[ 
        threads := List new.
    ].
    ^ threads

    "Modified: / 06-09-2014 / 02:23:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBThreadGroup methodsFor:'initialization'!

setExitCode: anInteger
    exit_code := anInteger.

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

setId: aString
    id := aString.

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

setPid: anInteger
    pid := anInteger.
    exit_code := nil.

    "Created: / 06-09-2014 / 02:32:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 07-09-2014 / 12:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBThreadGroup methodsFor:'private'!

threadAdd: aGDBThread
    self threads add: aGDBThread

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

threadRemove: aGDBThread
    self threads remove: aGDBThread

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

!GDBThreadGroup methodsFor:'testing'!

isDead
    ^ exit_code notNil

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

isRunning
    ^ pid notNil and: [ exit_code isNil ].

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