GDBMIDebugger.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 08 Jul 2019 12:34:18 +0100
changeset 200 e9250da35d87
parent 194 312d96017653
child 209 4eb2433b3c0a
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.

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

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
"{ Package: 'jv:libgdbs' }"

"{ NameSpace: Smalltalk }"

ApplicationModel subclass:#GDBMIDebugger
	instanceVariableNames:'process cliView miView'
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Private-MI Trace'
!

!GDBMIDebugger class methodsFor:'documentation'!

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

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
! !

!GDBMIDebugger 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:GDBMIDebugger andSelector:#windowSpec
     GDBMIDebugger new openInterface:#windowSpec
     GDBMIDebugger open
    "

    <resource: #canvas>

    ^ 
    #(FullSpec
       name: windowSpec
       uuid: '75dbc6f0-9274-11e9-b1d9-606720e43e2c'
       window: 
      (WindowSpec
         label: 'GDB/MI Debugger / Viewer'
         name: 'GDB/MI Debugger / Viewer'
         uuid: '75dbc6f1-9274-11e9-b1d9-606720e43e2c'
         min: (Point 10 10)
         bounds: (Rectangle 0 0 852 533)
       )
       component: 
      (SpecCollection
         collection: (
          (VariableVerticalPanelSpec
             name: 'VariableVerticalPanel1'
             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
             uuid: '75dbc6f2-9274-11e9-b1d9-606720e43e2c'
             component: 
            (SpecCollection
               collection: (
                (ArbitraryComponentSpec
                   name: 'CLI'
                   uuid: '75dbc6f3-9274-11e9-b1d9-606720e43e2c'
                   hasBorder: false
                   component: cliView
                 )
                (ArbitraryComponentSpec
                   name: 'MI'
                   uuid: '75dbc6f4-9274-11e9-b1d9-606720e43e2c'
                   hasBorder: false
                   component: miView
                 )
                )
              
             )
             handles: (Any 0.5 1.0)
           )
          )
        
       )
     )
! !

!GDBMIDebugger methodsFor:'aspects'!

cliView
    cliView isNil ifTrue:[ 
        cliView := VT100TerminalView new.
        self initializeTerminalView: cliView.  
    ].
    ^ cliView

    "Created: / 19-06-2019 / 10:33:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

miView
    miView isNil ifTrue:[ 
        miView := VT100TerminalView new.
        self initializeTerminalView: miView.  
    ].
    ^ miView

    "Created: / 19-06-2019 / 10:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBMIDebugger methodsFor:'hooks'!

commonPostOpen
    super commonPostOpen.

    process := GDBProcess new.

    (process isKindOf: GDBStXUnixProcess) ifTrue:[ 
        (process instVarNamed: #debuggerPTY) 
            setLocalEcho: true;
            setOutputCRLF: true.
    ].
    miView inStream: process debuggerInput.
    miView outStream: process debuggerOutput. 
    miView startReaderProcessWhenVisible.

    process consoleInput notNil ifTrue:[ 
        cliView inStream: process consoleInput.
        cliView outStream: process consoleOutput. 
        cliView startReaderProcessWhenVisible.    
    ] ifFalse:[ 
        cliView hide.
    ].

    "Created: / 19-06-2019 / 10:40:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBMIDebugger methodsFor:'initialization & release'!

initializeTerminalView: aTerminalView
    aTerminalView cursorType: #block;  
                foregroundColor: Color white
                backgroundColor: Color black;
                cursorForegroundColor: Color white
                      backgroundColor: Color white.      
    (Smalltalk at: #VDBAbstractApplication) notNil ifTrue:[ 
        aTerminalView font: (Smalltalk at: #VDBAbstractApplication) defaultTextFont
    ].

    "Created: / 19-06-2019 / 10:33:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

release
    process notNil ifTrue:[ 
        process release.
    ].

    "Created: / 19-06-2019 / 10:47:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !