Variable objects: preserve the identity of `GDBFrame` and `GDBVariable` objects
...across running / stopped cycle. This means that if given frame
remains on the stack between top stops of a program, the `GDBFrame`
instance that represents it would be the same (identical).
"
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:#GDBFrame
instanceVariableNames:'thread level addr func file fullname line from variables'
classVariableNames:''
poolDictionaries:''
category:'GDB-Core'
!
!GDBFrame 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
"
! !
!GDBFrame class methodsFor:'accessing - GDB value descriptors'!
description
^ (super description)
define:#level as:Integer;
define:#func as:String;
define:#file as:String;
define:#fullname as:String;
define:#line as:Integer;
define:#from as:String;
define:#addr as:Integer;
yourself
"Created: / 16-09-2014 / 23:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 15-02-2018 / 08:27:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBFrame methodsFor:'accessing'!
addr
^ addr
!
file
"Return filename containing frame's function source."
^ fullname notNil ifTrue:[ fullname ] ifFalse:[ file ]
"Modified: / 11-06-2017 / 20:59:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
from
^ from
!
fullname
^ fullname
!
func
^ func
!
level
^ level
!
line
^ line
!
thread
^ thread
!
variables
self ensureIsValid.
variables isNil ifTrue:[
variables := GDBTransientDataHolder debugger: debugger factory:[
| result |
result := debugger send: (GDBMI_stack_list_variables new arguments: (Array with: '--thread' with: thread id with: '--frame' with: level with: '--simple-values')).
(result propertyAt: #variables) ? #()
do:[ :each | each setFrame: self ];
yourself
].
].
^ variables value
"Created: / 27-02-2015 / 14:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 17-11-2017 / 20:22:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBFrame methodsFor:'initialization'!
setAddr: aString
addr := aString
"Created: / 31-01-2018 / 09:50:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setLevel: anInteger
level := anInteger
"Created: / 15-02-2018 / 08:34:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setLine: anInteger
line := anInteger
"Created: / 01-02-2018 / 10:09:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setThread: aGDBThread
thread := aGDBThread
"Created: / 30-01-2018 / 15:56:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBFrame methodsFor:'printing & storing'!
displayString
^ String streamContents: [ :aStream |
| f |
f := self file.
level printOn:aStream base: 10 size: 2 fill: Character space.
aStream nextPutAll:' '.
addr printOn:aStream.
aStream nextPutAll:' '.
func notNil ifTrue:[
func printOn:aStream.
] ifFalse:[
aStream nextPutAll: '?'
].
f notNil ifTrue:[
aStream nextPutAll:' ('.
aStream nextPutAll: f startingAt: (f lastIndexOf: Filename separator) + 1.
line notNil ifTrue:[
aStream nextPutAll:':'.
line printOn:aStream.
].
aStream nextPutAll:')'.
].
].
"Created: / 27-02-2015 / 15:20:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 12-06-2017 / 09:04:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
printOn:aStream
"append a printed representation if the receiver to the argument, aStream"
super printOn: aStream.
aStream nextPutAll:'('.
level printOn:aStream base: 10 size: 2 fill: Character space.
aStream nextPutAll:' '.
addr printOn:aStream.
aStream nextPutAll:' '.
func printOn:aStream.
aStream nextPutAll:' - '.
file printOn:aStream.
aStream nextPutAll:':'.
line printOn:aStream.
aStream nextPutAll:')'.
"Modified: / 27-02-2015 / 15:21:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBFrame methodsFor:'private'!
ensureIsValid
self isValid ifFalse:[
(GDBInvalidObject newException)
parameter:self;
messageText:'Invalid (obsolete) object';
raise.
].
"Created: / 07-09-2014 / 23:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 30-01-2018 / 17:51:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBFrame methodsFor:'testing'!
isValid
^ addr notNil
"Modified: / 30-01-2018 / 15:58:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBFrame class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !