"{ Encoding: utf8 }"
"{ Package: 'jv:libgdbs' }"
"{ NameSpace: Smalltalk }"
GDBDebuggerObject subclass:#GDBThreadGroup
instanceVariableNames:'id type executable pid exit_code threads'
classVariableNames:''
poolDictionaries:''
category:'GDB-Core'
!
!GDBThreadGroup class methodsFor:'instance creation'!
newWithDebugger: debugger id: aString
^ self new setDebugger: debugger; setId: aString; yourself
"Created: / 07-09-2014 / 21:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBThreadGroup class methodsFor:'accessing - GDB value descriptors'!
description
^ (super description)
define:#id as:String;
define:#pid as:Integer;
yourself.
"
self description
"
"Created: / 06-09-2014 / 02:21:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (comment): / 01-10-2014 / 01:29:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
descriptionType
^ Magritte::MASingleOptionDescription new
optionsAndLabels: {
GDBThreadGroupTypeProcess -> 'process'
};
accessor: (GDBMAPropertyAccessor forPropertyNamed: 'type');
label: 'type';
description: 'The type of the thread group. At present, only ‘process’ is a valid type.';
yourself.
"Created: / 01-10-2014 / 01:29:13 / 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
!
threadWithId: tid
^ threads ? #() detect:[:e | e isDead not and:[ e id = tid ] ] ifNone:[
self error: ('No thread with id ''%1'' found!!' bindWith: tid)
].
"Created: / 07-09-2014 / 21:37:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 22-09-2014 / 01:23:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
threads
threads isNil ifTrue:[
threads := List new.
].
^ threads
"Modified: / 06-09-2014 / 02:23:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 07-09-2014 / 21:42:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
type
^ type
! !
!GDBThreadGroup methodsFor:'event handling'!
onThreadCreatedEvent:aGDBThreadCreatedEvent
| thread |
threads isNil ifTrue:[
threads := List new.
].
thread := GDBThread
newWithDebugger:debugger
id:aGDBThreadCreatedEvent threadId
group:self.
threads add:thread.
aGDBThreadCreatedEvent setThread:thread.
"Created: / 07-09-2014 / 21:25:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
onThreadExitedEvent:aGDBThreadExitedEvent
| thread |
thread := self threadWithId:aGDBThreadExitedEvent threadId.
thread setTerminated.
aGDBThreadExitedEvent setThread:thread.
"Created: / 07-09-2014 / 21:25:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 22-09-2014 / 00:50:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBThreadGroup methodsFor:'initialization'!
setExitCode: anInteger
exit_code := anInteger.
threads removeAll
"Created: / 06-09-2014 / 02:33:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 22-09-2014 / 01:23:59 / 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:'printing & storing'!
printOn:aStream
"append a printed representation if the receiver to the argument, aStream"
super printOn: aStream.
aStream nextPutAll:'(id '.
id printOn:aStream.
aStream nextPutAll:', pid '.
pid printOn:aStream.
aStream nextPutAll:')'.
"Modified: / 02-03-2015 / 07:10:31 / 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 ] and:[ self isStopped not ]
"Created: / 06-09-2014 / 02:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 30-09-2014 / 00:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isStopped
^ threads notEmptyOrNil and:[ threads anySatisfy: [:t | t isStopped ] ].
"Created: / 30-09-2014 / 00:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBThreadGroup class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !