GDBRemoteProcess.st
changeset 152 fab425b52c21
child 259 651864c2aa29
equal deleted inserted replaced
151:7a2a98fe63e2 152:fab425b52c21
       
     1 "
       
     2 jv:libgdbs - GNU Debugger Interface Library
       
     3 Copyright (C) 2015-now Jan Vrany
       
     4 
       
     5 This library is free software; you can redistribute it and/or
       
     6 modify it under the terms of the GNU Lesser General Public
       
     7 License as published by the Free Software Foundation; either
       
     8 version 2.1 of the License. 
       
     9 
       
    10 This library is distributed in the hope that it will be useful,
       
    11 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13 Lesser General Public License for more details.
       
    14 
       
    15 You should have received a copy of the GNU Lesser General Public
       
    16 License along with this library; if not, write to the Free Software
       
    17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
       
    18 "
       
    19 "{ Package: 'jv:libgdbs' }"
       
    20 
       
    21 "{ NameSpace: Smalltalk }"
       
    22 
       
    23 GDBProcess subclass:#GDBRemoteProcess
       
    24 	instanceVariableNames:''
       
    25 	classVariableNames:''
       
    26 	poolDictionaries:''
       
    27 	category:'GDB-Private'
       
    28 !
       
    29 
       
    30 !GDBRemoteProcess class methodsFor:'documentation'!
       
    31 
       
    32 copyright
       
    33 "
       
    34 jv:libgdbs - GNU Debugger Interface Library
       
    35 Copyright (C) 2015-now Jan Vrany
       
    36 
       
    37 This library is free software; you can redistribute it and/or
       
    38 modify it under the terms of the GNU Lesser General Public
       
    39 License as published by the Free Software Foundation; either
       
    40 version 2.1 of the License. 
       
    41 
       
    42 This library is distributed in the hope that it will be useful,
       
    43 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    44 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    45 Lesser General Public License for more details.
       
    46 
       
    47 You should have received a copy of the GNU Lesser General Public
       
    48 License along with this library; if not, write to the Free Software
       
    49 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
       
    50 "
       
    51 !
       
    52 
       
    53 documentation
       
    54 "
       
    55     A GDBRemoteProcess represent a GDB process external to libgdbs. This means
       
    56     the user us responsible for launching the actuall GDB and setting up
       
    57     a connection to its MI channel:
       
    58 
       
    59        | process debugger |
       
    60 
       
    61        process := GDBRemoteProcess new.
       
    62        process debuggerInput: miChannel writeStream.
       
    63        process debuggerOutput: miChannel readStream.
       
    64        debugger := GDBDebugger newWithProcess: process.
       
    65 
       
    66     Onw way to use this might be to run GDB through
       
    67     `socat` [1], exposing it's MI channel over TCP socket:
       
    68 
       
    69         socat TCP4-LISTEN:1234 EXEC:'gdb -i mi2'
       
    70 
       
    71     This is useful for example when host running libgdbs
       
    72     does not have suitable GDB installed or on environments 
       
    73     where no 'native' implementation of `GDBProcess` (such as
       
    74     `GDBStXUnixProcess`) exists (such as Bee Smalltalk)
       
    75 
       
    76     [author:]
       
    77         Jan Vrany <jan.vrany@fit.cvut.cz>
       
    78 
       
    79     [instance variables:]
       
    80 
       
    81     [class variables:]
       
    82 
       
    83     [see also:]
       
    84         GDBLocalProcess
       
    85 
       
    86 "
       
    87 ! !
       
    88 
       
    89 !GDBRemoteProcess methodsFor:'accessing'!
       
    90 
       
    91 connection:aGDBConnection
       
    92     self assert: debuggerInput notNil.
       
    93     self assert: debuggerOutput notNil.
       
    94 
       
    95     super connection:aGDBConnection
       
    96 
       
    97     "Created: / 17-10-2018 / 22:37:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    98 !
       
    99 
       
   100 debuggerInput:aWriteStream
       
   101     "Set a write stream on debugger's MI channel. See #debuggerInput."
       
   102 
       
   103     debuggerInput := aWriteStream.
       
   104 
       
   105     "Modified (comment): / 17-10-2018 / 22:36:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   106 !
       
   107 
       
   108 debuggerOutput:aReadStream
       
   109     "Set a read stream on debugger's MI channel. See #debuggerOutput."
       
   110 
       
   111     debuggerOutput := aReadStream.
       
   112 
       
   113     "Modified (comment): / 17-10-2018 / 22:35:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   114 !
       
   115 
       
   116 id
       
   117     "Return a string identification of this GDBProcess. 
       
   118      Used for debugging purposes only."
       
   119 
       
   120     ^ 'remote'
       
   121 
       
   122     "Created: / 19-10-2018 / 10:10:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   123 ! !
       
   124