rbx-trepanning 0.0.5-universal-rubinius-1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2002 -0
- data/LICENSE +25 -0
- data/NEWS +31 -0
- data/README.textile +34 -0
- data/Rakefile +165 -0
- data/THANKS +14 -0
- data/app/breakpoint.rb +219 -0
- data/app/breakpoint.rbc +3551 -0
- data/app/brkptmgr.rb +140 -0
- data/app/brkptmgr.rbc +2903 -0
- data/app/client.rb +61 -0
- data/app/client.rbc +1225 -0
- data/app/complete.rb +52 -0
- data/app/complete.rbc +1288 -0
- data/app/default.rb +71 -0
- data/app/default.rbc +1132 -0
- data/app/display.rb +148 -0
- data/app/display.rbc +2578 -0
- data/app/frame.rb +98 -0
- data/app/frame.rbc +1808 -0
- data/app/irb.rb +111 -0
- data/app/irb.rbc +2094 -0
- data/app/iseq.rb +117 -0
- data/app/iseq.rbc +2192 -0
- data/app/llvm.rbc +2478 -0
- data/app/method.rb +173 -0
- data/app/method.rbc +2492 -0
- data/app/method_name.rbc +2467 -0
- data/app/mock.rb +13 -0
- data/app/mock.rbc +398 -0
- data/app/options.rb +137 -0
- data/app/options.rbc +2898 -0
- data/app/rbx-llvm.rb +165 -0
- data/app/rbx-llvm.rbc +2478 -0
- data/app/run.rb +86 -0
- data/app/run.rbc +1244 -0
- data/app/util.rb +49 -0
- data/app/util.rbc +1146 -0
- data/app/validate.rb +30 -0
- data/app/validate.rbc +676 -0
- data/bin/trepan.compiled.rbc +1043 -0
- data/bin/trepanx +69 -0
- data/bin/trepanx.compiled.rbc +1049 -0
- data/data/irbrc +41 -0
- data/data/irbrc.compiled.rbc +640 -0
- data/interface/base_intf.rb +105 -0
- data/interface/base_intf.rbc +1899 -0
- data/interface/client.rb +80 -0
- data/interface/client.rbc +1072 -0
- data/interface/comcodes.rb +20 -0
- data/interface/comcodes.rbc +385 -0
- data/interface/script.rb +104 -0
- data/interface/script.rbc +1642 -0
- data/interface/server.rb +143 -0
- data/interface/server.rbc +2213 -0
- data/interface/user.rb +150 -0
- data/interface/user.rbc +2867 -0
- data/io/base_io.rb +148 -0
- data/io/base_io.rbc +2111 -0
- data/io/input.rb +135 -0
- data/io/input.rbc +2528 -0
- data/io/null_output.rb +42 -0
- data/io/null_output.rbc +730 -0
- data/io/string_array.rb +156 -0
- data/io/string_array.rbc +2466 -0
- data/io/tcpclient.rb +129 -0
- data/io/tcpclient.rbc +2419 -0
- data/io/tcpfns.rb +33 -0
- data/io/tcpfns.rbc +694 -0
- data/io/tcpserver.rb +141 -0
- data/io/tcpserver.rbc +2638 -0
- data/lib/trepanning.rb +474 -0
- data/lib/trepanning.rbc +7705 -0
- data/lib/trepanning2.rb +441 -0
- data/processor/breakpoint.rb +164 -0
- data/processor/command/alias.rb +55 -0
- data/processor/command/backtrace.rb +76 -0
- data/processor/command/base/cmd.rb +173 -0
- data/processor/command/base/subcmd.rb +229 -0
- data/processor/command/base/submgr.rb +182 -0
- data/processor/command/base/subsubcmd.rb +103 -0
- data/processor/command/base/subsubmgr.rb +195 -0
- data/processor/command/break.rb +100 -0
- data/processor/command/complete.rb +37 -0
- data/processor/command/continue.rb +91 -0
- data/processor/command/delete.rb +30 -0
- data/processor/command/directory.rb +51 -0
- data/processor/command/disassemble.rb +145 -0
- data/processor/command/display.rb +82 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/eval.rb +51 -0
- data/processor/command/exit.rb +62 -0
- data/processor/command/finish.rb +80 -0
- data/processor/command/frame.rb +89 -0
- data/processor/command/help.rb +251 -0
- data/processor/command/info.rb +28 -0
- data/processor/command/info_subcmd/breakpoints.rb +73 -0
- data/processor/command/info_subcmd/files.rb +209 -0
- data/processor/command/info_subcmd/line.rb +86 -0
- data/processor/command/info_subcmd/method.rb +71 -0
- data/processor/command/info_subcmd/program.rb +49 -0
- data/processor/command/info_subcmd/ruby.rb +62 -0
- data/processor/command/info_subcmd/variables.rb +48 -0
- data/processor/command/irb.rb +128 -0
- data/processor/command/kill.rb +70 -0
- data/processor/command/list.rb +300 -0
- data/processor/command/macro.rb +76 -0
- data/processor/command/next.rb +66 -0
- data/processor/command/nexti.rb +59 -0
- data/processor/command/pr.rb +38 -0
- data/processor/command/ps.rb +40 -0
- data/processor/command/restart.rb +60 -0
- data/processor/command/server.rb +72 -0
- data/processor/command/set.rb +47 -0
- data/processor/command/set_subcmd/auto.rb +27 -0
- data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +54 -0
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +34 -0
- data/processor/command/set_subcmd/auto_subcmd/list.rb +34 -0
- data/processor/command/set_subcmd/basename.rb +25 -0
- data/processor/command/set_subcmd/confirm.rb +24 -0
- data/processor/command/set_subcmd/debug.rb +26 -0
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +36 -0
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +23 -0
- data/processor/command/set_subcmd/debug_subcmd/step.rb +23 -0
- data/processor/command/set_subcmd/different.rb +59 -0
- data/processor/command/set_subcmd/hidelevel.rb +62 -0
- data/processor/command/set_subcmd/highlight.rb +33 -0
- data/processor/command/set_subcmd/kernelstep.rb +60 -0
- data/processor/command/set_subcmd/max.rb +26 -0
- data/processor/command/set_subcmd/max_subcmd/list.rb +49 -0
- data/processor/command/set_subcmd/max_subcmd/stack.rb +50 -0
- data/processor/command/set_subcmd/max_subcmd/string.rb +76 -0
- data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
- data/processor/command/set_subcmd/substitute.rb +24 -0
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
- data/processor/command/set_subcmd/trace.rb +36 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +57 -0
- data/processor/command/show.rb +38 -0
- data/processor/command/show_subcmd/alias.rb +42 -0
- data/processor/command/show_subcmd/args.rb +25 -0
- data/processor/command/show_subcmd/auto.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/dis.rb +37 -0
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/irb.rb +23 -0
- data/processor/command/show_subcmd/auto_subcmd/list.rb +22 -0
- data/processor/command/show_subcmd/basename.rb +20 -0
- data/processor/command/show_subcmd/confirm.rb +18 -0
- data/processor/command/show_subcmd/debug.rb +26 -0
- data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +21 -0
- data/processor/command/show_subcmd/debug_subcmd/skip.rb +22 -0
- data/processor/command/show_subcmd/debug_subcmd/step.rb +22 -0
- data/processor/command/show_subcmd/different.rb +26 -0
- data/processor/command/show_subcmd/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/highlight.rb +24 -0
- data/processor/command/show_subcmd/kernelstep.rb +34 -0
- data/processor/command/show_subcmd/max.rb +27 -0
- data/processor/command/show_subcmd/max_subcmd/list.rb +38 -0
- data/processor/command/show_subcmd/max_subcmd/stack.rb +36 -0
- data/processor/command/show_subcmd/max_subcmd/string.rb +42 -0
- data/processor/command/show_subcmd/max_subcmd/width.rb +37 -0
- data/processor/command/show_subcmd/trace.rb +27 -0
- data/processor/command/show_subcmd/trace_subcmd/print.rb +38 -0
- data/processor/command/show_subcmd/version.rb +23 -0
- data/processor/command/source.rb +126 -0
- data/processor/command/step.rb +84 -0
- data/processor/command/tbreak.rb +19 -0
- data/processor/command/unalias.rb +44 -0
- data/processor/command/undisplay.rb +59 -0
- data/processor/command/up.rb +86 -0
- data/processor/default.rb +58 -0
- data/processor/disassemble.rb +46 -0
- data/processor/display.rb +18 -0
- data/processor/eval.rb +96 -0
- data/processor/frame.rb +211 -0
- data/processor/help.rb +72 -0
- data/processor/hook.rb +133 -0
- data/processor/load_cmds.rb +185 -0
- data/processor/location.rb +137 -0
- data/processor/main.rb +412 -0
- data/processor/mock.rb +144 -0
- data/processor/msg.rb +43 -0
- data/processor/running.rb +234 -0
- data/processor/stepping.rb +114 -0
- data/processor/subcmd.rb +161 -0
- data/processor/validate.rb +355 -0
- data/sample/list-terminal-colors.rb +139 -0
- data/sample/list-terminal-colors.rbc +2318 -0
- data/sample/rocky-dot-trepanxrc +14 -0
- data/sample/rocky-trepanx-colors.rb +47 -0
- data/sample/rocky-trepanx-colors.rbc +530 -0
- data/test/data/enable.right +36 -0
- data/test/data/fname-with-blank.cmd +6 -0
- data/test/data/fname-with-blank.right +4 -0
- data/test/data/inline-call.cmd +6 -0
- data/test/data/inline-call.right +13 -0
- data/test/data/quit-Xdebug.right +3 -0
- data/test/data/quit.cmd +5 -0
- data/test/data/quit.right +2 -0
- data/test/data/quit2.cmd +6 -0
- data/test/data/quit2.right +3 -0
- data/test/data/step-bug.cmd +11 -0
- data/test/data/step-bug.right +3 -0
- data/test/example/fname with blank.rb +1 -0
- data/test/example/gcd-server.rb +22 -0
- data/test/example/gcd.rb +19 -0
- data/test/example/inline-call.rb +23 -0
- data/test/example/null.rb +1 -0
- data/test/example/step-bug.rb +14 -0
- data/test/example/thread1.rb +3 -0
- data/test/functional/fn_helper.rb +112 -0
- data/test/functional/test-break-name.rb +52 -0
- data/test/functional/test-break.rb +51 -0
- data/test/functional/test-finish.rb +70 -0
- data/test/functional/test-fn_helper.rb +43 -0
- data/test/functional/test-list.rb +55 -0
- data/test/functional/test-next-bug.rb +49 -0
- data/test/functional/test-next.rb +101 -0
- data/test/functional/test-step.rb +272 -0
- data/test/functional/test-step2.rb +35 -0
- data/test/functional/test-tbreak.rb +41 -0
- data/test/integration/file-diff.rb +89 -0
- data/test/integration/helper.rb +78 -0
- data/test/integration/skip-test-step-bug.rb +17 -0
- data/test/integration/test-fname-with-blank.rb +16 -0
- data/test/integration/test-inline-call.rb +20 -0
- data/test/integration/test-quit.rb +47 -0
- data/test/unit/cmd-helper.rb +50 -0
- data/test/unit/mock-helper.rb +10 -0
- data/test/unit/test-app-brkpt.rb +29 -0
- data/test/unit/test-app-brkptmgr.rb +51 -0
- data/test/unit/test-app-iseq.rb +64 -0
- data/test/unit/test-app-method.rb +54 -0
- data/test/unit/test-app-options.rb +82 -0
- data/test/unit/test-app-run.rb +16 -0
- data/test/unit/test-app-util.rb +27 -0
- data/test/unit/test-app-validate.rb +18 -0
- data/test/unit/test-base-cmd.rb +47 -0
- data/test/unit/test-base-subcmd.rb +61 -0
- data/test/unit/test-base-submgr.rb +24 -0
- data/test/unit/test-bin-trepanx.rb +48 -0
- data/test/unit/test-cmd-alias.rb +48 -0
- data/test/unit/test-cmd-break.rb +22 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-finish.rb +27 -0
- data/test/unit/test-cmd-help.rb +104 -0
- data/test/unit/test-cmd-kill.rb +47 -0
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-cmd-step.rb +29 -0
- data/test/unit/test-completion.rb +38 -0
- data/test/unit/test-intf-user.rb +46 -0
- data/test/unit/test-io-input.rb +27 -0
- data/test/unit/test-io-tcp.rb +33 -0
- data/test/unit/test-io-tcpclient.rb +54 -0
- data/test/unit/test-io-tcpfns.rb +17 -0
- data/test/unit/test-io-tcpserver.rb +50 -0
- data/test/unit/test-proc-eval.rb +36 -0
- data/test/unit/test-proc-frame.rb +79 -0
- data/test/unit/test-proc-help.rb +16 -0
- data/test/unit/test-proc-hook.rb +30 -0
- data/test/unit/test-proc-load_cmds.rb +50 -0
- data/test/unit/test-proc-location.rb +53 -0
- data/test/unit/test-proc-main.rb +99 -0
- data/test/unit/test-proc-validate.rb +91 -0
- data/test/unit/test-subcmd-help.rb +47 -0
- metadata +398 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
|
4
|
+
# Communication status codes
|
5
|
+
module Trepanning
|
6
|
+
# Most of these go from debugged process to front-end
|
7
|
+
# client interface. COMMAND goes the other way.
|
8
|
+
module RemoteCommunication
|
9
|
+
unless defined?(PRINT)
|
10
|
+
PRINT = '.'
|
11
|
+
COMMAND = 'C'
|
12
|
+
CONFIRM_TRUE = 'Y'
|
13
|
+
CONFIRM_FALSE = 'N'
|
14
|
+
CONFIRM_REPLY = '?'
|
15
|
+
QUIT = 'q'
|
16
|
+
PROMPT = 'p'
|
17
|
+
RESTART = 'r'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,385 @@
|
|
1
|
+
!RBIX
|
2
|
+
0
|
3
|
+
x
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
28
|
13
|
+
99
|
14
|
+
7
|
15
|
+
0
|
16
|
+
65
|
17
|
+
49
|
18
|
+
1
|
19
|
+
2
|
20
|
+
13
|
21
|
+
99
|
22
|
+
12
|
23
|
+
7
|
24
|
+
2
|
25
|
+
12
|
26
|
+
7
|
27
|
+
3
|
28
|
+
12
|
29
|
+
65
|
30
|
+
12
|
31
|
+
49
|
32
|
+
4
|
33
|
+
4
|
34
|
+
15
|
35
|
+
49
|
36
|
+
2
|
37
|
+
0
|
38
|
+
15
|
39
|
+
2
|
40
|
+
11
|
41
|
+
I
|
42
|
+
6
|
43
|
+
I
|
44
|
+
0
|
45
|
+
I
|
46
|
+
0
|
47
|
+
I
|
48
|
+
0
|
49
|
+
n
|
50
|
+
p
|
51
|
+
5
|
52
|
+
x
|
53
|
+
10
|
54
|
+
Trepanning
|
55
|
+
x
|
56
|
+
11
|
57
|
+
open_module
|
58
|
+
x
|
59
|
+
15
|
60
|
+
__module_init__
|
61
|
+
M
|
62
|
+
1
|
63
|
+
n
|
64
|
+
n
|
65
|
+
x
|
66
|
+
10
|
67
|
+
Trepanning
|
68
|
+
i
|
69
|
+
28
|
70
|
+
5
|
71
|
+
66
|
72
|
+
99
|
73
|
+
7
|
74
|
+
0
|
75
|
+
65
|
76
|
+
49
|
77
|
+
1
|
78
|
+
2
|
79
|
+
13
|
80
|
+
99
|
81
|
+
12
|
82
|
+
7
|
83
|
+
2
|
84
|
+
12
|
85
|
+
7
|
86
|
+
3
|
87
|
+
12
|
88
|
+
65
|
89
|
+
12
|
90
|
+
49
|
91
|
+
4
|
92
|
+
4
|
93
|
+
15
|
94
|
+
49
|
95
|
+
2
|
96
|
+
0
|
97
|
+
11
|
98
|
+
I
|
99
|
+
6
|
100
|
+
I
|
101
|
+
0
|
102
|
+
I
|
103
|
+
0
|
104
|
+
I
|
105
|
+
0
|
106
|
+
n
|
107
|
+
p
|
108
|
+
5
|
109
|
+
x
|
110
|
+
19
|
111
|
+
RemoteCommunication
|
112
|
+
x
|
113
|
+
11
|
114
|
+
open_module
|
115
|
+
x
|
116
|
+
15
|
117
|
+
__module_init__
|
118
|
+
M
|
119
|
+
1
|
120
|
+
n
|
121
|
+
n
|
122
|
+
x
|
123
|
+
19
|
124
|
+
RemoteCommunication
|
125
|
+
i
|
126
|
+
114
|
127
|
+
5
|
128
|
+
66
|
129
|
+
26
|
130
|
+
93
|
131
|
+
0
|
132
|
+
15
|
133
|
+
29
|
134
|
+
17
|
135
|
+
0
|
136
|
+
7
|
137
|
+
0
|
138
|
+
98
|
139
|
+
1
|
140
|
+
1
|
141
|
+
30
|
142
|
+
8
|
143
|
+
23
|
144
|
+
25
|
145
|
+
92
|
146
|
+
0
|
147
|
+
27
|
148
|
+
8
|
149
|
+
28
|
150
|
+
15
|
151
|
+
7
|
152
|
+
2
|
153
|
+
8
|
154
|
+
29
|
155
|
+
1
|
156
|
+
9
|
157
|
+
34
|
158
|
+
1
|
159
|
+
8
|
160
|
+
113
|
161
|
+
65
|
162
|
+
7
|
163
|
+
0
|
164
|
+
7
|
165
|
+
3
|
166
|
+
64
|
167
|
+
49
|
168
|
+
4
|
169
|
+
2
|
170
|
+
15
|
171
|
+
65
|
172
|
+
7
|
173
|
+
5
|
174
|
+
7
|
175
|
+
6
|
176
|
+
64
|
177
|
+
49
|
178
|
+
4
|
179
|
+
2
|
180
|
+
15
|
181
|
+
65
|
182
|
+
7
|
183
|
+
7
|
184
|
+
7
|
185
|
+
8
|
186
|
+
64
|
187
|
+
49
|
188
|
+
4
|
189
|
+
2
|
190
|
+
15
|
191
|
+
65
|
192
|
+
7
|
193
|
+
9
|
194
|
+
7
|
195
|
+
10
|
196
|
+
64
|
197
|
+
49
|
198
|
+
4
|
199
|
+
2
|
200
|
+
15
|
201
|
+
65
|
202
|
+
7
|
203
|
+
11
|
204
|
+
7
|
205
|
+
12
|
206
|
+
64
|
207
|
+
49
|
208
|
+
4
|
209
|
+
2
|
210
|
+
15
|
211
|
+
65
|
212
|
+
7
|
213
|
+
13
|
214
|
+
7
|
215
|
+
14
|
216
|
+
64
|
217
|
+
49
|
218
|
+
4
|
219
|
+
2
|
220
|
+
15
|
221
|
+
65
|
222
|
+
7
|
223
|
+
15
|
224
|
+
7
|
225
|
+
16
|
226
|
+
64
|
227
|
+
49
|
228
|
+
4
|
229
|
+
2
|
230
|
+
15
|
231
|
+
65
|
232
|
+
7
|
233
|
+
17
|
234
|
+
7
|
235
|
+
18
|
236
|
+
64
|
237
|
+
49
|
238
|
+
4
|
239
|
+
2
|
240
|
+
11
|
241
|
+
I
|
242
|
+
4
|
243
|
+
I
|
244
|
+
0
|
245
|
+
I
|
246
|
+
0
|
247
|
+
I
|
248
|
+
0
|
249
|
+
n
|
250
|
+
p
|
251
|
+
19
|
252
|
+
x
|
253
|
+
5
|
254
|
+
PRINT
|
255
|
+
x
|
256
|
+
16
|
257
|
+
vm_const_defined
|
258
|
+
s
|
259
|
+
8
|
260
|
+
constant
|
261
|
+
s
|
262
|
+
1
|
263
|
+
.
|
264
|
+
x
|
265
|
+
9
|
266
|
+
const_set
|
267
|
+
x
|
268
|
+
7
|
269
|
+
COMMAND
|
270
|
+
s
|
271
|
+
1
|
272
|
+
C
|
273
|
+
x
|
274
|
+
12
|
275
|
+
CONFIRM_TRUE
|
276
|
+
s
|
277
|
+
1
|
278
|
+
Y
|
279
|
+
x
|
280
|
+
13
|
281
|
+
CONFIRM_FALSE
|
282
|
+
s
|
283
|
+
1
|
284
|
+
N
|
285
|
+
x
|
286
|
+
13
|
287
|
+
CONFIRM_REPLY
|
288
|
+
s
|
289
|
+
1
|
290
|
+
?
|
291
|
+
x
|
292
|
+
4
|
293
|
+
QUIT
|
294
|
+
s
|
295
|
+
1
|
296
|
+
q
|
297
|
+
x
|
298
|
+
6
|
299
|
+
PROMPT
|
300
|
+
s
|
301
|
+
1
|
302
|
+
p
|
303
|
+
x
|
304
|
+
7
|
305
|
+
RESTART
|
306
|
+
s
|
307
|
+
1
|
308
|
+
r
|
309
|
+
p
|
310
|
+
19
|
311
|
+
I
|
312
|
+
2
|
313
|
+
I
|
314
|
+
9
|
315
|
+
I
|
316
|
+
22
|
317
|
+
I
|
318
|
+
a
|
319
|
+
I
|
320
|
+
2c
|
321
|
+
I
|
322
|
+
b
|
323
|
+
I
|
324
|
+
36
|
325
|
+
I
|
326
|
+
c
|
327
|
+
I
|
328
|
+
40
|
329
|
+
I
|
330
|
+
d
|
331
|
+
I
|
332
|
+
4a
|
333
|
+
I
|
334
|
+
e
|
335
|
+
I
|
336
|
+
54
|
337
|
+
I
|
338
|
+
f
|
339
|
+
I
|
340
|
+
5e
|
341
|
+
I
|
342
|
+
10
|
343
|
+
I
|
344
|
+
68
|
345
|
+
I
|
346
|
+
11
|
347
|
+
I
|
348
|
+
72
|
349
|
+
x
|
350
|
+
61
|
351
|
+
/home/rocky-rvm/.rvm/src/rbx-trepanning/interface/comcodes.rb
|
352
|
+
p
|
353
|
+
0
|
354
|
+
x
|
355
|
+
13
|
356
|
+
attach_method
|
357
|
+
p
|
358
|
+
3
|
359
|
+
I
|
360
|
+
2
|
361
|
+
I
|
362
|
+
8
|
363
|
+
I
|
364
|
+
1c
|
365
|
+
x
|
366
|
+
61
|
367
|
+
/home/rocky-rvm/.rvm/src/rbx-trepanning/interface/comcodes.rb
|
368
|
+
p
|
369
|
+
0
|
370
|
+
x
|
371
|
+
13
|
372
|
+
attach_method
|
373
|
+
p
|
374
|
+
3
|
375
|
+
I
|
376
|
+
0
|
377
|
+
I
|
378
|
+
5
|
379
|
+
I
|
380
|
+
1c
|
381
|
+
x
|
382
|
+
61
|
383
|
+
/home/rocky-rvm/.rvm/src/rbx-trepanning/interface/comcodes.rb
|
384
|
+
p
|
385
|
+
0
|
data/interface/script.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
|
4
|
+
# Module for reading debugger scripts
|
5
|
+
|
6
|
+
# Our local modules
|
7
|
+
require 'rubygems'; require 'require_relative'
|
8
|
+
require_relative 'base_intf'
|
9
|
+
require_relative '../io/input'
|
10
|
+
require_relative '../io/string_array'
|
11
|
+
|
12
|
+
# Interface when reading debugger scripts
|
13
|
+
class Trepan::ScriptInterface < Trepan::Interface
|
14
|
+
|
15
|
+
DEFAULT_OPTS = {
|
16
|
+
:abort_on_error => true,
|
17
|
+
:confirm_val => false,
|
18
|
+
:verbose => false
|
19
|
+
} unless defined?(DEFAULT_OPTS)
|
20
|
+
|
21
|
+
def initialize(script_name, out=nil, opts={})
|
22
|
+
|
23
|
+
@opts = DEFAULT_OPTS.merge(opts)
|
24
|
+
|
25
|
+
at_exit { finalize }
|
26
|
+
@script_name = script_name
|
27
|
+
@input_lineno = 0
|
28
|
+
@input = opts[:input] ||
|
29
|
+
Trepan::UserInput.open(script_name, :line_edit => false)
|
30
|
+
@buffer_output = []
|
31
|
+
unless opts[:verbose] or out
|
32
|
+
out = Trepan::StringArrayOutput.open(@buffer_output)
|
33
|
+
end
|
34
|
+
super(@input, out, @opts)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Closes input only.
|
38
|
+
def close
|
39
|
+
@input.close
|
40
|
+
end
|
41
|
+
|
42
|
+
# Called when a dangerous action is about to be done, to make
|
43
|
+
# sure it's okay.
|
44
|
+
#
|
45
|
+
# Could look also look for interactive input and
|
46
|
+
# use that. For now, though we'll simplify.
|
47
|
+
def confirm(prompt, default)
|
48
|
+
@opts[:default_confirm]
|
49
|
+
end
|
50
|
+
|
51
|
+
# Common routine for reporting debugger error messages.
|
52
|
+
#
|
53
|
+
def errmsg(msg, prefix="*** ")
|
54
|
+
# self.verbose shows lines so we don't have to duplicate info
|
55
|
+
# here. Perhaps there should be a 'terse' mode to never show
|
56
|
+
# position info.
|
57
|
+
mess = if not @opts[:verbose]
|
58
|
+
location = ("%s:%s: Error in source command file" %
|
59
|
+
[@script_name, @input_lineno])
|
60
|
+
"%s%s:\n%s%s" % [prefix, location, prefix, msg]
|
61
|
+
else
|
62
|
+
"%s%s" % [prefix, msg]
|
63
|
+
end
|
64
|
+
msg(mess)
|
65
|
+
# FIXME: should we just set a flag and report eof? to be more
|
66
|
+
# consistent with File and IO?
|
67
|
+
raise IOError if @opts[:abort_on_error]
|
68
|
+
end
|
69
|
+
|
70
|
+
def interactive? ; false end
|
71
|
+
|
72
|
+
# Script interface to read a command. `prompt' is a parameter for
|
73
|
+
# compatibilty and is ignored.
|
74
|
+
def read_command(prompt='')
|
75
|
+
@input_lineno += 1
|
76
|
+
line = readline
|
77
|
+
if @opts[:verbose]
|
78
|
+
location = "%s line %s" % [@script_name, @input_lineno]
|
79
|
+
msg('+ %s: %s' % [location, line])
|
80
|
+
end
|
81
|
+
# Do something with history?
|
82
|
+
return line
|
83
|
+
end
|
84
|
+
|
85
|
+
# Script interface to read a line. `prompt' is a parameter for
|
86
|
+
# compatibilty and is ignored.
|
87
|
+
#
|
88
|
+
# Could decide make this look for interactive input?
|
89
|
+
def readline(prompt='')
|
90
|
+
begin
|
91
|
+
return input.readline().chomp
|
92
|
+
rescue EOFError
|
93
|
+
@eof = true
|
94
|
+
raise EOFError
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Demo
|
100
|
+
if __FILE__ == $0
|
101
|
+
intf = Trepan::ScriptInterface.new(__FILE__)
|
102
|
+
line = intf.readline()
|
103
|
+
print "Line read: ", line
|
104
|
+
end
|