Refactor `GDBProcess` hierarchy to improve portability
Spawning and managing an OS process is tightly bound to the
underlaying platform (both, smalltalk-wise and OS-wise). To
improve portability and clarity of the code, rename
`GDBUnixProcess` and `GDBWindowsProcess` to `GDBStXUnixProcess`
and `GDBStxWindowsProcess`.
This commit also includes a new abstract superclass (a `GDBLocalProcess`)
for all specialisation spawning and managing a GDB process running on
the same host as `jv:libgdbs` 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 }"
GDBProcess subclass:#GDBLocalProcess
instanceVariableNames:'pid'
classVariableNames:''
poolDictionaries:''
category:'GDB-Private'
!
!GDBLocalProcess 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
"
GDBLocalProcess is a specialization of GDBProcess that spawns a
local GDB process on a host machine. Spawning a running of GDB
process is ully managed by an (sub)instance of `GDBLocalProcess`
Due to platform differences, there are concrete variants for
different platforms.
[author:]
Jan Vrany <jan.vrany@fit.cvut.cz>
[instance variables:]
[class variables:]
[see also:]
GDBStXUnixProcess
GDBStXWindowsProcess
GDBRemoteProcess
"
! !
!GDBLocalProcess methodsFor:'accessing'!
id
"Return a string identification of this GDBProcess.
Used for debugging purposes only."
^ pid
"Created: / 19-10-2018 / 10:09:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 20-10-2018 / 06:53:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBLocalProcess methodsFor:'initialization & release'!
release
(pid notNil and:[pid > 1]) ifTrue:[
OperatingSystem sendSignal:(OperatingSystem sigTERM) to: pid.
].
"Created: / 20-10-2018 / 07:12:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBLocalProcess methodsFor:'private'!
exited: status
"Called when spawn GDB process terminates for whatever reason"
pid := nil.
connection released: status
"Created: / 20-06-2014 / 21:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 12-01-2018 / 21:50:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (comment): / 17-10-2018 / 22:30:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !