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.
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"
"{ Package: 'jv:libgdbs' }"
"{ NameSpace: Smalltalk }"
GDBDebuggerObject subclass:#GDBRegisterWithValue
instanceVariableNames:'register frame value changed'
classVariableNames:''
poolDictionaries:''
category:'GDB-Core'
!
!GDBRegisterWithValue class methodsFor:'documentation'!
copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"
! !
!GDBRegisterWithValue class methodsFor:'accessing-magritte'!
descriptionContainer
^ super descriptionContainer
define: #number as: Integer;
define: #value as: String;
yourself
"Created: / 26-09-2018 / 10:38:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBRegisterWithValue methodsFor:'accessing'!
name
^ register name
"Created: / 27-09-2018 / 10:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
number
^ register isInteger ifTrue:[
register
] ifFalse:[
register number
]
"Created: / 27-09-2018 / 09:56:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
value
changed value.
^ value
"Modified: / 27-09-2018 / 15:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBRegisterWithValue methodsFor:'initialization'!
setDebugger: aGDBDebugger
super setDebugger: aGDBDebugger.
changed := GDBTransientDataHolder debugger: debugger factory: [
(frame notNil and:[frame isValid]) ifTrue:[
| changes change |
changes := frame registersChanges.
change := changes detect:[:each | each number = self number ] ifNone:[ nil ].
(change notNil and:[change value ~= value]) ifTrue:[
value := change value.
true
] ifFalse:[
false
].
] ifFalse:[
false
].
].
"Created: / 27-09-2018 / 15:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setFrame: aGDBFrame
self setDebugger: aGDBFrame debugger.
frame := aGDBFrame.
"Created: / 26-09-2018 / 22:25:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 27-09-2018 / 15:31:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setRegisterFrom: aDictionary
self assert: register isInteger.
self assert: (aDictionary includesKey: register).
register := aDictionary at: register.
"Created: / 26-09-2018 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBRegisterWithValue methodsFor:'printing & storing'!
printOn:aStream
"append a printed representation of the receiver to the argument, aStream"
super printOn:aStream.
aStream nextPut:$(.
register isInteger ifTrue:[
register printOn:aStream.
] ifFalse:[
register name printOn:aStream.
].
aStream nextPutAll: ': '.
value printOn: aStream.
aStream nextPut:$).
"Modified: / 26-09-2018 / 10:48:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBRegisterWithValue methodsFor:'private'!
_number: anInteger
register := anInteger
"Created: / 26-09-2018 / 10:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBRegisterWithValue methodsFor:'queries'!
hasChanged
"Return true, if the value of this register has changed since last
'stop', false otherwise (i.e., when unchanged)"
^ changed value
"Created: / 27-09-2018 / 16:01:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBRegisterWithValue class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !