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.
Files changed (266) hide show
  1. data/ChangeLog +2002 -0
  2. data/LICENSE +25 -0
  3. data/NEWS +31 -0
  4. data/README.textile +34 -0
  5. data/Rakefile +165 -0
  6. data/THANKS +14 -0
  7. data/app/breakpoint.rb +219 -0
  8. data/app/breakpoint.rbc +3551 -0
  9. data/app/brkptmgr.rb +140 -0
  10. data/app/brkptmgr.rbc +2903 -0
  11. data/app/client.rb +61 -0
  12. data/app/client.rbc +1225 -0
  13. data/app/complete.rb +52 -0
  14. data/app/complete.rbc +1288 -0
  15. data/app/default.rb +71 -0
  16. data/app/default.rbc +1132 -0
  17. data/app/display.rb +148 -0
  18. data/app/display.rbc +2578 -0
  19. data/app/frame.rb +98 -0
  20. data/app/frame.rbc +1808 -0
  21. data/app/irb.rb +111 -0
  22. data/app/irb.rbc +2094 -0
  23. data/app/iseq.rb +117 -0
  24. data/app/iseq.rbc +2192 -0
  25. data/app/llvm.rbc +2478 -0
  26. data/app/method.rb +173 -0
  27. data/app/method.rbc +2492 -0
  28. data/app/method_name.rbc +2467 -0
  29. data/app/mock.rb +13 -0
  30. data/app/mock.rbc +398 -0
  31. data/app/options.rb +137 -0
  32. data/app/options.rbc +2898 -0
  33. data/app/rbx-llvm.rb +165 -0
  34. data/app/rbx-llvm.rbc +2478 -0
  35. data/app/run.rb +86 -0
  36. data/app/run.rbc +1244 -0
  37. data/app/util.rb +49 -0
  38. data/app/util.rbc +1146 -0
  39. data/app/validate.rb +30 -0
  40. data/app/validate.rbc +676 -0
  41. data/bin/trepan.compiled.rbc +1043 -0
  42. data/bin/trepanx +69 -0
  43. data/bin/trepanx.compiled.rbc +1049 -0
  44. data/data/irbrc +41 -0
  45. data/data/irbrc.compiled.rbc +640 -0
  46. data/interface/base_intf.rb +105 -0
  47. data/interface/base_intf.rbc +1899 -0
  48. data/interface/client.rb +80 -0
  49. data/interface/client.rbc +1072 -0
  50. data/interface/comcodes.rb +20 -0
  51. data/interface/comcodes.rbc +385 -0
  52. data/interface/script.rb +104 -0
  53. data/interface/script.rbc +1642 -0
  54. data/interface/server.rb +143 -0
  55. data/interface/server.rbc +2213 -0
  56. data/interface/user.rb +150 -0
  57. data/interface/user.rbc +2867 -0
  58. data/io/base_io.rb +148 -0
  59. data/io/base_io.rbc +2111 -0
  60. data/io/input.rb +135 -0
  61. data/io/input.rbc +2528 -0
  62. data/io/null_output.rb +42 -0
  63. data/io/null_output.rbc +730 -0
  64. data/io/string_array.rb +156 -0
  65. data/io/string_array.rbc +2466 -0
  66. data/io/tcpclient.rb +129 -0
  67. data/io/tcpclient.rbc +2419 -0
  68. data/io/tcpfns.rb +33 -0
  69. data/io/tcpfns.rbc +694 -0
  70. data/io/tcpserver.rb +141 -0
  71. data/io/tcpserver.rbc +2638 -0
  72. data/lib/trepanning.rb +474 -0
  73. data/lib/trepanning.rbc +7705 -0
  74. data/lib/trepanning2.rb +441 -0
  75. data/processor/breakpoint.rb +164 -0
  76. data/processor/command/alias.rb +55 -0
  77. data/processor/command/backtrace.rb +76 -0
  78. data/processor/command/base/cmd.rb +173 -0
  79. data/processor/command/base/subcmd.rb +229 -0
  80. data/processor/command/base/submgr.rb +182 -0
  81. data/processor/command/base/subsubcmd.rb +103 -0
  82. data/processor/command/base/subsubmgr.rb +195 -0
  83. data/processor/command/break.rb +100 -0
  84. data/processor/command/complete.rb +37 -0
  85. data/processor/command/continue.rb +91 -0
  86. data/processor/command/delete.rb +30 -0
  87. data/processor/command/directory.rb +51 -0
  88. data/processor/command/disassemble.rb +145 -0
  89. data/processor/command/display.rb +82 -0
  90. data/processor/command/down.rb +54 -0
  91. data/processor/command/eval.rb +51 -0
  92. data/processor/command/exit.rb +62 -0
  93. data/processor/command/finish.rb +80 -0
  94. data/processor/command/frame.rb +89 -0
  95. data/processor/command/help.rb +251 -0
  96. data/processor/command/info.rb +28 -0
  97. data/processor/command/info_subcmd/breakpoints.rb +73 -0
  98. data/processor/command/info_subcmd/files.rb +209 -0
  99. data/processor/command/info_subcmd/line.rb +86 -0
  100. data/processor/command/info_subcmd/method.rb +71 -0
  101. data/processor/command/info_subcmd/program.rb +49 -0
  102. data/processor/command/info_subcmd/ruby.rb +62 -0
  103. data/processor/command/info_subcmd/variables.rb +48 -0
  104. data/processor/command/irb.rb +128 -0
  105. data/processor/command/kill.rb +70 -0
  106. data/processor/command/list.rb +300 -0
  107. data/processor/command/macro.rb +76 -0
  108. data/processor/command/next.rb +66 -0
  109. data/processor/command/nexti.rb +59 -0
  110. data/processor/command/pr.rb +38 -0
  111. data/processor/command/ps.rb +40 -0
  112. data/processor/command/restart.rb +60 -0
  113. data/processor/command/server.rb +72 -0
  114. data/processor/command/set.rb +47 -0
  115. data/processor/command/set_subcmd/auto.rb +27 -0
  116. data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
  117. data/processor/command/set_subcmd/auto_subcmd/eval.rb +54 -0
  118. data/processor/command/set_subcmd/auto_subcmd/irb.rb +34 -0
  119. data/processor/command/set_subcmd/auto_subcmd/list.rb +34 -0
  120. data/processor/command/set_subcmd/basename.rb +25 -0
  121. data/processor/command/set_subcmd/confirm.rb +24 -0
  122. data/processor/command/set_subcmd/debug.rb +26 -0
  123. data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +36 -0
  124. data/processor/command/set_subcmd/debug_subcmd/skip.rb +23 -0
  125. data/processor/command/set_subcmd/debug_subcmd/step.rb +23 -0
  126. data/processor/command/set_subcmd/different.rb +59 -0
  127. data/processor/command/set_subcmd/hidelevel.rb +62 -0
  128. data/processor/command/set_subcmd/highlight.rb +33 -0
  129. data/processor/command/set_subcmd/kernelstep.rb +60 -0
  130. data/processor/command/set_subcmd/max.rb +26 -0
  131. data/processor/command/set_subcmd/max_subcmd/list.rb +49 -0
  132. data/processor/command/set_subcmd/max_subcmd/stack.rb +50 -0
  133. data/processor/command/set_subcmd/max_subcmd/string.rb +76 -0
  134. data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
  135. data/processor/command/set_subcmd/substitute.rb +24 -0
  136. data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
  137. data/processor/command/set_subcmd/trace.rb +36 -0
  138. data/processor/command/set_subcmd/trace_subcmd/print.rb +57 -0
  139. data/processor/command/show.rb +38 -0
  140. data/processor/command/show_subcmd/alias.rb +42 -0
  141. data/processor/command/show_subcmd/args.rb +25 -0
  142. data/processor/command/show_subcmd/auto.rb +28 -0
  143. data/processor/command/show_subcmd/auto_subcmd/dis.rb +37 -0
  144. data/processor/command/show_subcmd/auto_subcmd/eval.rb +28 -0
  145. data/processor/command/show_subcmd/auto_subcmd/irb.rb +23 -0
  146. data/processor/command/show_subcmd/auto_subcmd/list.rb +22 -0
  147. data/processor/command/show_subcmd/basename.rb +20 -0
  148. data/processor/command/show_subcmd/confirm.rb +18 -0
  149. data/processor/command/show_subcmd/debug.rb +26 -0
  150. data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +21 -0
  151. data/processor/command/show_subcmd/debug_subcmd/skip.rb +22 -0
  152. data/processor/command/show_subcmd/debug_subcmd/step.rb +22 -0
  153. data/processor/command/show_subcmd/different.rb +26 -0
  154. data/processor/command/show_subcmd/hidelevel.rb +41 -0
  155. data/processor/command/show_subcmd/highlight.rb +24 -0
  156. data/processor/command/show_subcmd/kernelstep.rb +34 -0
  157. data/processor/command/show_subcmd/max.rb +27 -0
  158. data/processor/command/show_subcmd/max_subcmd/list.rb +38 -0
  159. data/processor/command/show_subcmd/max_subcmd/stack.rb +36 -0
  160. data/processor/command/show_subcmd/max_subcmd/string.rb +42 -0
  161. data/processor/command/show_subcmd/max_subcmd/width.rb +37 -0
  162. data/processor/command/show_subcmd/trace.rb +27 -0
  163. data/processor/command/show_subcmd/trace_subcmd/print.rb +38 -0
  164. data/processor/command/show_subcmd/version.rb +23 -0
  165. data/processor/command/source.rb +126 -0
  166. data/processor/command/step.rb +84 -0
  167. data/processor/command/tbreak.rb +19 -0
  168. data/processor/command/unalias.rb +44 -0
  169. data/processor/command/undisplay.rb +59 -0
  170. data/processor/command/up.rb +86 -0
  171. data/processor/default.rb +58 -0
  172. data/processor/disassemble.rb +46 -0
  173. data/processor/display.rb +18 -0
  174. data/processor/eval.rb +96 -0
  175. data/processor/frame.rb +211 -0
  176. data/processor/help.rb +72 -0
  177. data/processor/hook.rb +133 -0
  178. data/processor/load_cmds.rb +185 -0
  179. data/processor/location.rb +137 -0
  180. data/processor/main.rb +412 -0
  181. data/processor/mock.rb +144 -0
  182. data/processor/msg.rb +43 -0
  183. data/processor/running.rb +234 -0
  184. data/processor/stepping.rb +114 -0
  185. data/processor/subcmd.rb +161 -0
  186. data/processor/validate.rb +355 -0
  187. data/sample/list-terminal-colors.rb +139 -0
  188. data/sample/list-terminal-colors.rbc +2318 -0
  189. data/sample/rocky-dot-trepanxrc +14 -0
  190. data/sample/rocky-trepanx-colors.rb +47 -0
  191. data/sample/rocky-trepanx-colors.rbc +530 -0
  192. data/test/data/enable.right +36 -0
  193. data/test/data/fname-with-blank.cmd +6 -0
  194. data/test/data/fname-with-blank.right +4 -0
  195. data/test/data/inline-call.cmd +6 -0
  196. data/test/data/inline-call.right +13 -0
  197. data/test/data/quit-Xdebug.right +3 -0
  198. data/test/data/quit.cmd +5 -0
  199. data/test/data/quit.right +2 -0
  200. data/test/data/quit2.cmd +6 -0
  201. data/test/data/quit2.right +3 -0
  202. data/test/data/step-bug.cmd +11 -0
  203. data/test/data/step-bug.right +3 -0
  204. data/test/example/fname with blank.rb +1 -0
  205. data/test/example/gcd-server.rb +22 -0
  206. data/test/example/gcd.rb +19 -0
  207. data/test/example/inline-call.rb +23 -0
  208. data/test/example/null.rb +1 -0
  209. data/test/example/step-bug.rb +14 -0
  210. data/test/example/thread1.rb +3 -0
  211. data/test/functional/fn_helper.rb +112 -0
  212. data/test/functional/test-break-name.rb +52 -0
  213. data/test/functional/test-break.rb +51 -0
  214. data/test/functional/test-finish.rb +70 -0
  215. data/test/functional/test-fn_helper.rb +43 -0
  216. data/test/functional/test-list.rb +55 -0
  217. data/test/functional/test-next-bug.rb +49 -0
  218. data/test/functional/test-next.rb +101 -0
  219. data/test/functional/test-step.rb +272 -0
  220. data/test/functional/test-step2.rb +35 -0
  221. data/test/functional/test-tbreak.rb +41 -0
  222. data/test/integration/file-diff.rb +89 -0
  223. data/test/integration/helper.rb +78 -0
  224. data/test/integration/skip-test-step-bug.rb +17 -0
  225. data/test/integration/test-fname-with-blank.rb +16 -0
  226. data/test/integration/test-inline-call.rb +20 -0
  227. data/test/integration/test-quit.rb +47 -0
  228. data/test/unit/cmd-helper.rb +50 -0
  229. data/test/unit/mock-helper.rb +10 -0
  230. data/test/unit/test-app-brkpt.rb +29 -0
  231. data/test/unit/test-app-brkptmgr.rb +51 -0
  232. data/test/unit/test-app-iseq.rb +64 -0
  233. data/test/unit/test-app-method.rb +54 -0
  234. data/test/unit/test-app-options.rb +82 -0
  235. data/test/unit/test-app-run.rb +16 -0
  236. data/test/unit/test-app-util.rb +27 -0
  237. data/test/unit/test-app-validate.rb +18 -0
  238. data/test/unit/test-base-cmd.rb +47 -0
  239. data/test/unit/test-base-subcmd.rb +61 -0
  240. data/test/unit/test-base-submgr.rb +24 -0
  241. data/test/unit/test-bin-trepanx.rb +48 -0
  242. data/test/unit/test-cmd-alias.rb +48 -0
  243. data/test/unit/test-cmd-break.rb +22 -0
  244. data/test/unit/test-cmd-exit.rb +27 -0
  245. data/test/unit/test-cmd-finish.rb +27 -0
  246. data/test/unit/test-cmd-help.rb +104 -0
  247. data/test/unit/test-cmd-kill.rb +47 -0
  248. data/test/unit/test-cmd-source.rb +34 -0
  249. data/test/unit/test-cmd-step.rb +29 -0
  250. data/test/unit/test-completion.rb +38 -0
  251. data/test/unit/test-intf-user.rb +46 -0
  252. data/test/unit/test-io-input.rb +27 -0
  253. data/test/unit/test-io-tcp.rb +33 -0
  254. data/test/unit/test-io-tcpclient.rb +54 -0
  255. data/test/unit/test-io-tcpfns.rb +17 -0
  256. data/test/unit/test-io-tcpserver.rb +50 -0
  257. data/test/unit/test-proc-eval.rb +36 -0
  258. data/test/unit/test-proc-frame.rb +79 -0
  259. data/test/unit/test-proc-help.rb +16 -0
  260. data/test/unit/test-proc-hook.rb +30 -0
  261. data/test/unit/test-proc-load_cmds.rb +50 -0
  262. data/test/unit/test-proc-location.rb +53 -0
  263. data/test/unit/test-proc-main.rb +99 -0
  264. data/test/unit/test-proc-validate.rb +91 -0
  265. data/test/unit/test-subcmd-help.rb +47 -0
  266. metadata +398 -0
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2010, Rocky Bernstein
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name of the Evan Phoenix nor the names of its contributors
13
+ may be used to endorse or promote products derived from this software
14
+ without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/NEWS ADDED
@@ -0,0 +1,31 @@
1
+ Feb 15, 2011 (0.0.5)
2
+ - "disassemble" command: allow disassembly of specified line numbers
3
+ - GNU Readline:
4
+ * Start GNU readline tab (command) completion.
5
+ * Save and restore command history
6
+ * add --readline and --no-readline options to trepanx
7
+ - Macros can return more than one command now
8
+ - help
9
+ * "help macros" shows all macro names
10
+ * "help aliases" shows all alias names
11
+ * "help *" lists macros and aliases now
12
+ - start "info line"
13
+ - "info file" has/shows File::stat()'s mtime and ctime
14
+ - be able to pass --verbose to ruby to rake
15
+
16
+
17
+ Feb 1, 2011 (0.0.4)
18
+ - Add Remote debugging interface. Add options --server --port
19
+ - Add Syntax highlighting on Ruby and Rubinus LLVM listings and locations
20
+ - Section highlighting on some commands; italics on error if term mode
21
+ - Use ;; to allow multiple debugger commands. Document debugger command syntax
22
+ - Numerous bug fixes and code cleanups
23
+
24
+ Jan 1, 2011 (0.0.3)
25
+ - Add finish+
26
+ - Add "step into" "step over" and "step out" as alternates
27
+ for "step", "next", and "finish"
28
+ - Remove extraneous debug command.
29
+
30
+ Dec 25, 26, 2010 (0.0.1, & 0.0.2)
31
+ First general release. Port of trepanning debugger for Ruby 1.9.2.
@@ -0,0 +1,34 @@
1
+ A debugger for Rubinius 1.2.x
2
+
3
+ bc. [sudo] gem install rbx-trepanning
4
+
5
+ should get you going.
6
+
7
+ There is a "google group mailing list":http://groups.google.com/group/ruby-debugger for Ruby debuggers.
8
+
9
+ To run initially:
10
+
11
+ bc. $ trepanx my-ruby-program.rb
12
+
13
+ Or to call from inside your code:
14
+
15
+ bc. require 'trepanning'
16
+ debugger # Don't stop here...
17
+ work # but stop here.
18
+
19
+ If you want an immediate stop:
20
+
21
+ bc. debugger(:immediate=>true)
22
+
23
+ Finally, if you put in your .trepanx
24
+
25
+ bc. Rubinius::Loader.debugger = proc {
26
+ require 'trepanning';
27
+ Trepan.start(:skip_loader => :Xdebug)
28
+ }
29
+
30
+ Then you can use the -Xdebug option the Ruby, e.g.
31
+
32
+ bc. rbx -Xdebug my-ruby-program.rb
33
+
34
+ There is extensive on-line help. Run "help" inside the debugger.
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env rake
2
+ # Are we Rubinius? We'll test by checking the specific function we need.
3
+ raise RuntimeError, 'This package is for Rubinius 1.2 or 1.2.1dev only!' unless
4
+ Object.constants.include?('Rubinius') &&
5
+ Rubinius.constants.include?('VM') &&
6
+ %w(1.2.1 1.2.2dev).member?(Rubinius::VERSION)
7
+
8
+ require 'rubygems'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/rdoctask'
11
+ require 'rake/testtask'
12
+
13
+ ROOT_DIR = File.dirname(__FILE__)
14
+ require File.join %W(#{ROOT_DIR} app options)
15
+
16
+ def gemspec
17
+ @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
18
+ end
19
+
20
+ desc "Build the gem"
21
+ task :package=>:gem
22
+ task :gem=>:gemspec do
23
+ Dir.chdir(ROOT_DIR) do
24
+ sh "gem build .gemspec"
25
+ FileUtils.mkdir_p 'pkg'
26
+ FileUtils.mv("#{gemspec.file_name}", "pkg/#{gemspec.file_name}")
27
+ end
28
+ end
29
+
30
+ desc "Install the gem locally"
31
+ task :install => :gem do
32
+ Dir.chdir(ROOT_DIR) do
33
+ sh %{gem install --local pkg/#{gemspec.file_name}}
34
+ end
35
+ end
36
+
37
+ require 'rbconfig'
38
+ RUBY_PATH = File.join(RbConfig::CONFIG['bindir'],
39
+ RbConfig::CONFIG['RUBY_INSTALL_NAME'])
40
+
41
+ def run_standalone_ruby_files(list)
42
+ puts '*' * 40
43
+ list.each do |ruby_file|
44
+ system(RUBY_PATH, ruby_file)
45
+ end
46
+ end
47
+
48
+ def run_standalone_ruby_file(directory, opts={})
49
+ puts ('*' * 10) + ' ' + directory + ' ' + ('*' * 10)
50
+ Dir.chdir(directory) do
51
+ Dir.glob('*.rb').each do |ruby_file|
52
+ puts(('-' * 20) + ' ' + ruby_file + ' ' + ('-' * 20))
53
+ system(RUBY_PATH, ruby_file)
54
+ break if $?.exitstatus != 0 && !opts[:continue]
55
+ end
56
+ end
57
+ end
58
+
59
+ desc 'Create a GNU-style ChangeLog via git2cl'
60
+ task :ChangeLog do
61
+ system('git log --pretty --numstat --summary | git2cl > ChangeLog')
62
+ end
63
+
64
+ desc 'Test units - the smaller tests'
65
+ Rake::TestTask.new(:'test:unit') do |t|
66
+ t.test_files = FileList['test/unit/**/test-*.rb']
67
+ # t.pattern = 'test/**/*test-*.rb' # instead of above
68
+ t.options = '--verbose' if $VERBOSE
69
+ end
70
+
71
+ desc 'Test functional - the medium-sized tests'
72
+ Rake::TestTask.new(:'test:functional') do |t|
73
+ t.test_files = FileList['test/functional/**/test-*.rb']
74
+ t.options = '--verbose' if $VERBOSE
75
+ end
76
+
77
+ desc 'Test integration - end-to-end blackbox tests'
78
+ Rake::TestTask.new(:'test:integration') do |t|
79
+ t.test_files = FileList['test/integration/**/test-*.rb']
80
+ t.options = '--verbose' if $VERBOSE
81
+ end
82
+
83
+ desc 'Test everything - unit tests for now.'
84
+ task :default => :test
85
+ task :test do
86
+ exceptions = %w(test:unit test:functional test:integration).collect do |task|
87
+ begin
88
+ Rake::Task[task].invoke
89
+ nil
90
+ rescue => e
91
+ e
92
+ end
93
+ end.compact
94
+
95
+ exceptions.each {|e| puts e;puts e.backtrace }
96
+ raise "Test failures" unless exceptions.empty?
97
+ end
98
+
99
+ desc "Run each Ruby app file in standalone mode."
100
+ task :'check:app' do
101
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} app)))
102
+ end
103
+
104
+ desc "Run each command in standalone mode."
105
+ task :'check:commands' do
106
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} processor command)))
107
+ end
108
+
109
+ desc "Run each of the sub-sub commands in standalone mode."
110
+ task :'check:sub:commands' do
111
+ p "#{ROOT_DIR}/processor/command/*_subcmd/*_subcmd/*.rb"
112
+ Dir.glob("#{ROOT_DIR}/processor/command/*_subcmd").each do |sub_dir|
113
+ run_standalone_ruby_file(sub_dir)
114
+ end
115
+ end
116
+
117
+ desc "Run each processor Ruby file in standalone mode."
118
+ task :'check:processor' do
119
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} processor)))
120
+ end
121
+
122
+ task :'check:functional' do
123
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test functional)))
124
+ end
125
+
126
+ desc "Run each unit test in standalone mode."
127
+ task :'check:unit' do
128
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test unit)))
129
+ end
130
+
131
+ desc "Generate the gemspec"
132
+ task :generate do
133
+ puts gemspec.to_ruby
134
+ end
135
+
136
+ desc "Validate the gemspec"
137
+ task :gemspec do
138
+ gemspec.validate
139
+ end
140
+
141
+ # --------- RDoc Documentation ------
142
+ desc "Generate rdoc documentation"
143
+ Rake::RDocTask.new("rdoc") do |rdoc|
144
+ rdoc.rdoc_dir = 'doc'
145
+ rdoc.title = "rbx-trepaning #{Trepan::VERSION} Documentation"
146
+
147
+ rdoc.rdoc_files.include(%w(lib/trepanning.rb processor/*.rb
148
+ processor/command/*.rb
149
+ app/*.rb intf/*.rb io/*.rb
150
+ ))
151
+ end
152
+
153
+ desc "Same as rdoc"
154
+ task :doc => :rdoc
155
+
156
+ task :clobber_package do
157
+ FileUtils.rm_rf File.join(ROOT_DIR, 'pkg')
158
+ end
159
+
160
+ task :clobber_rdoc do
161
+ FileUtils.rm_rf File.join(ROOT_DIR, 'doc')
162
+ end
163
+
164
+ desc "Remove built files"
165
+ task :clean => [:clobber_package, :clobber_rdoc]
data/THANKS ADDED
@@ -0,0 +1,14 @@
1
+ This code builds off of code from the Rubinius reference debugger. At
2
+ the time it was created, Brian Ford and Evan Phoenix were the primary
3
+ forces behind that. See the AUTHORS file in the Rubinius distribution
4
+ for a complete list of Rubinius authors.
5
+
6
+ I am very grateful to Evan Phoenix for so graciously and willingly making
7
+ the numerous little changes that I think not only improve the debugging
8
+ experience, but increase location reporting and live introspection.
9
+
10
+ Ideas and in some cases command structure or exact text from help,
11
+ command name, command structure, and errors messages have come from
12
+ gdb and ruby-debug. The creative force and author of ruby-debug is
13
+ Kent Sibilev. Other ideas from other debuggers are used here; in
14
+ particular, the debugger that comes distributed with Python, pdb.
@@ -0,0 +1,219 @@
1
+ # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ class Trepan
3
+ class Breakpoint
4
+
5
+ attr_accessor :condition # If non-nil, this is a String to be eval'd
6
+ # which must be true to enter the debugger
7
+ attr_reader :event # Symbol. Optional type of event associated with
8
+ # breakpoint.
9
+ attr_accessor :hits # Fixnum. The number of timea a breakpoint
10
+ # has been hit (with a true condition). Do
11
+ # we want to (also) record hits independent
12
+ # of the condition?
13
+ attr_reader :id # Fixnum. Name of breakpoint
14
+
15
+ @@next_id = 1
16
+
17
+ BRKPT_DEFAULT_SETTINGS = {
18
+ :condition => 'true',
19
+ :enabled => 'true',
20
+ :temp => false,
21
+ :event => :Unknown,
22
+ } unless defined?(BRKPT_DEFAULT_SETTINGS)
23
+
24
+ def self.for_ip(exec, ip, opts={})
25
+ name = opts[:name] || :anon
26
+ line = exec.line_from_ip(ip)
27
+
28
+ Breakpoint.new(name, exec, ip, line, nil, opts)
29
+ end
30
+
31
+ def initialize(name, method, ip, line, id=nil, opts = {})
32
+ @descriptor = name
33
+ @id = id
34
+ @method = method
35
+ @ip = ip
36
+ @line = line
37
+
38
+ # If not nil, is a Rubinius::VariableScope. This is what we
39
+ # check to have call-frame-specific breakpoints.
40
+ @scope = nil
41
+
42
+ @related_bp = []
43
+
44
+ opts = BRKPT_DEFAULT_SETTINGS.merge(opts)
45
+ opts.keys.each do |key|
46
+ self.instance_variable_set('@'+key.to_s, opts[key])
47
+ end
48
+
49
+ @hits = 0
50
+ # unless @id
51
+ # @id = @@next_id
52
+ # @@next_id += 1
53
+ # end
54
+
55
+ @set = false
56
+ end
57
+
58
+ attr_reader :method, :ip, :line, :descriptor
59
+ attr_accessor :related_bp
60
+
61
+ def scoped!(scope, temp = true)
62
+ @temp = temp
63
+ @scope = scope
64
+ end
65
+
66
+ def set_temp!
67
+ @temp = true
68
+ end
69
+
70
+ def scoped?
71
+ !!@scope
72
+ end
73
+
74
+ def related_with(bp)
75
+ @related_bp += [bp] + bp.related_bp
76
+ @related_bp.uniq!
77
+ # List of related breakpoints should be shared.
78
+ bp.related_bp = @related_bp
79
+ end
80
+
81
+ def activate
82
+ @set = true
83
+ @method.set_breakpoint @ip, self
84
+ end
85
+
86
+ # Return true if the breakpoint is relevant. That is, the
87
+ # breakpoint is either not a scoped or it is scoped and test_scope
88
+ # matches the desired scope. We also remove the breakpoint and any
89
+ # related breakpoints if it was hit and temporary.
90
+ def hit!(test_scope)
91
+ return true unless @temp
92
+ return false if @scope && test_scope != @scope
93
+
94
+ @related_bp.each { |bp| bp.remove! }
95
+ remove!
96
+ return true
97
+ end
98
+
99
+ # def condition?(bind)
100
+ # if eval(@condition, bind)
101
+ # if @ignore > 0
102
+ # @ignore -= 1
103
+ # return false
104
+ # else
105
+ # @hits += 1
106
+ # return true
107
+ # end
108
+ # else
109
+ # return false
110
+ # end
111
+ # end
112
+
113
+ def delete!
114
+ remove!
115
+ end
116
+
117
+ def describe
118
+ "#{descriptor} - #{location}"
119
+ end
120
+
121
+ def disable
122
+ @enabled = false
123
+ end
124
+
125
+ def enabled
126
+ @enabled = true
127
+ end
128
+
129
+ def enabled=(bool)
130
+ @enabled = bool
131
+ end
132
+
133
+ def enabled?
134
+ @enabled
135
+ end
136
+
137
+ # Return a one-character "icon" giving the state of the breakpoint
138
+ # 't': temporary breakpoint
139
+ # 'B': enabled breakpoint
140
+ # 'b': disabled breakpoint
141
+ def icon_char
142
+ temp? ? 't' : (enabled? ? 'B' : 'b')
143
+ end
144
+
145
+ def location
146
+ "#{@method.active_path}:#{@line} (@#{ip})"
147
+ end
148
+
149
+ def remove!
150
+ return unless @set
151
+
152
+ @set = false
153
+ @method.clear_breakpoint(@ip)
154
+ end
155
+
156
+ def temp?
157
+ @temp
158
+ end
159
+
160
+ end
161
+
162
+ class DeferredBreakpoint
163
+ def initialize(debugger, frame, klass, which, name, line=nil, list=nil)
164
+ @debugger = debugger
165
+ @frame = frame
166
+ @klass_name = klass
167
+ @which = which
168
+ @name = name
169
+ @line = line
170
+ @list = list
171
+ end
172
+
173
+ def descriptor
174
+ "#{@klass_name}#{@which}#{@name}"
175
+ end
176
+
177
+ def resolve!
178
+ begin
179
+ klass = @frame.run(@klass_name)
180
+ rescue NameError
181
+ return false
182
+ end
183
+
184
+ begin
185
+ if @which == "#"
186
+ meth = klass.instance_method(@name)
187
+ else
188
+ meth = klass.method(@name)
189
+ end
190
+ rescue NameError
191
+ return false
192
+ end
193
+
194
+ @debugger.processor.msg "Resolved breakpoint for #{@klass_name}#{@which}#{@name}"
195
+
196
+ @debugger.processor.set_breakpoint_method descriptor, meth, @line
197
+
198
+ return true
199
+ end
200
+
201
+ def describe
202
+ "#{descriptor} - unknown location (deferred)"
203
+ end
204
+
205
+ def delete!
206
+ if @list
207
+ @list.delete self
208
+ end
209
+ end
210
+ end
211
+ end
212
+
213
+ if __FILE__ == $0
214
+ method = Rubinius::CompiledMethod.of_sender
215
+ bp = Trepan::Breakpoint.new '<start>', method, 1, 2, 0
216
+ %w(describe location icon_char hits temp? enabled? condition).each do |field|
217
+ puts "#{field}: #{bp.send(field.to_sym)}"
218
+ end
219
+ end