VDBEventLogApplication.st
author Jan Vrany <jan.vrany@labware.com>
Fri, 29 Jul 2022 16:12:54 +0100
changeset 266 e21d777d076e
parent 264 23960fcb9dac
permissions -rw-r--r--
Fix `VDBInstructionListApplication` to analyze blocks for standalone instruction list ...that is, for instructions without any "disassemblable" (function, address range). This is used in some inspector goodies on Compiler's code buffer.

"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2021-2022 LabWare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
"{ Package: 'jv:vdb' }"

"{ NameSpace: Smalltalk }"

VDBAbstractApplication subclass:#VDBEventLogApplication
	instanceVariableNames:'eventList eventSelectionHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-UI-Events'
!

!VDBEventLogApplication class methodsFor:'documentation'!

copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2021-2022 LabWare

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
! !

!VDBEventLogApplication class methodsFor:'columns specs'!

listColumnSpec
    "This resource specification was automatically generated
     by the DataSetBuilder of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the DataSetBuilder may not be able to read the specification."

    "
     DataSetBuilder new openOnClass:VDBEventLogApplication andSelector:#listColumnSpec
    "

    <resource: #tableColumns>

    ^#(
      (DataSetColumnSpec
         label: 'Class Name'
         labelButtonType: Button
         usePreferredWidth: true
         minWidth: 150
         height: heightOfFirstRow
         menuFromApplication: false
         printSelector: className
         canSelect: false
       )
      (DataSetColumnSpec
         label: 'Value'
         labelButtonType: Button
         width: 1.0
         height: heightOfFirstRow
         menuFromApplication: false
         printSelector: displayString
         canSelect: false
       )
      )
    
! !

!VDBEventLogApplication class methodsFor:'interface specs'!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:VDBEventLogApplication andSelector:#windowSpec
     VDBEventLogApplication new openInterface:#windowSpec
     VDBEventLogApplication open
    "

    <resource: #canvas>

    ^ 
    #(FullSpec
       name: windowSpec
       window: 
      (WindowSpec
         label: 'Event Log'
         name: 'Event Log'
         min: (Point 10 10)
         bounds: (Rectangle 0 0 300 300)
       )
       component: 
      (SpecCollection
         collection: (
          (DataSetSpec
             name: 'EventList'
             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
             model: eventSelectionHolder
             menu: eventMenu
             hasHorizontalScrollBar: true
             hasVerticalScrollBar: true
             dataList: eventList
             useIndex: false
             columnHolder: listColumnSpec
           )
          )
        
       )
     )
! !

!VDBEventLogApplication class methodsFor:'menu specs'!

eventMenu
    "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:VDBEventLogApplication andSelector:#eventMenu
     (Menu new fromLiteralArrayEncoding:(VDBEventLogApplication eventMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            enabled: hasEventSelectedHolder
            label: 'Inspect Event'
            itemValue: doInspect
          )
         (MenuItem
            label: 'Clear Events'
            itemValue: doClear
          )
         )
        nil
        nil
      )
! !

!VDBEventLogApplication class methodsFor:'plugIn spec'!

aspectSelectors
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this. If it is corrupted,
     the UIPainter may not be able to read the specification."

    "Return a description of exported aspects;
     these can be connected to aspects of an embedding application
     (if this app is embedded in a subCanvas)."

    ^ #(
        #debuggerHolder
      ).

! !

!VDBEventLogApplication methodsFor:'aspects'!

eventList
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    eventList isNil ifTrue:[
        eventList := List new.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       eventList addDependent:self.
"/       eventList onChangeSend:#eventListChanged to:self.
    ].
    ^ eventList.
!

eventSelectionHolder
    <resource: #uiAspect>

    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    eventSelectionHolder isNil ifTrue:[
        eventSelectionHolder := ValueHolder new.
"/ if your app needs to be notified of changes, uncomment one of the lines below:
"/       eventSelectionHolder addDependent:self.
"/       eventSelectionHolder onChangeSend:#eventSelectionHolderChanged to:self.
    ].
    ^ eventSelectionHolder.
! !

!VDBEventLogApplication methodsFor:'event handling'!

onEvent: aGDBEvent
    (aGDBEvent isKindOf: GDBExitEvent) ifTrue:[
        self unsubscribe.
        ^self.
    ].
    ((aGDBEvent isKindOf: GDBCommandEvent) and:[aGDBEvent command isKindOf: GDBMI_gdb_exit]) ifTrue:[
        self unsubscribe.
        ^self.
    ].
    self eventList add: aGDBEvent

    "Created: / 07-06-2014 / 14:33:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBEventLogApplication methodsFor:'hooks'!

postBuildListView:aView
    <resource: #uiCallback>

    aView setupTableRenderer
        columnDescriptors:self class listColumnSpec;
        showHorizontalSeparators:false;
        showItemInAdditionToColumns: false.

    "Modified: / 10-06-2014 / 21:21:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBEventLogApplication methodsFor:'initialization & release'!

subscribe   
    super subscribe.

    debugger announcer
        when: GDBEvent send: #onEvent: to: self

    "Created: / 07-06-2014 / 14:33:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 17-11-2021 / 16:39:13 / Jan Vrany <jan.vrany@labware.com>"
    "Modified (comment): / 18-11-2021 / 16:24:33 / Jan Vrany <jan.vrany@labware.com>"
! !

!VDBEventLogApplication methodsFor:'menu actions'!

doClear
    <resource: #uiCallback>

    eventList removeAll

    "Modified: / 11-06-2017 / 20:18:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

doInspect
    | event |

    event := self eventSelectionHolder value.
    event notNil ifTrue:[
        event inspect
    ].

    "Modified: / 07-06-2014 / 14:36:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBEventLogApplication methodsFor:'menu queries'!

hasEventSelectedHolder
    ^ (AspectAdaptor forAspect:#notEmptyOrNil) subjectChannel: self eventSelectionHolder

    "Created: / 07-06-2014 / 14:37:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 09-06-2014 / 10:16:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBEventLogApplication class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !