rbx-trepanning 0.0.1-universal-rubinius

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. data/ChangeLog +376 -0
  2. data/LICENSE +25 -0
  3. data/NEWS +2 -0
  4. data/README.textile +28 -0
  5. data/Rakefile +165 -0
  6. data/THANKS +14 -0
  7. data/app/breakpoint.rb +218 -0
  8. data/app/breakpoint.rbc +3564 -0
  9. data/app/brkptmgr.rb +138 -0
  10. data/app/brkptmgr.rbc +2827 -0
  11. data/app/default.rb +61 -0
  12. data/app/default.rbc +1011 -0
  13. data/app/display.rb +35 -0
  14. data/app/display.rbc +968 -0
  15. data/app/frame.rb +98 -0
  16. data/app/frame.rbc +1808 -0
  17. data/app/irb.rb +112 -0
  18. data/app/irb.rbc +2111 -0
  19. data/app/iseq.rb +95 -0
  20. data/app/iseq.rbc +1801 -0
  21. data/app/method.rb +173 -0
  22. data/app/method.rbc +2492 -0
  23. data/app/mock.rb +13 -0
  24. data/app/mock.rbc +398 -0
  25. data/app/options.rb +123 -0
  26. data/app/options.rbc +2183 -0
  27. data/app/run.rb +86 -0
  28. data/app/run.rbc +1244 -0
  29. data/app/util.rb +49 -0
  30. data/app/util.rbc +1144 -0
  31. data/app/validate.rb +30 -0
  32. data/app/validate.rbc +676 -0
  33. data/bin/trepan.compiled.rbc +1043 -0
  34. data/bin/trepanx +63 -0
  35. data/bin/trepanx.compiled.rbc +985 -0
  36. data/interface/base_intf.rb +95 -0
  37. data/interface/base_intf.rbc +1742 -0
  38. data/interface/script.rb +104 -0
  39. data/interface/script.rbc +1642 -0
  40. data/interface/user.rb +91 -0
  41. data/interface/user.rbc +1418 -0
  42. data/io/base_io.rb +94 -0
  43. data/io/base_io.rbc +1404 -0
  44. data/io/input.rb +112 -0
  45. data/io/input.rbc +1979 -0
  46. data/io/null_output.rb +42 -0
  47. data/io/null_output.rbc +730 -0
  48. data/io/string_array.rb +156 -0
  49. data/io/string_array.rbc +2466 -0
  50. data/lib/trepanning.rb +398 -0
  51. data/lib/trepanning.rbc +6661 -0
  52. data/processor/breakpoint.rb +161 -0
  53. data/processor/command/alias.rb +55 -0
  54. data/processor/command/backtrace.rb +46 -0
  55. data/processor/command/base/cmd.rb +124 -0
  56. data/processor/command/base/subcmd.rb +213 -0
  57. data/processor/command/base/submgr.rb +179 -0
  58. data/processor/command/base/subsubcmd.rb +103 -0
  59. data/processor/command/base/subsubmgr.rb +184 -0
  60. data/processor/command/break.rb +100 -0
  61. data/processor/command/continue.rb +82 -0
  62. data/processor/command/delete.rb +30 -0
  63. data/processor/command/directory.rb +43 -0
  64. data/processor/command/disassemble.rb +103 -0
  65. data/processor/command/down.rb +54 -0
  66. data/processor/command/eval.rb +31 -0
  67. data/processor/command/exit.rb +58 -0
  68. data/processor/command/finish.rb +78 -0
  69. data/processor/command/frame.rb +89 -0
  70. data/processor/command/help.rb +146 -0
  71. data/processor/command/info.rb +28 -0
  72. data/processor/command/info_subcmd/breakpoints.rb +75 -0
  73. data/processor/command/info_subcmd/file.rb +153 -0
  74. data/processor/command/info_subcmd/method.rb +71 -0
  75. data/processor/command/info_subcmd/program.rb +59 -0
  76. data/processor/command/info_subcmd/variables.rb +40 -0
  77. data/processor/command/irb.rb +96 -0
  78. data/processor/command/kill.rb +70 -0
  79. data/processor/command/list.rb +296 -0
  80. data/processor/command/next.rb +66 -0
  81. data/processor/command/nexti.rb +59 -0
  82. data/processor/command/pr.rb +38 -0
  83. data/processor/command/ps.rb +40 -0
  84. data/processor/command/restart.rb +60 -0
  85. data/processor/command/set.rb +47 -0
  86. data/processor/command/set_subcmd/auto.rb +28 -0
  87. data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
  88. data/processor/command/set_subcmd/auto_subcmd/eval.rb +54 -0
  89. data/processor/command/set_subcmd/auto_subcmd/irb.rb +34 -0
  90. data/processor/command/set_subcmd/auto_subcmd/list.rb +34 -0
  91. data/processor/command/set_subcmd/basename.rb +26 -0
  92. data/processor/command/set_subcmd/debug.rb +27 -0
  93. data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +36 -0
  94. data/processor/command/set_subcmd/debug_subcmd/skip.rb +23 -0
  95. data/processor/command/set_subcmd/debug_subcmd/step.rb +23 -0
  96. data/processor/command/set_subcmd/different.rb +60 -0
  97. data/processor/command/set_subcmd/hidelevel.rb +63 -0
  98. data/processor/command/set_subcmd/kernelstep.rb +61 -0
  99. data/processor/command/set_subcmd/max.rb +29 -0
  100. data/processor/command/set_subcmd/max_subcmd/list.rb +49 -0
  101. data/processor/command/set_subcmd/max_subcmd/stack.rb +50 -0
  102. data/processor/command/set_subcmd/max_subcmd/string.rb +54 -0
  103. data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
  104. data/processor/command/set_subcmd/substitute.rb +25 -0
  105. data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
  106. data/processor/command/set_subcmd/trace.rb +37 -0
  107. data/processor/command/set_subcmd/trace_subcmd/print.rb +57 -0
  108. data/processor/command/show.rb +27 -0
  109. data/processor/command/show_subcmd/alias.rb +43 -0
  110. data/processor/command/show_subcmd/args.rb +26 -0
  111. data/processor/command/show_subcmd/auto.rb +28 -0
  112. data/processor/command/show_subcmd/auto_subcmd/dis.rb +37 -0
  113. data/processor/command/show_subcmd/auto_subcmd/eval.rb +28 -0
  114. data/processor/command/show_subcmd/auto_subcmd/irb.rb +23 -0
  115. data/processor/command/show_subcmd/auto_subcmd/list.rb +22 -0
  116. data/processor/command/show_subcmd/basename.rb +22 -0
  117. data/processor/command/show_subcmd/debug.rb +27 -0
  118. data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +21 -0
  119. data/processor/command/show_subcmd/debug_subcmd/skip.rb +22 -0
  120. data/processor/command/show_subcmd/debug_subcmd/step.rb +22 -0
  121. data/processor/command/show_subcmd/different.rb +27 -0
  122. data/processor/command/show_subcmd/hidelevel.rb +42 -0
  123. data/processor/command/show_subcmd/kernelstep.rb +37 -0
  124. data/processor/command/show_subcmd/max.rb +30 -0
  125. data/processor/command/show_subcmd/max_subcmd/list.rb +38 -0
  126. data/processor/command/show_subcmd/max_subcmd/stack.rb +36 -0
  127. data/processor/command/show_subcmd/max_subcmd/string.rb +42 -0
  128. data/processor/command/show_subcmd/max_subcmd/width.rb +37 -0
  129. data/processor/command/show_subcmd/trace.rb +29 -0
  130. data/processor/command/show_subcmd/trace_subcmd/print.rb +38 -0
  131. data/processor/command/source.rb +83 -0
  132. data/processor/command/step.rb +41 -0
  133. data/processor/command/tbreak.rb +19 -0
  134. data/processor/command/unalias.rb +44 -0
  135. data/processor/command/up.rb +87 -0
  136. data/processor/default.rb +56 -0
  137. data/processor/disassemble.rb +32 -0
  138. data/processor/eval.rb +96 -0
  139. data/processor/frame.rb +211 -0
  140. data/processor/help.rb +72 -0
  141. data/processor/hook.rb +133 -0
  142. data/processor/load_cmds.rb +101 -0
  143. data/processor/location.rb +128 -0
  144. data/processor/main.rb +394 -0
  145. data/processor/mock.rb +137 -0
  146. data/processor/msg.rb +28 -0
  147. data/processor/running.rb +230 -0
  148. data/processor/stepping.rb +115 -0
  149. data/processor/subcmd.rb +160 -0
  150. data/processor/validate.rb +355 -0
  151. data/test/data/enable.right +36 -0
  152. data/test/data/fname-with-blank.cmd +6 -0
  153. data/test/data/fname-with-blank.right +1 -0
  154. data/test/data/quit-Xdebug.right +3 -0
  155. data/test/data/quit.cmd +5 -0
  156. data/test/data/quit.right +0 -0
  157. data/test/example/fname with blank.rb +1 -0
  158. data/test/example/gcd-xx.rb +18 -0
  159. data/test/example/gcd.rb +19 -0
  160. data/test/example/gcd1.rb +24 -0
  161. data/test/example/null.rb +1 -0
  162. data/test/example/thread1.rb +3 -0
  163. data/test/functional/fn_helper.rb +112 -0
  164. data/test/functional/test-break-name.rb +52 -0
  165. data/test/functional/test-break.rb +51 -0
  166. data/test/functional/test-finish.rb +70 -0
  167. data/test/functional/test-fn_helper.rb +43 -0
  168. data/test/functional/test-list.rb +55 -0
  169. data/test/functional/test-next-bug.rb +49 -0
  170. data/test/functional/test-next.rb +101 -0
  171. data/test/functional/test-step.rb +272 -0
  172. data/test/functional/test-step2.rb +35 -0
  173. data/test/functional/test-tbreak.rb +41 -0
  174. data/test/integration/file-diff.rb +89 -0
  175. data/test/integration/helper.rb +78 -0
  176. data/test/integration/test-fname-with-blank.rb +12 -0
  177. data/test/integration/test-quit.rb +25 -0
  178. data/test/unit/cmd-helper.rb +46 -0
  179. data/test/unit/test-app-brkpt.rb +30 -0
  180. data/test/unit/test-app-brkptmgr.rb +51 -0
  181. data/test/unit/test-app-iseq.rb +49 -0
  182. data/test/unit/test-app-method.rb +54 -0
  183. data/test/unit/test-app-options.rb +61 -0
  184. data/test/unit/test-app-run.rb +16 -0
  185. data/test/unit/test-app-util.rb +28 -0
  186. data/test/unit/test-app-validate.rb +18 -0
  187. data/test/unit/test-base-subcmd.rb +61 -0
  188. data/test/unit/test-bin-trepanx.rb +48 -0
  189. data/test/unit/test-cmd-alias.rb +49 -0
  190. data/test/unit/test-cmd-break.rb +23 -0
  191. data/test/unit/test-cmd-exit.rb +27 -0
  192. data/test/unit/test-cmd-help.rb +101 -0
  193. data/test/unit/test-cmd-kill.rb +48 -0
  194. data/test/unit/test-intf-user.rb +46 -0
  195. data/test/unit/test-io-input.rb +27 -0
  196. data/test/unit/test-proc-eval.rb +37 -0
  197. data/test/unit/test-proc-frame.rb +79 -0
  198. data/test/unit/test-proc-help.rb +16 -0
  199. data/test/unit/test-proc-hook.rb +30 -0
  200. data/test/unit/test-proc-load_cmds.rb +41 -0
  201. data/test/unit/test-proc-location.rb +48 -0
  202. data/test/unit/test-proc-main.rb +96 -0
  203. data/test/unit/test-proc-validate.rb +91 -0
  204. data/test/unit/test-subcmd-help.rb +51 -0
  205. metadata +337 -0
data/app/mock.rb ADDED
@@ -0,0 +1,13 @@
1
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
2
+ class Trepan
3
+ attr_accessor :trace_filter # Procs/Methods we ignore.
4
+ def initialize(opts={})
5
+ @trace_filter = []
6
+ end
7
+ class MockCore
8
+ attr_accessor :dbgr
9
+ attr_reader :core
10
+ def event; 'line' end
11
+ end
12
+ end
13
+
data/app/mock.rbc ADDED
@@ -0,0 +1,398 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 29
13
+ 99
14
+ 7
15
+ 0
16
+ 1
17
+ 65
18
+ 49
19
+ 1
20
+ 3
21
+ 13
22
+ 99
23
+ 12
24
+ 7
25
+ 2
26
+ 12
27
+ 7
28
+ 3
29
+ 12
30
+ 65
31
+ 12
32
+ 49
33
+ 4
34
+ 4
35
+ 15
36
+ 49
37
+ 2
38
+ 0
39
+ 15
40
+ 2
41
+ 11
42
+ I
43
+ 6
44
+ I
45
+ 0
46
+ I
47
+ 0
48
+ I
49
+ 0
50
+ n
51
+ p
52
+ 5
53
+ x
54
+ 6
55
+ Trepan
56
+ x
57
+ 10
58
+ open_class
59
+ x
60
+ 14
61
+ __class_init__
62
+ M
63
+ 1
64
+ n
65
+ n
66
+ x
67
+ 6
68
+ Trepan
69
+ i
70
+ 51
71
+ 5
72
+ 66
73
+ 5
74
+ 7
75
+ 0
76
+ 47
77
+ 49
78
+ 1
79
+ 1
80
+ 15
81
+ 99
82
+ 7
83
+ 2
84
+ 7
85
+ 3
86
+ 65
87
+ 67
88
+ 49
89
+ 4
90
+ 0
91
+ 49
92
+ 5
93
+ 4
94
+ 15
95
+ 99
96
+ 7
97
+ 6
98
+ 1
99
+ 65
100
+ 49
101
+ 7
102
+ 3
103
+ 13
104
+ 99
105
+ 12
106
+ 7
107
+ 8
108
+ 12
109
+ 7
110
+ 9
111
+ 12
112
+ 65
113
+ 12
114
+ 49
115
+ 10
116
+ 4
117
+ 15
118
+ 49
119
+ 8
120
+ 0
121
+ 11
122
+ I
123
+ 6
124
+ I
125
+ 0
126
+ I
127
+ 0
128
+ I
129
+ 0
130
+ n
131
+ p
132
+ 11
133
+ x
134
+ 12
135
+ trace_filter
136
+ x
137
+ 13
138
+ attr_accessor
139
+ x
140
+ 10
141
+ initialize
142
+ M
143
+ 1
144
+ n
145
+ n
146
+ x
147
+ 10
148
+ initialize
149
+ i
150
+ 19
151
+ 23
152
+ 0
153
+ 10
154
+ 14
155
+ 44
156
+ 43
157
+ 0
158
+ 78
159
+ 49
160
+ 1
161
+ 1
162
+ 19
163
+ 0
164
+ 15
165
+ 35
166
+ 0
167
+ 38
168
+ 2
169
+ 11
170
+ I
171
+ 3
172
+ I
173
+ 1
174
+ I
175
+ 0
176
+ I
177
+ 1
178
+ n
179
+ p
180
+ 3
181
+ x
182
+ 4
183
+ Hash
184
+ x
185
+ 16
186
+ new_from_literal
187
+ x
188
+ 13
189
+ @trace_filter
190
+ p
191
+ 5
192
+ I
193
+ 0
194
+ I
195
+ 4
196
+ I
197
+ e
198
+ I
199
+ 5
200
+ I
201
+ 13
202
+ x
203
+ 51
204
+ /home/rocky-rvm/.rvm/src/rbx-trepanning/app/mock.rb
205
+ p
206
+ 1
207
+ x
208
+ 4
209
+ opts
210
+ x
211
+ 17
212
+ method_visibility
213
+ x
214
+ 15
215
+ add_defn_method
216
+ x
217
+ 8
218
+ MockCore
219
+ x
220
+ 10
221
+ open_class
222
+ x
223
+ 14
224
+ __class_init__
225
+ M
226
+ 1
227
+ n
228
+ n
229
+ x
230
+ 8
231
+ MockCore
232
+ i
233
+ 32
234
+ 5
235
+ 66
236
+ 5
237
+ 7
238
+ 0
239
+ 47
240
+ 49
241
+ 1
242
+ 1
243
+ 15
244
+ 5
245
+ 7
246
+ 2
247
+ 47
248
+ 49
249
+ 3
250
+ 1
251
+ 15
252
+ 99
253
+ 7
254
+ 4
255
+ 7
256
+ 5
257
+ 65
258
+ 67
259
+ 49
260
+ 6
261
+ 0
262
+ 49
263
+ 7
264
+ 4
265
+ 11
266
+ I
267
+ 5
268
+ I
269
+ 0
270
+ I
271
+ 0
272
+ I
273
+ 0
274
+ n
275
+ p
276
+ 8
277
+ x
278
+ 4
279
+ dbgr
280
+ x
281
+ 13
282
+ attr_accessor
283
+ x
284
+ 4
285
+ core
286
+ x
287
+ 11
288
+ attr_reader
289
+ x
290
+ 5
291
+ event
292
+ M
293
+ 1
294
+ n
295
+ n
296
+ x
297
+ 5
298
+ event
299
+ i
300
+ 4
301
+ 7
302
+ 0
303
+ 64
304
+ 11
305
+ I
306
+ 1
307
+ I
308
+ 0
309
+ I
310
+ 0
311
+ I
312
+ 0
313
+ n
314
+ p
315
+ 1
316
+ s
317
+ 4
318
+ line
319
+ p
320
+ 3
321
+ I
322
+ 0
323
+ I
324
+ a
325
+ I
326
+ 4
327
+ x
328
+ 51
329
+ /home/rocky-rvm/.rvm/src/rbx-trepanning/app/mock.rb
330
+ p
331
+ 0
332
+ x
333
+ 17
334
+ method_visibility
335
+ x
336
+ 15
337
+ add_defn_method
338
+ p
339
+ 7
340
+ I
341
+ 2
342
+ I
343
+ 8
344
+ I
345
+ a
346
+ I
347
+ 9
348
+ I
349
+ 12
350
+ I
351
+ a
352
+ I
353
+ 20
354
+ x
355
+ 51
356
+ /home/rocky-rvm/.rvm/src/rbx-trepanning/app/mock.rb
357
+ p
358
+ 0
359
+ x
360
+ 13
361
+ attach_method
362
+ p
363
+ 7
364
+ I
365
+ 2
366
+ I
367
+ 3
368
+ I
369
+ a
370
+ I
371
+ 4
372
+ I
373
+ 18
374
+ I
375
+ 7
376
+ I
377
+ 33
378
+ x
379
+ 51
380
+ /home/rocky-rvm/.rvm/src/rbx-trepanning/app/mock.rb
381
+ p
382
+ 0
383
+ x
384
+ 13
385
+ attach_method
386
+ p
387
+ 3
388
+ I
389
+ 0
390
+ I
391
+ 2
392
+ I
393
+ 1d
394
+ x
395
+ 51
396
+ /home/rocky-rvm/.rvm/src/rbx-trepanning/app/mock.rb
397
+ p
398
+ 0
data/app/options.rb ADDED
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
4
+ #=== Summary
5
+ # Parses command-line options.
6
+ #=== Options
7
+ #
8
+ #<tt>--cd=DIR</tt>
9
+ # Change current directory to DIR.
10
+ #
11
+ #<tt>--command</tt> <i>file</i>::
12
+ # Run debugger command file <i>file</i>
13
+ #
14
+ #<tt>--nx</tt>::
15
+ # Don’t execute commands found in any initialization
16
+ # files, e.g. <tt>.rdebugrc</tt>.
17
+ #
18
+ #<tt>--restore=PROFILE</tt>::
19
+ # Debugger command file which restores debugger settings,
20
+ # resumably saved before a 'restart' debugger command.
21
+ #
22
+ #<tt>--version</tt>::
23
+ # Show the version number.
24
+ #
25
+ #<tt>--help</tt>::
26
+ # Show invocation help and exit.
27
+
28
+ require 'optparse'
29
+ module Trepanning
30
+ require 'rubygems'; require 'require_relative'
31
+ require_relative 'default'
32
+
33
+ Trepanning::VERSION = '0.0.1.git' unless defined?(Trepanning::VERSION)
34
+ Trepanning::PROGRAM = 'trepan' unless defined?(Trepanning::PROGRAM)
35
+
36
+ def show_version
37
+ "#{PROGRAM} version #{VERSION}"
38
+ end
39
+
40
+ def copy_default_options
41
+ options = {}
42
+ DEFAULT_CMDLINE_SETTINGS.each do |key, value|
43
+ begin
44
+ options[key] = value.clone
45
+ rescue TypeError
46
+ options[key] = value
47
+ end
48
+ end
49
+ options
50
+ end
51
+
52
+ def setup_options(options, stdout=$stdout, stderr=$stderr)
53
+ OptionParser.new do |opts|
54
+ opts.banner = <<EOB
55
+ #{show_version}
56
+ Usage: #{PROGRAM} [options] <script.rb> -- <script.rb parameters>
57
+ EOB
58
+ opts.on('--command FILE', String,
59
+ "Execute debugger commnds from FILE") do |cmdfile|
60
+ if File.readable?(cmdfile)
61
+ options[:cmdfiles] << cmdfile
62
+ elsif File.exists?(cmdfile)
63
+ stderr.puts "Command file '#{cmdfile}' is not readable."
64
+ else
65
+ stderr.puts "Command file '#{cmdfile}' does not exist."
66
+ end
67
+ end
68
+ opts.on('--nx',
69
+ "Do not run debugger initialization file #{CMD_INITFILE}") do
70
+ options[:nx] = true
71
+ end
72
+ # opts.on('--output FILE', String, "Name of file to record output") do |outfile|
73
+ # options[:outfile] = outfile
74
+ # end
75
+ opts.on("--cd DIR", String, "Change current directory to DIR") do |dir|
76
+ if File.directory?(dir)
77
+ if File.executable?(dir)
78
+ options[:chdir] = dir
79
+ else
80
+ stderr.puts "Can't cd to #{dir}. Option --cd ignored."
81
+ end
82
+ else
83
+ stderr.puts "\"#{dir}\" is not a directory. Option --cd ignored."
84
+ end
85
+ end
86
+ opts.on("--restore PROFILE", String,
87
+ "Restore debugger state using PROFILE") do |profile|
88
+ if File.readable?(profile)
89
+ options[:restore_profile] = profile
90
+ stderr.puts "Debugger command file #{profile} is not readable. --restore option ignored."
91
+ end
92
+ end
93
+ opts.on_tail("--help", "Show this message") do
94
+ options[:help] = true
95
+ stdout.puts opts
96
+ end
97
+ opts.on_tail("--version",
98
+ "print the version") do
99
+ options[:version] = true
100
+ stdout.puts show_version
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ if __FILE__ == $0
107
+ include Trepanning
108
+ opts = {}
109
+ options ={}
110
+ [%w(--help), %w(--version)].each do |o|
111
+ options = copy_default_options
112
+ opts = setup_options(options)
113
+ rest = opts.parse o
114
+ puts options
115
+ puts '=' * 10
116
+ end
117
+ rest = opts.parse! ARGV
118
+ puts opts.to_s
119
+ puts '=' * 10
120
+ puts options
121
+ puts '=' * 10
122
+ puts Trepanning::DEFAULT_CMDLINE_SETTINGS
123
+ end