rbx-trepanning 0.0.3-universal-rubinius-1.2 → 0.0.4-universal-rubinius-1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +152 -55
- data/NEWS +7 -0
- data/Rakefile +1 -1
- data/app/breakpoint.rb +3 -2
- data/app/breakpoint.rbc +207 -220
- data/app/brkptmgr.rb +84 -82
- data/app/brkptmgr.rbc +263 -193
- data/app/client.rb +61 -0
- data/app/client.rbc +1225 -0
- data/app/default.rb +17 -7
- data/app/default.rbc +302 -181
- data/app/display.rb +134 -21
- data/app/display.rbc +2176 -566
- data/app/iseq.rb +33 -11
- data/app/iseq.rbc +634 -243
- data/app/llvm.rbc +2576 -0
- data/app/options.rb +51 -20
- data/app/options.rb.orig +154 -0
- data/app/options.rbc +1148 -561
- data/app/rbx-llvm.rb +165 -0
- data/app/util.rb +1 -1
- data/app/util.rbc +38 -32
- data/bin/trepan.orig +0 -0
- data/bin/trepan.rej +11 -0
- data/bin/trepanx +13 -8
- data/bin/trepanx.compiled.rbc +373 -319
- data/interface/base_intf.rb +11 -5
- data/interface/base_intf.rbc +173 -70
- data/interface/client.rb +80 -0
- data/interface/client.rbc +1072 -0
- data/interface/comcodes.rb +18 -0
- data/interface/comcodes.rbc +343 -0
- data/interface/server.rb +143 -0
- data/interface/server.rbc +2213 -0
- data/interface/user.rb +1 -8
- data/interface/user.rbc +68 -165
- data/io/base_io.rb +56 -2
- data/io/base_io.rbc +727 -20
- data/io/tcpclient.rb +123 -0
- data/io/tcpclient.rbc +2327 -0
- data/io/tcpfns.rb +31 -0
- data/io/tcpfns.rbc +652 -0
- data/io/tcpserver.rb +138 -0
- data/io/tcpserver.rbc +2585 -0
- data/lib/trepanning.rb +91 -56
- data/lib/trepanning.rb.orig +433 -0
- data/lib/trepanning.rb.rej +11 -0
- data/lib/trepanning.rbc +1954 -1340
- data/processor/command/backtrace.rb +45 -15
- data/processor/command/base/cmd.rb +10 -6
- data/processor/command/base/subcmd.rb +16 -1
- data/processor/command/complete.rb +47 -0
- data/processor/command/continue.rb +4 -3
- data/processor/command/directory.rb +9 -1
- data/processor/command/disassemble.rb +22 -7
- data/processor/command/display.rb +82 -0
- data/processor/command/eval.rb +3 -1
- data/processor/command/exit.rb +4 -0
- data/processor/command/help.rb +69 -18
- data/processor/command/info_subcmd/breakpoints.rb +6 -8
- data/processor/command/info_subcmd/file.rb +5 -7
- data/processor/command/info_subcmd/method.rb +9 -9
- data/processor/command/info_subcmd/program.rb +3 -4
- data/processor/command/info_subcmd/variables.rb +4 -3
- data/processor/command/list.rb +8 -4
- data/processor/command/nexti.rb +2 -2
- data/processor/command/pr.rb +2 -2
- data/processor/command/ps.rb +2 -2
- data/processor/command/server.rb +72 -0
- data/processor/command/set_subcmd/auto.rb +2 -3
- data/processor/command/set_subcmd/basename.rb +3 -4
- data/processor/command/set_subcmd/debug.rb +2 -3
- data/processor/command/set_subcmd/different.rb +3 -4
- data/processor/command/set_subcmd/hidelevel.rb +6 -7
- data/processor/command/set_subcmd/highlight.rb +33 -0
- data/processor/command/set_subcmd/kernelstep.rb +3 -4
- data/processor/command/set_subcmd/max.rb +2 -4
- data/processor/command/set_subcmd/max_subcmd/string.rb +44 -22
- data/processor/command/set_subcmd/substitute.rb +2 -3
- data/processor/command/set_subcmd/trace.rb +3 -4
- data/processor/command/show_subcmd/alias.rb +3 -4
- data/processor/command/show_subcmd/args.rb +2 -3
- data/processor/command/show_subcmd/auto.rb +1 -2
- data/processor/command/show_subcmd/basename.rb +2 -3
- data/processor/command/show_subcmd/debug.rb +1 -2
- data/processor/command/show_subcmd/different.rb +2 -3
- data/processor/command/show_subcmd/hidelevel.rb +1 -2
- data/processor/command/show_subcmd/highlight.rb +24 -0
- data/processor/command/show_subcmd/kernelstep.rb +3 -6
- data/processor/command/show_subcmd/max.rb +4 -5
- data/processor/command/show_subcmd/trace.rb +9 -11
- data/processor/command/show_subcmd/version.rb +23 -0
- data/processor/command/source.rb +75 -31
- data/processor/command/undisplay.rb +59 -0
- data/processor/default.rb +4 -4
- data/processor/disassemble.rb +18 -5
- data/processor/display.rb +18 -0
- data/processor/location.rb +15 -5
- data/processor/main.rb +27 -13
- data/processor/mock.rb +12 -9
- data/processor/msg.rb +24 -9
- data/processor/stepping.rb +10 -12
- data/sample/list-terminal-colors.rb +139 -0
- data/sample/list-terminal-colors.rbc +2164 -0
- data/sample/rocky-dot-trepanrc.orig +0 -0
- data/sample/rocky-dot-trepanrc.rej +11 -0
- data/sample/rocky-dot-trepanxrc +14 -0
- data/sample/rocky-trepanx-colors.rb +39 -0
- data/test/data/fname-with-blank.right +3 -0
- data/test/data/inline-call.cmd +6 -0
- data/test/data/inline-call.right +13 -0
- data/test/data/quit.right +2 -0
- data/test/example/{gcd1.rb → gcd-server.rb} +4 -6
- data/test/example/gcd.rb +0 -0
- data/test/example/inline-call.rb +23 -0
- data/test/integration/helper.rb +8 -8
- data/test/integration/test-fname-with-blank.rb +5 -1
- data/test/integration/test-inline-call.rb +20 -0
- data/test/integration/test-quit.rb +5 -1
- data/test/unit/cmd-helper.rb +7 -4
- data/test/unit/mock-helper.rb +1 -0
- data/test/unit/test-app-brkpt.rb +4 -5
- data/test/unit/test-app-brkptmgr.rb +2 -2
- data/test/unit/test-app-iseq.rb +29 -14
- data/test/unit/test-app-options.rb +26 -5
- data/test/unit/test-base-subcmd.rb +1 -1
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-io-tcp.rb +33 -0
- data/test/unit/test-io-tcpclient.rb +53 -0
- data/test/unit/test-io-tcpfns.rb +17 -0
- data/test/unit/test-io-tcpserver.rb +50 -0
- data/test/unit/test-proc-main.rb +6 -2
- metadata +53 -10
- data/test/example/gcd-xx.rb +0 -18
@@ -0,0 +1,18 @@
|
|
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
|
+
PRINT = '.'
|
10
|
+
COMMAND = 'C'
|
11
|
+
CONFIRM_TRUE = 'Y'
|
12
|
+
CONFIRM_FALSE = 'N'
|
13
|
+
CONFIRM_REPLY = '?'
|
14
|
+
QUIT = 'q'
|
15
|
+
PROMPT = 'p'
|
16
|
+
RESTART = 'r'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,343 @@
|
|
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
|
+
82
|
127
|
+
5
|
128
|
+
66
|
129
|
+
65
|
130
|
+
7
|
131
|
+
0
|
132
|
+
7
|
133
|
+
1
|
134
|
+
64
|
135
|
+
49
|
136
|
+
2
|
137
|
+
2
|
138
|
+
15
|
139
|
+
65
|
140
|
+
7
|
141
|
+
3
|
142
|
+
7
|
143
|
+
4
|
144
|
+
64
|
145
|
+
49
|
146
|
+
2
|
147
|
+
2
|
148
|
+
15
|
149
|
+
65
|
150
|
+
7
|
151
|
+
5
|
152
|
+
7
|
153
|
+
6
|
154
|
+
64
|
155
|
+
49
|
156
|
+
2
|
157
|
+
2
|
158
|
+
15
|
159
|
+
65
|
160
|
+
7
|
161
|
+
7
|
162
|
+
7
|
163
|
+
8
|
164
|
+
64
|
165
|
+
49
|
166
|
+
2
|
167
|
+
2
|
168
|
+
15
|
169
|
+
65
|
170
|
+
7
|
171
|
+
9
|
172
|
+
7
|
173
|
+
10
|
174
|
+
64
|
175
|
+
49
|
176
|
+
2
|
177
|
+
2
|
178
|
+
15
|
179
|
+
65
|
180
|
+
7
|
181
|
+
11
|
182
|
+
7
|
183
|
+
12
|
184
|
+
64
|
185
|
+
49
|
186
|
+
2
|
187
|
+
2
|
188
|
+
15
|
189
|
+
65
|
190
|
+
7
|
191
|
+
13
|
192
|
+
7
|
193
|
+
14
|
194
|
+
64
|
195
|
+
49
|
196
|
+
2
|
197
|
+
2
|
198
|
+
15
|
199
|
+
65
|
200
|
+
7
|
201
|
+
15
|
202
|
+
7
|
203
|
+
16
|
204
|
+
64
|
205
|
+
49
|
206
|
+
2
|
207
|
+
2
|
208
|
+
11
|
209
|
+
I
|
210
|
+
3
|
211
|
+
I
|
212
|
+
0
|
213
|
+
I
|
214
|
+
0
|
215
|
+
I
|
216
|
+
0
|
217
|
+
n
|
218
|
+
p
|
219
|
+
17
|
220
|
+
x
|
221
|
+
5
|
222
|
+
PRINT
|
223
|
+
s
|
224
|
+
1
|
225
|
+
.
|
226
|
+
x
|
227
|
+
9
|
228
|
+
const_set
|
229
|
+
x
|
230
|
+
7
|
231
|
+
COMMAND
|
232
|
+
s
|
233
|
+
1
|
234
|
+
C
|
235
|
+
x
|
236
|
+
12
|
237
|
+
CONFIRM_TRUE
|
238
|
+
s
|
239
|
+
1
|
240
|
+
Y
|
241
|
+
x
|
242
|
+
13
|
243
|
+
CONFIRM_FALSE
|
244
|
+
s
|
245
|
+
1
|
246
|
+
N
|
247
|
+
x
|
248
|
+
13
|
249
|
+
CONFIRM_REPLY
|
250
|
+
s
|
251
|
+
1
|
252
|
+
?
|
253
|
+
x
|
254
|
+
4
|
255
|
+
QUIT
|
256
|
+
s
|
257
|
+
1
|
258
|
+
q
|
259
|
+
x
|
260
|
+
6
|
261
|
+
PROMPT
|
262
|
+
s
|
263
|
+
1
|
264
|
+
p
|
265
|
+
x
|
266
|
+
7
|
267
|
+
RESTART
|
268
|
+
s
|
269
|
+
1
|
270
|
+
r
|
271
|
+
p
|
272
|
+
17
|
273
|
+
I
|
274
|
+
2
|
275
|
+
I
|
276
|
+
9
|
277
|
+
I
|
278
|
+
c
|
279
|
+
I
|
280
|
+
a
|
281
|
+
I
|
282
|
+
16
|
283
|
+
I
|
284
|
+
b
|
285
|
+
I
|
286
|
+
20
|
287
|
+
I
|
288
|
+
c
|
289
|
+
I
|
290
|
+
2a
|
291
|
+
I
|
292
|
+
d
|
293
|
+
I
|
294
|
+
34
|
295
|
+
I
|
296
|
+
e
|
297
|
+
I
|
298
|
+
3e
|
299
|
+
I
|
300
|
+
f
|
301
|
+
I
|
302
|
+
48
|
303
|
+
I
|
304
|
+
10
|
305
|
+
I
|
306
|
+
52
|
307
|
+
x
|
308
|
+
61
|
309
|
+
/home/rocky-rvm/.rvm/src/rbx-trepanning/interface/comcodes.rb
|
310
|
+
p
|
311
|
+
0
|
312
|
+
x
|
313
|
+
13
|
314
|
+
attach_method
|
315
|
+
p
|
316
|
+
3
|
317
|
+
I
|
318
|
+
2
|
319
|
+
I
|
320
|
+
8
|
321
|
+
I
|
322
|
+
1c
|
323
|
+
x
|
324
|
+
61
|
325
|
+
/home/rocky-rvm/.rvm/src/rbx-trepanning/interface/comcodes.rb
|
326
|
+
p
|
327
|
+
0
|
328
|
+
x
|
329
|
+
13
|
330
|
+
attach_method
|
331
|
+
p
|
332
|
+
3
|
333
|
+
I
|
334
|
+
0
|
335
|
+
I
|
336
|
+
5
|
337
|
+
I
|
338
|
+
1c
|
339
|
+
x
|
340
|
+
61
|
341
|
+
/home/rocky-rvm/.rvm/src/rbx-trepanning/interface/comcodes.rb
|
342
|
+
p
|
343
|
+
0
|
data/interface/server.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
|
4
|
+
# Our local modules
|
5
|
+
require 'rubygems'; require 'require_relative'
|
6
|
+
require_relative 'base_intf'
|
7
|
+
require_relative 'comcodes'
|
8
|
+
require_relative '../io/input'
|
9
|
+
require_relative '../io/tcpserver'
|
10
|
+
|
11
|
+
# Mfifoserver = import_relative('fifoserver', '..io', 'pydbgr')
|
12
|
+
|
13
|
+
# Interface for debugging a program but having user control
|
14
|
+
# reside outside of the debugged process, possibly on another
|
15
|
+
# computer
|
16
|
+
class Trepan::ServerInterface < Trepan::Interface
|
17
|
+
|
18
|
+
include Trepanning::RemoteCommunication
|
19
|
+
|
20
|
+
DEFAULT_INIT_CONNECTION_OPTS = {
|
21
|
+
:io => 'TCP'
|
22
|
+
} unless defined?(DEFAULT_INIT_CONNECTION_OPTS)
|
23
|
+
|
24
|
+
def initialize(inout=nil, out=nil, connection_opts={})
|
25
|
+
|
26
|
+
@connection_opts = DEFAULT_INIT_CONNECTION_OPTS.merge(connection_opts)
|
27
|
+
|
28
|
+
at_exit { finalize }
|
29
|
+
@inout =
|
30
|
+
if inout
|
31
|
+
inout
|
32
|
+
else
|
33
|
+
server_type = @connection_opts[:io]
|
34
|
+
# FIXME: complete this.
|
35
|
+
# if 'FIFO' == server_type
|
36
|
+
# FIFOServer.new
|
37
|
+
# else
|
38
|
+
Trepan::TCPDbgServer.new(@connection_opts)
|
39
|
+
# end
|
40
|
+
end
|
41
|
+
# For Compatability
|
42
|
+
@output = @inout
|
43
|
+
@input = @inout
|
44
|
+
@interactive = true # Or at least so we think initially
|
45
|
+
end
|
46
|
+
|
47
|
+
# Closes both input and output
|
48
|
+
def close
|
49
|
+
if @inout && @inout.connected?
|
50
|
+
@inout.write(QUIT + 'bye')
|
51
|
+
@inout.close
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Called when a dangerous action is about to be done to make sure
|
56
|
+
# it's okay. `prompt' is printed; user response is returned.
|
57
|
+
# FIXME: make common routine for this and user.rb
|
58
|
+
def confirm(prompt, default)
|
59
|
+
while true
|
60
|
+
begin
|
61
|
+
write_confirm(prompt, default)
|
62
|
+
reply = readline(nil).strip.downcase
|
63
|
+
rescue EOFError
|
64
|
+
return default
|
65
|
+
end
|
66
|
+
if YES.member?(reply)
|
67
|
+
return true
|
68
|
+
elsif NO.member?(reply)
|
69
|
+
return false
|
70
|
+
else
|
71
|
+
msg "Please answer 'yes' or 'no'. Try again."
|
72
|
+
end
|
73
|
+
end
|
74
|
+
return default
|
75
|
+
end
|
76
|
+
|
77
|
+
# Return true if we are connected
|
78
|
+
def connected?
|
79
|
+
:connected == @inout.state
|
80
|
+
end
|
81
|
+
|
82
|
+
# print exit annotation
|
83
|
+
def finalize(last_wishes=QUIT)
|
84
|
+
@inout.writeline(last_wishes) if connected?
|
85
|
+
close
|
86
|
+
end
|
87
|
+
|
88
|
+
def input_eof?
|
89
|
+
false
|
90
|
+
end
|
91
|
+
|
92
|
+
# used to write to a debugger that is connected to this
|
93
|
+
# server; `str' written will have a newline added to it
|
94
|
+
def msg(msg)
|
95
|
+
@inout.writeline(PRINT + msg)
|
96
|
+
end
|
97
|
+
|
98
|
+
# used to write to a debugger that is connected to this
|
99
|
+
# server; `str' written will not have a newline added to it
|
100
|
+
def msg_nocr(msg)
|
101
|
+
@inout.write(PRINT + msg)
|
102
|
+
end
|
103
|
+
|
104
|
+
def read_command(prompt)
|
105
|
+
readline(prompt)
|
106
|
+
end
|
107
|
+
|
108
|
+
def read_data
|
109
|
+
@inout.read_dat
|
110
|
+
end
|
111
|
+
|
112
|
+
def readline(prompt, add_to_history=true)
|
113
|
+
if prompt
|
114
|
+
write_prompt(prompt)
|
115
|
+
end
|
116
|
+
coded_line = @inout.read_msg()
|
117
|
+
@read_ctrl = coded_line[0..0]
|
118
|
+
coded_line[1..-1]
|
119
|
+
end
|
120
|
+
|
121
|
+
# Return connected
|
122
|
+
def state
|
123
|
+
@inout.state
|
124
|
+
end
|
125
|
+
|
126
|
+
def write_prompt(prompt)
|
127
|
+
@inout.write(PROMPT + prompt)
|
128
|
+
end
|
129
|
+
|
130
|
+
def write_confirm(prompt, default)
|
131
|
+
if default
|
132
|
+
code = CONFIRM_TRUE
|
133
|
+
else
|
134
|
+
code = CONFIRM_FALSE
|
135
|
+
end
|
136
|
+
@inout.write(code + prompt)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# Demo
|
141
|
+
if __FILE__ == $0
|
142
|
+
intf = Trepan::ServerInterface.new(nil, nil, :open => false)
|
143
|
+
end
|