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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'jv:libgdbs' }"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
GDBObject subclass:#GDBThreadGroup
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
	instanceVariableNames:'id pid exit_code threads'
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
	classVariableNames:''
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	poolDictionaries:''
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	category:'GDB-Core'
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!GDBThreadGroup class methodsFor:'instance creation'!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
newWithId: aString
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
    ^ self new setId: aString; yourself
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
    "Created: / 06-09-2014 / 02:31:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
! !
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
!GDBThreadGroup class methodsFor:'accessing - GDB value descriptors'!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
gdbValueDescriptor
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
    ^ (super gdbValueDescriptor)
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
        define: #id as: String;
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
        define: #pid as: Integer;
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
        yourself
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    "Created: / 06-09-2014 / 02:21:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
! !
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
!GDBThreadGroup methodsFor:'accessing'!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
exitCode
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
    ^ exit_code
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
    "Created: / 07-09-2014 / 12:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
id
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    ^ id
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
pid
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
    ^ pid
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
threads
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    threads isNil ifTrue:[ 
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
        threads := List new.
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    ].
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
    ^ threads
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
    "Modified: / 06-09-2014 / 02:23:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
! !
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
!GDBThreadGroup methodsFor:'initialization'!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
setExitCode: anInteger
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    exit_code := anInteger.
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
    "Created: / 06-09-2014 / 02:33:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
setId: aString
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
    id := aString.
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
    "Created: / 06-09-2014 / 02:32:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
setPid: anInteger
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    pid := anInteger.
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
    exit_code := nil.
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
    "Created: / 06-09-2014 / 02:32:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
    "Modified: / 07-09-2014 / 12:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
! !
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
!GDBThreadGroup methodsFor:'private'!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
threadAdd: aGDBThread
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    self threads add: aGDBThread
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    "Created: / 06-09-2014 / 02:23:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
threadRemove: aGDBThread
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    self threads remove: aGDBThread
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    "Created: / 06-09-2014 / 02:23:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
! !
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
!GDBThreadGroup methodsFor:'testing'!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
isDead
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
    ^ exit_code notNil
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
    "Created: / 06-09-2014 / 02:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
isRunning
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
    ^ pid notNil and: [ exit_code isNil ].
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
    "Created: / 06-09-2014 / 02:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
! !
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103