GDBRemoteProcess.st
author Jan Vrany <jan.vrany@labware.com>
Fri, 08 Sep 2023 12:40:22 +0100
changeset 317 7f63737e0374
parent 272 cdd1c9ad00de
permissions -rw-r--r--
Fix `GDBMIDebugger` after rename of `GDBStXUnixProcess` to `GDBUnixProcess` ...in commit d1422e1ee.

"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2022-2023 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:libgdbs' }"

"{ NameSpace: Smalltalk }"

GDBProcess subclass:#GDBRemoteProcess
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Internal'
!

!GDBRemoteProcess class methodsFor:'documentation'!

copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
Copyright (C) 2022-2023 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.
"
!

documentation
"
    A GDBRemoteProcess represent a GDB process external to libgdbs. This means
    the user us responsible for launching the actuall GDB and setting up
    a connection to its MI channel:

       | process debugger |

       process := GDBRemoteProcess new.
       process debuggerInput: miChannel writeStream.
       process debuggerOutput: miChannel readStream.
       debugger := GDBDebugger newWithProcess: process.

    Onw way to use this might be to run GDB through
    `socat` [1], exposing it's MI channel over TCP socket:

        socat TCP4-LISTEN:1234 EXEC:'gdb -i mi2'

    This is useful for example when host running libgdbs
    does not have suitable GDB installed or on environments 
    where no 'native' implementation of `GDBProcess` (such as
    `GDBStXUnixProcess`) exists (such as Bee Smalltalk)

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]
        GDBLocalProcess

"
! !

!GDBRemoteProcess methodsFor:'accessing'!

connection:aGDBConnection
    self assert: debuggerInput notNil.
    self assert: debuggerOutput notNil.

    super connection:aGDBConnection

    "Created: / 17-10-2018 / 22:37:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

debuggerInput:aWriteStream
    "Set a write stream on debugger's MI channel. See #debuggerInput."

    debuggerInput := aWriteStream.

    "Modified (comment): / 17-10-2018 / 22:36:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

debuggerOutput:aReadStream
    "Set a read stream on debugger's MI channel. See #debuggerOutput."

    debuggerOutput := aReadStream.

    "Modified (comment): / 17-10-2018 / 22:35:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

id
    "Return a string identification of this GDBProcess. 
     Used for debugging purposes only."

    ^ 'remote'

    "Created: / 19-10-2018 / 10:10:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !