VDBInstructionPresenter.st
author Jan Vrany <jan.vrany@labware.com>
Tue, 26 Jul 2022 15:01:33 +0100
changeset 265 f2470f0dd9cd
parent 264 23960fcb9dac
permissions -rw-r--r--
Do not show address for (pseudo) instructions with no code While such instructions do not appear in GDB-produced disassembly, they may appear in some manually-generated instruction lists. One example of such (pseudo) instruction is label.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
     4
Copyright (C) 2021-2022 LabWare
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
     5
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
     6
Permission is hereby granted, free of charge, to any person obtaining a copy
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
     7
of this software and associated documentation files (the 'Software'), to deal
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
     8
in the Software without restriction, including without limitation the rights
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
     9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    10
copies of the Software, and to permit persons to whom the Software is
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    11
furnished to do so, subject to the following conditions:
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    13
The above copyright notice and this permission notice shall be included in all
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    14
copies or substantial portions of the Software.
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    16
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    22
SOFTWARE.
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
"
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
"{ Package: 'jv:vdb' }"
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
"{ NameSpace: Smalltalk }"
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
VDBAbstractPresenter subclass:#VDBInstructionPresenter
80
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    29
	instanceVariableNames:'instruction basicBlock'
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
	classVariableNames:''
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
	poolDictionaries:''
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
	category:'VDB-Presentation'
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
!
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
!VDBInstructionPresenter class methodsFor:'documentation'!
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
copyright
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
"
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    39
jv:libgdbs - GNU Debugger Interface Library
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
Copyright (C) 2015-now Jan Vrany
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    41
Copyright (C) 2021-2022 LabWare
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    42
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    43
Permission is hereby granted, free of charge, to any person obtaining a copy
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    44
of this software and associated documentation files (the 'Software'), to deal
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    45
in the Software without restriction, including without limitation the rights
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    46
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    47
copies of the Software, and to permit persons to whom the Software is
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    48
furnished to do so, subject to the following conditions:
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    50
The above copyright notice and this permission notice shall be included in all
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    51
copies or substantial portions of the Software.
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
264
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    53
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    54
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    55
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    56
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    57
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    58
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23960fcb9dac Relicense under MIT license.
Jan Vrany <jan.vrany@labware.com>
parents: 225
diff changeset
    59
SOFTWARE.
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
"
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
! !
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
220
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    63
!VDBInstructionPresenter class methodsFor:'menu specs'!
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    64
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    65
contextMenu
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    66
    "This resource specification was automatically generated
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    67
     by the MenuEditor of ST/X."
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    68
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    69
    "Do not manually edit this!! If it is corrupted,
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    70
     the MenuEditor may not be able to read the specification."
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    71
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    72
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    73
    "
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    74
     MenuEditor new openOnClass:VDBInstructionPresenter andSelector:#contextMenu
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    75
     (Menu new fromLiteralArrayEncoding:(VDBInstructionPresenter contextMenu)) startUp
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    76
    "
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    77
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    78
    <resource: #menu>
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    79
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    80
    ^ 
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    81
     #(Menu (
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    82
         (MenuItem
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    83
            label: 'Copy Address'
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    84
            itemValue: doCopyAddress
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    85
            isVisible: true
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    86
         )
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    87
       ) nil
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    88
        nil
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    89
     )
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    90
! !
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
    91
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
!VDBInstructionPresenter methodsFor:'accessing'!
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
80
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    94
address
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    95
    ^instruction address
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    96
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    97
    "Created: / 26-06-2018 / 12:42:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    98
!
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    99
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   100
basicBlock
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   101
    ^ basicBlock
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   102
!
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   103
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
instruction
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
    ^ instruction
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
!
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
subject
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
    "Return an instance of GDB object that this presenter displays."
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
    ^ instruction
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
    "Created: / 22-06-2018 / 15:10:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
! !
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
!VDBInstructionPresenter methodsFor:'initialization'!
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
80
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   118
setBasicBlock: aVDBBasicBLock
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   119
    basicBlock := aVDBBasicBLock
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   120
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   121
    "Created: / 26-06-2018 / 12:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   122
!
7a9cf1d6be50 UX: improvements in disasembly view (`VDBInstructionListApplication`)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
   123
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
setInstruction: aGDBInstruction
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
    instruction := aGDBInstruction
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
    "Created: / 22-06-2018 / 12:19:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
! !
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
220
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
   130
!VDBInstructionPresenter methodsFor:'menu actions'!
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
   131
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
   132
doCopyAddress
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
   133
    self doCopy: '0x', (instruction address printStringRadix: 16 size: 16 fill: $0)
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
   134
! !
ae5ddc0ea07b UI: add "Copy Address" item to instruction context menu.
Jan Vrany <jan.vrany@labware.com>
parents: 146
diff changeset
   135
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
!VDBInstructionPresenter methodsFor:'protocol-accessing'!
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
225
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   138
icon
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   139
    | breakpoints |
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   140
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   141
    breakpoints := instruction breakpoints.
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   142
    breakpoints notEmpty ifTrue: [  
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   143
        (breakpoints anySatisfy: [:bkpt | bkpt enabled ]) ifTrue: [ 
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   144
            ^ VDBIconLibrary brkp_obj
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   145
        ] ifFalse: [ 
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   146
            ^ VDBIconLibrary brkpd_obj
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   147
        ].
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   148
    ].
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   149
    ^ nil
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   150
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   151
    "Created: / 28-05-2021 / 21:46:00 / Jan Vrany <jan.vrany@labware.com>"
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   152
    "Modified: / 01-06-2021 / 10:51:58 / Jan Vrany <jan.vrany@labware.com>"
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   153
!
0771f7b406d6 UI: display breakpoints in instruction list
Jan Vrany <jan.vrany@labware.com>
parents: 220
diff changeset
   154
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
label
91
c9da2e1b0327 UX: show original source line in disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   156
    ^String streamContents:[ :s |
c9da2e1b0327 UX: show original source line in disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   157
        (parent notNil and:[ parent askFor: #isInstructionsAndSourcePresenter ]) ifTrue:[
c9da2e1b0327 UX: show original source line in disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   158
            s next: parent lineDigitsToDisplay put: Character space.   
c9da2e1b0327 UX: show original source line in disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   159
        ].
265
f2470f0dd9cd Do not show address for (pseudo) instructions with no code
Jan Vrany <jan.vrany@labware.com>
parents: 264
diff changeset
   160
        instruction opcodes isEmpty ifTrue: [ 
f2470f0dd9cd Do not show address for (pseudo) instructions with no code
Jan Vrany <jan.vrany@labware.com>
parents: 264
diff changeset
   161
            s next: 16 put: Character space.
f2470f0dd9cd Do not show address for (pseudo) instructions with no code
Jan Vrany <jan.vrany@labware.com>
parents: 264
diff changeset
   162
        ] ifFalse: [ 
f2470f0dd9cd Do not show address for (pseudo) instructions with no code
Jan Vrany <jan.vrany@labware.com>
parents: 264
diff changeset
   163
            instruction address printOn: s base: 16 size: 16 fill: $0.
f2470f0dd9cd Do not show address for (pseudo) instructions with no code
Jan Vrany <jan.vrany@labware.com>
parents: 264
diff changeset
   164
        ].
91
c9da2e1b0327 UX: show original source line in disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   165
        s space.
146
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   166
        s nextPutAll: instruction assembly withTabsExpanded
91
c9da2e1b0327 UX: show original source line in disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   167
    ]
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
    "Created: / 22-06-2018 / 12:21:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
146
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   170
    "Modified: / 30-01-2019 / 11:33:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
265
f2470f0dd9cd Do not show address for (pseudo) instructions with no code
Jan Vrany <jan.vrany@labware.com>
parents: 264
diff changeset
   171
    "Modified: / 26-07-2022 / 13:04:40 / Jan Vrany <jan.vrany@labware.com>"
77
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
! !
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
!VDBInstructionPresenter methodsFor:'testing'!
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
isInstructionPresenter
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
    ^ true
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
! !
163d914fae79 Add initial support for disassembly view
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
146
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   180
!VDBInstructionPresenter class methodsFor:'documentation'!
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   181
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   182
version_HG
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   183
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   184
    ^ '$Changeset: <not expanded> $'
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   185
! !
c037aa4ce54f Fix rendering of an instruction in instruction list
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   186