GDBProcess.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 12 Dec 2017 23:01:27 +0000
changeset 93 b1715ebf8df1
parent 91 472a4841a8b6
child 95 f417138e9c48
permissions -rw-r--r--
Resurected old `GDBProcess` implementation using pipes ...as `GDBPipedProcess`. This one whould wotk on both Linux and Windows as it does not use PTYs.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     1
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     4
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     5
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     7
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     8
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
     9
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    10
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    13
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    14
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    16
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    18
"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'jv:libgdbs' }"
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
78
c24e7d8bc881 BUpdated build files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 24
diff changeset
    21
"{ NameSpace: Smalltalk }"
c24e7d8bc881 BUpdated build files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 24
diff changeset
    22
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
Object subclass:#GDBProcess
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    24
	instanceVariableNames:'pid connection debuggerInput debuggerOutput'
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    25
	classVariableNames:'GDBExecutable'
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	poolDictionaries:''
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	category:'GDB-Private'
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    30
!GDBProcess class methodsFor:'documentation'!
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    31
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    32
copyright
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    33
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    34
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    35
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    36
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    37
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    38
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    39
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    40
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    41
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    42
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    43
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    44
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    45
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    46
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    47
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    48
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    49
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    50
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
    51
! !
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    52
24
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    53
!GDBProcess class methodsFor:'instance creation'!
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    54
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    55
new
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    56
    | class |
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    57
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    58
    class := OperatingSystem isUNIXlike"false" ifTrue:[ GDBUnixProcess ] ifFalse: [ self ].
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    59
    ^ class basicNew initialize.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    60
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    61
    "Modified: / 16-12-2017 / 00:10:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    62
! !
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    63
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    64
!GDBProcess class methodsFor:'accessing'!
24
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    65
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    66
gdbExecutable
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    67
    ^ GDBExecutable
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    68
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    69
    "Created: / 01-03-2015 / 08:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    70
!
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    71
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    72
gdbExecutable: aString
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    73
    GDBExecutable := aString
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    74
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    75
    "Created: / 01-03-2015 / 08:07:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
24
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    76
! !
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    77
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
!GDBProcess class methodsFor:'queries'!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
isAbstract
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    "Return if this class is an abstract class.
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
     True is returned here for myself only; false for subclasses.
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
     Abstract subclasses must redefine again."
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    ^ self == GDBProcess.
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
! !
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
!GDBProcess methodsFor:'accessing'!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
24
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    90
connection:aGDBConnection
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    91
    connection := aGDBConnection.
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    92
!
98ff50f8a25d Temporary commit : initial work on session recorder (to use for simulation later)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    93
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    94
consoleInput
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    95
    ^ nil
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    96
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    97
    "Created: / 02-06-2017 / 23:35:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    98
    "Modified: / 15-12-2017 / 23:58:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
    99
!
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   100
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   101
consoleOutput
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   102
    ^ nil
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   103
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   104
    "Created: / 02-06-2017 / 23:35:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   105
    "Modified: / 15-12-2017 / 23:58:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   106
!
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   107
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
debuggerInput
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   109
    "raise an error: must be redefined in concrete subclass(es)"
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   110
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   111
    ^ debuggerInput
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   112
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   113
    "Modified: / 15-12-2017 / 23:58:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
debuggerOutput
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   117
    "raise an error: must be redefined in concrete subclass(es)"
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   118
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   119
    ^ debuggerOutput
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   120
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   121
    "Modified: / 15-12-2017 / 23:58:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
pid
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
    ^ pid
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
! !
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   128
!GDBProcess methodsFor:'initialization & release'!
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   130
initialize
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   131
    | inputPipe  input  outputPipe  output  args |
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   132
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   133
    inputPipe := NonPositionableExternalStream makePipe.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   134
    input := inputPipe second.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   135
    outputPipe := NonPositionableExternalStream makePipe.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   136
    output := outputPipe first.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   137
    args := (Array new:5)
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   138
             at: 1 put: GDBExecutable ? '/usr/bin/gdb';
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   139
             at: 2 put: '-q';
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   140
             at: 3 put: '-nx';
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   141
             at: 4 put: '--interpreter';
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   142
             at: 5 put: 'mi2';
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   143
             yourself.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   144
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   145
    Processor 
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   146
        monitor:[
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   147
            pid := OperatingSystem 
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   148
                    exec:args first
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   149
                    withArguments:args
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   150
                    environment:OperatingSystem getEnvironment
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   151
                    fileDescriptors: (Array
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   152
                            with: inputPipe first fileDescriptor
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   153
                            with: outputPipe second fileDescriptor
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   154
                            with: outputPipe second fileDescriptor
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   155
                        )
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   156
                    fork:true
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   157
                    newPgrp:false
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   158
                    inDirectory:Filename currentDirectory
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   159
                    showWindow: false.      
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   160
            debuggerInput := input.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   161
            debuggerOutput := output.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   162
            pid.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   163
        ]
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   164
        action:[:stat | self exited:stat. ].
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   165
    inputPipe first close.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   166
    outputPipe second close.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   167
    pid isNil ifTrue:[
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   168
        input close.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   169
        output close.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   170
        self error:'Failed to launch gdb'.
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   171
    ].
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   172
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   173
    "Created: / 12-12-2017 / 21:04:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   174
!
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   175
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
release
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
    pid := connection := nil.
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   178
    debuggerInput notNil ifTrue:[ debuggerInput close ].
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   179
    debuggerOutput notNil ifTrue:[ debuggerOutput close ].
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
    "Created: / 20-06-2014 / 21:35:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
   182
    "Modified: / 15-12-2017 / 23:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
! !
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
!GDBProcess methodsFor:'private'!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
exited: status
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
    connection released: status
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
    "Created: / 20-06-2014 / 21:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   191
    "Modified: / 31-05-2017 / 21:48:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
! !
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   194
!GDBProcess class methodsFor:'documentation'!
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   195
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   196
version_HG
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   197
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   198
    ^ '$Changeset: <not expanded> $'
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   199
! !
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   200