Fix `VDBStackApplication >> delayedUpdateAfterThreadStopped:`
...so stopped frame is pre-selected as default. This commit essentially
undo the change done in 364ebdd1d42c: Generalize `VDBInstructionListView`
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
"{ Package: 'jv:vdb' }"
"{ NameSpace: Smalltalk }"
VDBAbstractPresenter subclass:#VDBVariableObjectPresenter
instanceVariableNames:'varobj'
classVariableNames:''
poolDictionaries:''
category:'VDB-Presentation'
!
!VDBVariableObjectPresenter class methodsFor:'documentation'!
copyright
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
! !
!VDBVariableObjectPresenter 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:VDBVariableObjectPresenter andSelector:#contextMenu
(Menu new fromLiteralArrayEncoding:(VDBVariableObjectPresenter contextMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
label: 'Copy Value'
itemValue: doCopyValue
isVisible: true
)
(MenuItem
label: 'Copy Expression'
itemValue: doCopyPath
isVisible: true
)
)
nil
nil
)
! !
!VDBVariableObjectPresenter methodsFor:'accessing'!
label
^ varobj expression
"/ ^ (varobj parent notNil or:[varobj parentIsDynamic])
"/ ifTrue:[ varobj expression ]
"/ ifFalse:[ varobj path ]
"Created: / 27-02-2015 / 15:57:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-07-2019 / 23:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
subject
"Return an instance of GDB object that this presenter displays."
^ varobj
"Modified: / 05-02-2018 / 13:08:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
tooltip
^ self valueString
"Created: / 29-07-2018 / 21:35:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
value
^ varobj value
"Created: / 02-06-2017 / 07:32:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 28-01-2018 / 22:49:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
valueString
^ varobj value
"Created: / 11-06-2017 / 23:25:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 01-09-2018 / 00:55:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
varobj
^ varobj
"Created: / 28-01-2018 / 22:45:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBVariableObjectPresenter methodsFor:'initialization'!
setVarobj:aGDBVariable
varobj := aGDBVariable
"Created: / 27-02-2015 / 16:00:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBVariableObjectPresenter methodsFor:'menu'!
contextMenuBee: aMenu
"Adds a Smalltalk/X debugging menu items to the context menu."
<menuextension: #contextMenu>
(varobj type endsWith: 'Bee::oop_t *') ifTrue:[
aMenu addItem: (
(MenuItem label: (self class classResources string: 'Inspect Object')
itemValue: #doInspectBeeObject)
receiver: self
).
aMenu addSeparator.
].
"Created: / 08-07-2019 / 21:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
contextMenuStX: aMenu
"Adds a Smalltalk/X debugging menu items to the context menu."
<menuextension: #contextMenu>
(varobj type endsWith: 'OBJ') ifTrue:[
aMenu addItem: (
(MenuItem label: (self class classResources string: 'Inspect Object')
itemValue: #doInspectStXObject)
receiver: self
).
aMenu addSeparator.
].
"Created: / 10-02-2018 / 23:06:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-07-2019 / 22:52:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBVariableObjectPresenter methodsFor:'menu actions'!
doCopyPath
self doCopy: varobj path.
"Created: / 05-02-2018 / 22:32:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doCopyValue
self doCopy: varobj value.
"Created: / 16-01-2018 / 23:28:56 / jv"
"Modified: / 28-01-2018 / 22:55:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doDoubleClick
"/ This is really an ugly hack: in Smalltalk IDEs, double clock
"/ on variable usually inspects it. We want the same, but in this case,
"/ inspect operation may involve changing varobj's visualizer.
"/
"/ To allow plugins to define their own inspect actions, first search
"/ extending menu items for item matching "Inspect" - if there's one,
"/ do this, if none or more than one, do `super doDoubleClick`.
| dummy inspects |
dummy := Menu new.
self contextMenuExtendersFor: #contextMenu do:[:each |
self perform: each with: dummy
].
inspects := (dummy items ? #()) select:[:item | item label startsWith:'Inspect' ].
inspects size == 1 ifTrue:[
| value |
value := inspects anyOne value.
value isSymbol ifTrue:[
inspects anyOne receiver perform: value
].
] ifFalse:[
super doDoubleClick
].
"Created: / 19-02-2018 / 16:10:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 21-08-2019 / 22:52:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doInspect:visualizerExpr
"
Open an inspector of a copy of varobj. If `visualizerExpr`
is not nil then the visualizer of a *copy* is set to
`visualizerExpr`
"
| dup app wnd |
dup := varobj duplicate.
dup == varobj ifTrue:[
dup := VDBVariableObject
evaluate:varobj path
in:varobj frame
using:varobj debugger.
].
visualizerExpr notNil ifTrue:[
dup visualizer:visualizerExpr
].
"/ If used in Inspector2, open child in the same inspector windpow.
app := self application.
app notNil ifTrue:[
wnd := app window.
wnd notNil ifTrue:[
wnd := wnd topView.
(wnd application isKindOf:Tools::Inspector2) ifTrue:[
wnd application inspect:dup.
^ self.
].
].
].
"/ ...otherwise open a new inspector...
dup inspect.
"Created: / 08-07-2019 / 20:17:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doInspectBeeObject
self doInspect:'obj'.
"Created: / 08-07-2019 / 21:55:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doInspectStXObject
self doInspect:'instance_create'.
"Created: / 10-02-2018 / 23:17:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-07-2019 / 22:50:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBVariableObjectPresenter methodsFor:'private'!
fetchChildren
^ varobj children collect:[ :each | self class new setVarobj:each; parent:self;yourself ]
"Created: / 28-01-2018 / 22:46:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBVariableObjectPresenter methodsFor:'protocol-queries'!
hasChildren
^ varobj hasChildren
"Created: / 28-01-2018 / 22:49:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBVariableObjectPresenter methodsFor:'testing'!
isVariablePresenter
^ true
"Created: / 02-06-2017 / 00:05:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBVariableObjectPresenter class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !