"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2021-2022 LabWare
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
"{ Package: 'jv:libgdbs' }"
"{ NameSpace: Smalltalk }"
GDBDebuggerObject subclass:#GDBInstruction
instanceVariableNames:'address offset func_name inst opcodes arch dissection'
classVariableNames:''
poolDictionaries:''
category:'GDB-Core'
!
!GDBInstruction class methodsFor:'documentation'!
copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2021-2022 LabWare
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
! !
!GDBInstruction class methodsFor:'accessing-magritte'!
descriptionContainer
^ super descriptionContainer
define: #address as: Integer;
define: #offset as: Integer;
define: #opcodes as: ByteArray;
yourself
"Created: / 22-06-2018 / 11:10:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 03-07-2018 / 14:40:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBInstruction methodsFor:'accessing'!
address
^ address
!
arch
arch isNil ifTrue:[ ^ GDBArchitecture unknown ].
^ arch
"Modified: / 10-06-2019 / 12:40:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
assembly
^ inst
"Created: / 22-06-2018 / 11:13:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
branchTarget
dissection isNil ifTrue:[
self dissect
].
^ dissection branchTarget
"Created: / 16-08-2018 / 11:13:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 16-08-2018 / 14:11:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
breakpoints
"Return a list of breakpoints a this instructions' address"
debugger isNil ifTrue: [ ^ #() ].
^ debugger breakpoints select: [:bkpt | bkpt addr = address ]
"Created: / 28-05-2021 / 21:40:56 / Jan Vrany <jan.vrany@labware.com>"
"Modified (format): / 28-10-2021 / 15:06:12 / Jan Vrany <jan.vrany@labware.com>"
!
dissection
^ dissection
!
func
^ func_name
"Created: / 22-06-2018 / 11:13:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
offset
^ offset
!
opcodes
^ opcodes
! !
!GDBInstruction methodsFor:'enumerating'!
instructionsDo: aBlock
aBlock value: self
"Created: / 16-08-2018 / 11:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBInstruction methodsFor:'initialization & release'!
setArchitecture: aGDBArchitecture
arch := aGDBArchitecture
"Created: / 16-08-2018 / 09:38:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBInstruction methodsFor:'private'!
dissect
"raise an error: this method should be implemented (TODO)"
dissection := self arch disassemble1: opcodes pc: self address
"Created: / 16-08-2018 / 10:28:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 10-06-2019 / 12:40:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBInstruction methodsFor:'testing'!
isBranch
dissection isNil ifTrue:[
self dissect
].
^ dissection isBranch
"Created: / 03-07-2018 / 14:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 16-08-2018 / 10:28:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isReturn
dissection isNil ifTrue:[
self dissect
].
^ dissection isReturn
"Created: / 03-07-2018 / 14:39:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 16-08-2018 / 14:11:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBInstruction class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !