GDBDebuggerObject.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 28 Jan 2019 14:56:14 +0000
changeset 173 02546d4fbe6d
parent 111 7ce18f6f18ac
child 175 a04e1a36e888
permissions -rw-r--r--
Fix frame of `GDBThreadSelectedEvent` if inferior is running When ifnferior is running at time we get `=thread-selected` event, we should at least make that frame kind of usable by fixing up it's debugger and thread. This allow clients to use (to some extent) event's frame without worring (too much) about these details.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     1
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     4
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     5
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     7
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     8
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
     9
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    10
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    13
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    14
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    16
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    18
"
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'jv:libgdbs' }"
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
78
c24e7d8bc881 BUpdated build files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 51
diff changeset
    21
"{ NameSpace: Smalltalk }"
c24e7d8bc881 BUpdated build files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 51
diff changeset
    22
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
GDBObject subclass:#GDBDebuggerObject
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	instanceVariableNames:'debugger'
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
	classVariableNames:''
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	poolDictionaries:''
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	category:'GDB-Core'
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    30
!GDBDebuggerObject class methodsFor:'documentation'!
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    31
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    32
copyright
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    33
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    34
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    35
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    36
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    37
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    38
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    39
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    40
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    41
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    42
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    43
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    44
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    45
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    46
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    47
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    48
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    49
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    50
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    51
! !
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
    52
51
2fa20404923c Introduced GDBThreadGroupType.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    53
!GDBDebuggerObject class methodsFor:'testing'!
2fa20404923c Introduced GDBThreadGroupType.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    54
2fa20404923c Introduced GDBThreadGroupType.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    55
isAbstract
2fa20404923c Introduced GDBThreadGroupType.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    56
    ^ self == GDBDebuggerObject
2fa20404923c Introduced GDBThreadGroupType.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    57
! !
2fa20404923c Introduced GDBThreadGroupType.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 39
diff changeset
    58
39
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
    59
!GDBDebuggerObject methodsFor:'accessing'!
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
    60
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
    61
debugger
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
    62
    ^ debugger
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
    63
! !
2b9d2f75906f Some work on execution stack model
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
    64
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    65
!GDBDebuggerObject methodsFor:'initialization & release'!
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
setDebugger: aGDBDebugger
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    68
    self assert: (debugger isNil or:[ aGDBDebugger isNil ]).
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    debugger := aGDBDebugger
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
    "Created: / 07-09-2014 / 21:17:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    72
    "Modified: / 10-07-2017 / 12:57:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
! !
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    75
!GDBDebuggerObject methodsFor:'private'!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    76
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    77
ensureIsValid
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    78
    self isValid ifFalse:[
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
    79
        (GDBInvalidObjectError newException)
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    80
            parameter:self;
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    81
            messageText:'Object is no longer valid';
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    82
            raise.
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    83
    ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    84
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    85
    "Created: / 04-02-2018 / 21:27:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    86
! !
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    87
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    88
!GDBDebuggerObject methodsFor:'testing'!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    89
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    90
isValid
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    91
    "Return `true`, if the object is still `valid`, false otherwise. For example,
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    92
     a `GDBFrame` instance may become invalid when the frame is unwound and no
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    93
     longer exist."
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    94
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    95
    ^ self subclassResponsibility
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    96
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    97
    "Created: / 04-02-2018 / 21:24:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    98
! !
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    99
95
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   100
!GDBDebuggerObject class methodsFor:'documentation'!
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   101
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   102
version_HG
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   103
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   104
    ^ '$Changeset: <not expanded> $'
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   105
! !
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   106