GDBThread.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 17 Nov 2017 20:36:08 -0300
changeset 90 6046abc9ddf4
parent 86 7f53d51a0a65
child 91 472a4841a8b6
permissions -rw-r--r--
Replaced Squek computed arrays by more verbose `Array with:...` ...to workaround a buggy stx, sigh.
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
53
63669c2c0f9e Test fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 51
diff changeset
     3
"{ NameSpace: Smalltalk }"
63669c2c0f9e Test fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 51
diff changeset
     4
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
     5
GDBDebuggerObject subclass:#GDBThread
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
     6
	instanceVariableNames:'id group status info stack'
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'GDB-Core'
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
70
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    12
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    13
!GDBThread class methodsFor:'instance creation'!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    14
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    15
newWithDebugger: debugger id: id group: group
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    16
    ^ self new
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    17
        setDebugger: debugger;
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    18
        setId: id;
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    19
        setGroup: group;
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    20
        yourself.
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    21
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    22
    "Created: / 07-09-2014 / 21:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    23
! !
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    24
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
!GDBThread 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
    26
45
deb908479a37 Code refactored to use Magritte to meta-describe GDB objects.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 43
diff changeset
    27
description
deb908479a37 Code refactored to use Magritte to meta-describe GDB objects.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 43
diff changeset
    28
    ^ (super description)
deb908479a37 Code refactored to use Magritte to meta-describe GDB objects.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 43
diff changeset
    29
        define:#id as:Integer;
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
        yourself
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
    "Created: / 06-09-2014 / 02:21:07 / 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
    33
! !
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    35
!GDBThread methodsFor:'accessing'!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    36
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
    37
group
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
    38
    ^ group
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
    39
!
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
    40
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    41
id
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    42
    ^ id
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    43
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
    44
    "Created: / 07-09-2014 / 22:41:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    45
!
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    46
70
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    47
name
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    48
    ^ self targetId
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    49
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    50
    "Created: / 10-03-2015 / 00:32:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    51
!
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    52
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    53
stack
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    54
    self ensureIsStopped.
40
0ce76b671515 Some more support for stack frames.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    55
    stack isNil ifTrue:[
41
fb48207b6104 Fixes in thread's stack mangement. Dispatch events to applications using their UI event loop.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 40
diff changeset
    56
        stack := GDBTransientDataHolder debugger: debugger factory:[ 
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
    57
            | result depth frames |
90
6046abc9ddf4 Replaced Squek computed arrays by more verbose `Array with:...`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    58
            result := debugger send: (GDBMI_stack_info_depth new arguments: (Array with: '--thread' with: id with: 100)).
41
fb48207b6104 Fixes in thread's stack mangement. Dispatch events to applications using their UI event loop.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 40
diff changeset
    59
            depth := result propertyAt: #depth.
90
6046abc9ddf4 Replaced Squek computed arrays by more verbose `Array with:...`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    60
            result := debugger send: (GDBMI_stack_list_frames new arguments: (Array with:  '--thread' with: id with: 0 with: depth - 1 )).
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
    61
            frames := result propertyAt: #stack.
55
437ee6413c74 Initial support for variables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 53
diff changeset
    62
            frames do:[:each | 
437ee6413c74 Initial support for variables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 53
diff changeset
    63
                each debugger: debugger.
437ee6413c74 Initial support for variables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 53
diff changeset
    64
                each propertyAt: #thread put: self 
437ee6413c74 Initial support for variables
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 53
diff changeset
    65
            ].
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
    66
            frames
41
fb48207b6104 Fixes in thread's stack mangement. Dispatch events to applications using their UI event loop.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 40
diff changeset
    67
        ].
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    68
    ].
41
fb48207b6104 Fixes in thread's stack mangement. Dispatch events to applications using their UI event loop.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 40
diff changeset
    69
    ^ stack value
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    70
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    71
    "Created: / 09-09-2014 / 00:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
90
6046abc9ddf4 Replaced Squek computed arrays by more verbose `Array with:...`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    72
    "Modified: / 17-11-2017 / 20:21:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    73
!
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    74
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
    75
status
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    76
    status isUnknown ifTrue:[ 
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    77
        status := self info state
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    78
    ].
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    79
    ^ status
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    80
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    81
    "Modified: / 12-07-2017 / 13:36:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
70
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    82
!
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    83
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    84
targetId
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    85
    ^ self info targetId
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    86
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
    87
    "Created: / 10-03-2015 / 00:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    88
! !
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    89
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    90
!GDBThread methodsFor:'accessing-private'!
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    91
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    92
info
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    93
    info isNil ifTrue:[
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    94
        info := GDBTransientDataHolder debugger: debugger factory:[ 
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    95
            | result infos |
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    96
90
6046abc9ddf4 Replaced Squek computed arrays by more verbose `Array with:...`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    97
            result := debugger send: (GDBMI_thread_info new arguments: (Array with: id)).
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    98
            infos := result propertyAt: #threads.
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
    99
            self assert: (infos isEmptyOrNil or:[ infos size == 1 and:[ infos first id = id ] ]).
72
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 70
diff changeset
   100
            infos isEmptyOrNil 
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 70
diff changeset
   101
                ifTrue:[ GDBThreadInfo new setId: id state: GDBThreadStateTerminated theOneAndOnlyInstance ] 
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 70
diff changeset
   102
                ifFalse:[ infos first ]
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   103
        ].
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   104
    ].
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   105
    ^ info value
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   106
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   107
    "Created: / 08-03-2015 / 09:07:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
90
6046abc9ddf4 Replaced Squek computed arrays by more verbose `Array with:...`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   108
    "Modified: / 17-11-2017 / 20:21:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   109
! !
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   110
70
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   111
!GDBThread methodsFor:'displaying'!
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   112
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   113
displayString
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   114
    ^ '%1 [%2]' bindWith: self name with: self status
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   115
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   116
    "Created: / 10-03-2015 / 00:32:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   117
! !
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   118
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   119
!GDBThread methodsFor:'event handling'!
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   120
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   121
onRunningEvent: aGDBRunningEvent
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   122
    self assert: (aGDBRunningEvent threads includesIdentical: self).
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   123
    status := GDBThreadStateRunning theOneAndOnlyInstance.
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   124
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   125
    "Created: / 12-07-2017 / 13:50:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   126
!
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   127
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   128
onStoppedEvent: aGDBStoppedEvent
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   129
    self assert: (aGDBStoppedEvent threads includesIdentical: self).
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   130
    status := GDBThreadStateStopped theOneAndOnlyInstance.
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   131
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   132
    "Created: / 12-07-2017 / 13:50:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   133
! !
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   134
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   135
!GDBThread methodsFor:'initialization'!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   136
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   137
setGroup: aGDBThreadGroup
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   138
    self assert: group isNil.
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   139
    group := aGDBThreadGroup.
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   140
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   141
    "Created: / 07-09-2014 / 21:32:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   142
!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   143
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   144
setId: tid
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   145
    self assert: id isNil.
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   146
    id := tid.
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   147
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   148
    "Created: / 07-09-2014 / 21:31:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   149
    "Modified: / 08-03-2015 / 09:08:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   150
!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   151
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   152
setStatus: aGDBThreadState
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   153
    status := aGDBThreadState
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   154
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   155
    "Created: / 12-07-2017 / 13:43:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   156
!
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   157
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   158
setTerminated
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   159
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   160
    "Created: / 07-09-2014 / 21:37:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   161
    "Modified: / 08-03-2015 / 09:08:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   162
! !
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   163
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   164
!GDBThread methodsFor:'printing & storing'!
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   165
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   166
printOn:aStream
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   167
    "append a printed representation if the receiver to the argument, aStream"
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   168
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   169
    aStream nextPutAll:'thread  '.
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   170
    id printOn:aStream.
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   171
"/    aStream nextPutAll:'in group '.
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   172
"/    group id printOn:aStream.
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   173
    aStream nextPutAll:' ['.
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   174
    self status printOn:aStream.
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   175
    aStream nextPutAll:']'.
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   176
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   177
    "Modified: / 08-03-2015 / 09:07:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   178
! !
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   179
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   180
!GDBThread methodsFor:'private'!
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   181
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   182
ensureIsStopped
40
0ce76b671515 Some more support for stack frames.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
   183
    self isStopped ifFalse:[
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   184
        (GDBInvalidObject newException)
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   185
            parameter:self;
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   186
            messageText:'Invalid state (thread is running or already dead)';
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   187
            raise.
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   188
    ].
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   189
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   190
    "Created: / 09-09-2014 / 00:04:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
40
0ce76b671515 Some more support for stack frames.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
   191
    "Modified: / 16-09-2014 / 23:51:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   192
! !
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   193
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   194
!GDBThread methodsFor:'testing'!
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   195
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   196
isDead
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   197
    ^ self status isTerminated
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   198
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   199
    "Created: / 22-09-2014 / 00:54:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   200
    "Modified: / 08-03-2015 / 12:35:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
43
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   201
!
22236b6d1d9a Remove threads from thread group when threadgroup terminates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 41
diff changeset
   202
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   203
isRunning
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   204
    ^ self status isRunning
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   205
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   206
    "Created: / 07-09-2014 / 23:23:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   207
    "Modified: / 08-03-2015 / 09:08:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   208
!
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   209
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   210
isStopped
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   211
    ^ self status isStopped
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   212
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   213
    "Created: / 07-09-2014 / 23:23:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   214
    "Modified: / 08-03-2015 / 09:08:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   215
!
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   216
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   217
isTerminated
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   218
    ^ self status isTerminated
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   219
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   220
    "Created: / 07-09-2014 / 23:23:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
67
c4ac76afe03d Keep thread information in transient thread-info object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 55
diff changeset
   221
    "Modified: / 08-03-2015 / 09:08:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   222
! !
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   223
70
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   224
!GDBThread class methodsFor:'documentation'!
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   225
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   226
version_HG
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   227
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   228
    ^ '$Changeset: <not expanded> $'
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   229
! !
6d7285bb1703 GDBThread: use native name in thread's displayString
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 67
diff changeset
   230