author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 20 Jun 2014 21:25:03 +0100 | |
changeset 22 | 57025871aed4 |
parent 11 | 474fbb650afe |
permissions | -rw-r--r-- |
0 | 1 |
"{ Package: 'jv:libgdbs' }" |
2 |
||
3 |
Object subclass:#GDBLauncher |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'GDB-Private' |
|
8 |
! |
|
9 |
||
2
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
10 |
|
0 | 11 |
!GDBLauncher class methodsFor:'starting'! |
12 |
||
13 |
startGDB |
|
22
57025871aed4
Renamed GDBDriver to GDBConnection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11
diff
changeset
|
14 |
| inputPipe input outputPipe output args connection pid | |
0 | 15 |
|
16 |
inputPipe := NonPositionableExternalStream makePipe. |
|
17 |
input := inputPipe second. |
|
18 |
outputPipe := NonPositionableExternalStream makePipe. |
|
10
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
19 |
output := outputPipe first. |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
20 |
args := #( '/usr/bin/gdb' '--interpreter' 'mi2' ). |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
21 |
Processor |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
22 |
monitor:[ |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
23 |
pid := OperatingSystem |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
24 |
exec:args first |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
25 |
withArguments:args |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
26 |
environment:OperatingSystem getEnvironment |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
27 |
fileDescriptors:{ |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
28 |
inputPipe first fileDescriptor. |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
29 |
outputPipe second fileDescriptor. |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
30 |
outputPipe second fileDescriptor |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
31 |
} |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
32 |
fork:true |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
33 |
newPgrp:false |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
34 |
inDirectory:Filename currentDirectory. |
22
57025871aed4
Renamed GDBDriver to GDBConnection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11
diff
changeset
|
35 |
connection := GDBConnection |
11
474fbb650afe
PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
36 |
pid:pid |
474fbb650afe
PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
37 |
input:input |
474fbb650afe
PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
38 |
output:output. |
10
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
39 |
pid. |
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
40 |
] |
22
57025871aed4
Renamed GDBDriver to GDBConnection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11
diff
changeset
|
41 |
action:[:stat | connection released:stat. ]. |
0 | 42 |
inputPipe first close. |
43 |
outputPipe second close. |
|
10
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
44 |
pid isNil ifTrue:[ |
0 | 45 |
input close. |
46 |
output close. |
|
10
f04a22c9b16c
Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
47 |
self error:'Failed to launch gdb'. |
0 | 48 |
^ self. |
49 |
]. |
|
22
57025871aed4
Renamed GDBDriver to GDBConnection.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
11
diff
changeset
|
50 |
^ connection |
0 | 51 |
|
52 |
"Created: / 26-05-2014 / 21:18:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11
474fbb650afe
PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10
diff
changeset
|
53 |
"Modified: / 09-06-2014 / 18:31:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0 | 54 |
! ! |
55 |
||
2
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
56 |
!GDBLauncher class methodsFor:'documentation'! |
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
57 |
|
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
58 |
version_HG |
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
59 |
|
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
60 |
^ '$Changeset: <not expanded> $' |
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
61 |
! ! |
a96eb336dbd3
More work reading.writing GDB events/commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1
diff
changeset
|
62 |