GDBRemoteProcess.st
changeset 152 fab425b52c21
child 259 651864c2aa29
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBRemoteProcess.st	Sat Oct 20 07:48:11 2018 +0100
@@ -0,0 +1,124 @@
+"
+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 }"
+
+GDBProcess subclass:#GDBRemoteProcess
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'GDB-Private'
+!
+
+!GDBRemoteProcess 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
+"
+!
+
+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>"
+! !
+