Update target features from `=target-connected event`
...so feature list is up-to-date
"
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 }"
GDBLocalProcess subclass:#GDBStXUnixProcess
instanceVariableNames:'debuggerPTY consolePTY'
classVariableNames:''
poolDictionaries:''
category:'GDB-Private'
!
!GDBStXUnixProcess 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
"
GDBStXUnixProcess is a Smalltalk/X specific implementation of GDB process
that uses two PTYs to communicate with GDB - one for MI channel, another
for CLI channel. In this case, the CLI interface is driven by GDB itself
(as opposite to be emulated as in case of GDBStXSimpleProcess).
On UNIX platforms running GDB locally, this is preferred implementation
to use.
[author:]
Jan Vrany <jan.vrany@fit.cvut.cz>
[instance variables:]
[class variables:]
[see also:]
GDBRemoteProcess
GDBStXSimpleProcess
"
! !
!GDBStXUnixProcess methodsFor:'accessing'!
consoleInput
^ consolePTY master
"Created: / 02-06-2017 / 23:36:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
consoleOutput
^ consolePTY master
"Created: / 02-06-2017 / 23:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
nativeTargetFeatures
^ #('async')
"Created: / 09-04-2018 / 15:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBStXUnixProcess methodsFor:'initialization & release'!
initialize
| exe conpty dbgpty args |
exe := self class gdbExecutable.
(exe isNil or:[ exe asFilename isExecutable not ]) ifTrue:[
GDBError signal: 'Could not find gdb, please set path to gdb using GDBProcess class >> gdbExecutable:'.
^ self.
].
conpty := GDBPTY new.
dbgpty := GDBPTY new.
dbgpty setLocalEcho: false.
dbgpty setOutputCRLF: false.
args := (Array new: 6)
at: 1 put: exe;
at: 2 put: '-q';
at: 3 put: '-ex';
at: 4 put: 'new-ui mi ', dbgpty name;
at: 5 put: '-ex';
at: 6 put: 'set pagination off';
yourself.
Processor
monitor:[
pid := OperatingSystem
exec:args first
withArguments:args
environment:OperatingSystem getEnvironment
fileDescriptors: (Array
with: conpty slave fileDescriptor
with: conpty slave fileDescriptor
with: conpty slave fileDescriptor)
fork:true
newPgrp:false
inDirectory:Filename currentDirectory
showWindow: false.
consolePTY := conpty.
debuggerPTY := dbgpty.
debuggerInput := debuggerOutput := debuggerPTY master.
pid.
]
action:[:stat | self exited:stat ].
pid isNil ifTrue:[
conpty close.
dbgpty close.
self error:'Failed to launch gdb'.
].
"Modified: / 29-10-2018 / 12:58:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeWithCommand: command
| conpty dbgpty argv |
conpty := GDBPTY new.
dbgpty := GDBPTY new.
dbgpty setLocalEcho: false.
dbgpty setOutputCRLF: false.
argv := ((self command2argv: command)) ,
((Array new: 5)
at: 1 put: '-q';
at: 2 put: '-ex';
at: 3 put: 'new-ui mi ', dbgpty name;
at: 4 put: '-ex';
at: 5 put: 'set pagination off';
yourself).
Processor
monitor:[
pid := OperatingSystem
exec:argv first
withArguments:argv
environment:OperatingSystem getEnvironment
fileDescriptors: (Array
with: conpty slave fileDescriptor
with: conpty slave fileDescriptor
with: conpty slave fileDescriptor)
fork:true
newPgrp:false
inDirectory:Filename currentDirectory
showWindow: false.
consolePTY := conpty.
debuggerPTY := dbgpty.
debuggerInput := debuggerOutput := debuggerPTY master.
pid.
]
action:[:stat | self exited:stat ].
pid isNil ifTrue:[
conpty close.
dbgpty close.
self error:'Failed to launch gdb'.
].
"Created: / 12-12-2018 / 20:13:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 17-12-2018 / 10:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
release
debuggerPTY notNil ifTrue:[
debuggerPTY release.
debuggerInput := debuggerOutput := nil
].
consolePTY notNil ifTrue:[
consolePTY release.
].
super release
"Created: / 02-06-2017 / 23:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 15-12-2017 / 23:59:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBStXUnixProcess methodsFor:'queries'!
canUsePTY
"Return true if PTYs can be used with this process, false otherwise"
^ true
"Created: / 16-01-2019 / 23:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBStXUnixProcess class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !