GDBInstructionDissection.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 08 Jul 2019 12:34:18 +0100
changeset 200 e9250da35d87
parent 133 026074322527
child 259 651864c2aa29
permissions -rw-r--r--
API: add method for importing Python support code This can be used by VDB, VDB plugins or any other user of libgdbs to load Python support code.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
133
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
This library is free software; you can redistribute it and/or
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
License as published by the Free Software Foundation; either
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
version 2.1 of the License. 
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
This library is distributed in the hope that it will be useful,
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
Lesser General Public License for more details.
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
License along with this library; if not, write to the Free Software
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'jv:libgdbs' }"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ NameSpace: Smalltalk }"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
Object subclass:#GDBInstructionDissection
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	instanceVariableNames:''
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
	classVariableNames:'Null'
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	poolDictionaries:''
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	category:'GDB-Private'
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
!
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
!GDBInstructionDissection class methodsFor:'documentation'!
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
copyright
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
jv:libgdbs - GNU Debugger Interface Library
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
Copyright (C) 2015-now Jan Vrany
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
This library is free software; you can redistribute it and/or
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
modify it under the terms of the GNU Lesser General Public
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
License as published by the Free Software Foundation; either
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
version 2.1 of the License. 
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
This library is distributed in the hope that it will be useful,
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
but WITHOUT ANY WARRANTY; without even the implied warranty of
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
Lesser General Public License for more details.
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
You should have received a copy of the GNU Lesser General Public
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
License along with this library; if not, write to the Free Software
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
! !
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
!GDBInstructionDissection class methodsFor:'initialization'!
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
initialize
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
    "Invoked at system start or when the class is dynamically loaded."
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
    "/ please change as required (and remove this comment)
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    Null := self new
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
    "Modified: / 16-08-2018 / 10:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
! !
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
!GDBInstructionDissection class methodsFor:'accessing'!
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
null
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
    ^ Null
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
    "Created: / 16-08-2018 / 10:27:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
! !
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
!GDBInstructionDissection methodsFor:'accessing'!
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
branchTarget
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    "Return and address of next instruction if branch is taken.
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
     Assumes that this instruction is a branch instruction."
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    self shouldNeverBeSent "since isBranchInstruction returns false"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    "Created: / 16-08-2018 / 10:33:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    "Modified (comment): / 16-08-2018 / 14:03:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
! !
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
!GDBInstructionDissection methodsFor:'testing'!
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
isBranch
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
    "Return `true` is this instruction is some sort of branch instruction."
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
    ^ false
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
    "Created: / 03-07-2018 / 14:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
    "Modified (comment): / 16-08-2018 / 14:02:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
!
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
isReturn
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
    "Return `true` is this instruction is a return"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
    ^ false
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
    "Created: / 03-07-2018 / 14:39:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
    "Modified (comment): / 16-08-2018 / 14:02:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
! !
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
026074322527 Add support for instruction dissection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
GDBInstructionDissection initialize!