GDBInstruction.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 16 Aug 2018 10:06:02 +0100
changeset 132 70c17add3b24
parent 126 fb73b0af430b
child 133 026074322527
permissions -rw-r--r--
Introduces a model of architectures that will contain CPU-specific code such as size of pointer or instruction disassembler. Each `GDBFrame` and `GDBInstruction` now can answer its architecture. In case the architecture is not reported by GDB or nknown to 'jv:libgdbs' a generic "unknown" architecture ir returned. Note that this feature requires a patch to current GDB [1]. Future releases of GDB will hopefully have it already integrated. [1]: https://sourceware.org/ml/gdb-patches/2018-08/msg00257.html

"
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:#GDBInstruction
	instanceVariableNames:'address offset func_name inst opcodes arch'
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Core'
!

!GDBInstruction 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
"
! !

!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
!

assembly
    ^ inst

    "Created: / 22-06-2018 / 11:13:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

func
    ^ func_name

    "Created: / 22-06-2018 / 11:13:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

offset
    ^ offset
!

opcodes
    ^ opcodes
! !

!GDBInstruction methodsFor:'initialization & release'!

setArchitecture: aGDBArchitecture
    arch := aGDBArchitecture

    "Created: / 16-08-2018 / 09:38:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBInstruction methodsFor:'testing'!

isBranchInstruction
    ^ false

    "Created: / 03-07-2018 / 14:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isReturnInstruction
    ^ false

    "Created: / 03-07-2018 / 14:39:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !