"{ Package: 'jv:vdb/plugins/bee' }"
"{ NameSpace: Smalltalk }"
VDBAbstractPresenter subclass:#BeeSymbolPresenter
instanceVariableNames:'symbol'
classVariableNames:''
poolDictionaries:''
category:'VDB-Plugin-Bee-Presentation'
!
!BeeSymbolPresenter class methodsFor:'menu specs'!
contextMenu
"This resource specification was automatically generated
by the MenuEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:BeeSymbolPresenter andSelector:#contextMenu
(Menu new fromLiteralArrayEncoding:(BeeSymbolPresenter contextMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
label: 'Add Breakpoint'
itemValue: doBreakpointAdd
isVisible: canBreakpointAdd
)
(MenuItem
label: 'Disable Breakpoint'
itemValue: doBreakpointDisable
isVisible: canBreakpointDisable
)
(MenuItem
label: 'Enable Breakpoint'
itemValue: doBreakpointEnable
isVisible: canBreakpointEnable
)
(MenuItem
label: 'Remove Breakpoint'
itemValue: doBreakpointRemove
isVisible: canBreakpointRemove
)
(MenuItem
label: '-'
)
(MenuItem
label: 'Disassemble'
itemValue: doDisassemble
isVisible: true
)
)
nil
nil
)
! !
!BeeSymbolPresenter methodsFor:'accessing'!
label
^ String streamContents: [ :s |
| bkpts |
s nextPutAll: '0x'.
symbol addr printOn:s base: 16 size: (8 * 2) fill: $0.
bkpts := symbol breakpoints.
bkpts notEmptyOrNil ifTrue:[
(bkpts anySatisfy:[:e|e enabled]) ifTrue:[
s nextPutAll:' B'
] ifFalse:[
s nextPutAll:' d'
].
] ifFalse:[
s nextPutAll: ' '
].
s space.
s nextPutAll: symbol name
].
"Created: / 07-06-2019 / 14:39:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 12-06-2019 / 12:39:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
subject
^ symbol
"Modified: / 07-06-2019 / 14:38:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
symbol
^ symbol
!
symbol:aBeeSymbol
symbol := aBeeSymbol.
! !
!BeeSymbolPresenter methodsFor:'initialization'!
setSymbol: aBeeSymbol
symbol := aBeeSymbol
"Created: / 07-06-2019 / 14:54:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!BeeSymbolPresenter methodsFor:'menu actions'!
doBreakpointAdd
<resource: #uiCallback>
symbol debugger send: (GDBMI_break_insert arguments: (Array with: '*0x', (symbol addr printStringRadix: 16)))
"Modified: / 10-06-2019 / 16:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doBreakpointDisable
<resource: #uiCallback>
symbol breakpoints do:[:e | e enabled: false ]
"Modified: / 10-06-2019 / 16:05:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doBreakpointEnable
<resource: #uiCallback>
symbol breakpoints do:[:e | e enabled: true ].
"Modified (format): / 10-06-2019 / 16:06:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doBreakpointRemove
<resource: #uiCallback>
"automatically generated by UIEditor ..."
"*** the code below performs no action"
"*** (except for some feedback on the Transcript)"
"*** Please change as required and accept in the browser."
"*** (and replace this comment by something more useful ;-)"
"action to be added ..."
Logger info:'action for #doBreakpointRemove ...'.
!
doDisassemble
| application |
application := VDBInstructionListApplication new
debugger: symbol debugger;
disassemblable: symbol;
title: symbol name;
yourself.
WindowGroup activeGroup application doOpenToolApplication: application.
"Modified: / 10-06-2019 / 11:36:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doDoubleClick
self doDisassemble
"Created: / 10-06-2019 / 10:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!BeeSymbolPresenter methodsFor:'menu queries'!
canBreakpointAdd
<resource: #uiCallback>
^ symbol breakpoints isEmpty
"Modified: / 10-06-2019 / 15:59:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
canBreakpointDisable
<resource: #uiCallback>
| breakpoints |
breakpoints := symbol breakpoints.
^ breakpoints notEmpty and:[ breakpoints anySatisfy:[:e|e enabled]]
"Modified: / 10-06-2019 / 16:01:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
canBreakpointEnable
<resource: #uiCallback>
| breakpoints |
breakpoints := symbol breakpoints.
^ breakpoints notEmpty and:[ breakpoints anySatisfy:[:e|e enabled not]]
"Modified: / 10-06-2019 / 16:01:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
canBreakpointRemove
<resource: #uiCallback>
^ symbol breakpoints notEmpty
"Modified: / 10-06-2019 / 15:59:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!BeeSymbolPresenter class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !