rbx-trepanning 0.2.0-universal-rubinius-2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (312) hide show
  1. data/.gitignore +7 -0
  2. data/ChangeLog +2967 -0
  3. data/LICENSE +25 -0
  4. data/Makefile +13 -0
  5. data/NEWS +105 -0
  6. data/README.textile +34 -0
  7. data/Rakefile +244 -0
  8. data/THANKS +14 -0
  9. data/app/.gitignore +2 -0
  10. data/app/breakpoint.rb +242 -0
  11. data/app/brkptmgr.rb +153 -0
  12. data/app/client.rb +71 -0
  13. data/app/cmd_parse.kpeg +242 -0
  14. data/app/cmd_parse.rb +209 -0
  15. data/app/cmd_parser.rb +2083 -0
  16. data/app/complete.rb +79 -0
  17. data/app/condition.rb +22 -0
  18. data/app/default.rb +71 -0
  19. data/app/display.rb +186 -0
  20. data/app/eventbuffer.rb +147 -0
  21. data/app/file.rb +24 -0
  22. data/app/frame.rb +120 -0
  23. data/app/irb.rb +113 -0
  24. data/app/iseq.rb +188 -0
  25. data/app/method.rb +178 -0
  26. data/app/mock.rb +13 -0
  27. data/app/options.rb +154 -0
  28. data/app/rbx-llvm.rb +163 -0
  29. data/app/run.rb +92 -0
  30. data/app/util.rb +99 -0
  31. data/app/validate.rb +30 -0
  32. data/bin/.gitignore +2 -0
  33. data/bin/trepanx +69 -0
  34. data/data/.gitignore +2 -0
  35. data/data/irbrc +41 -0
  36. data/interface/.gitignore +2 -0
  37. data/interface/client.rb +84 -0
  38. data/interface/comcodes.rb +20 -0
  39. data/interface/script.rb +112 -0
  40. data/interface/server.rb +147 -0
  41. data/interface/user.rb +158 -0
  42. data/interface.rb +109 -0
  43. data/io/.gitignore +3 -0
  44. data/io/input.rb +151 -0
  45. data/io/null_output.rb +46 -0
  46. data/io/string_array.rb +155 -0
  47. data/io/tcpclient.rb +129 -0
  48. data/io/tcpfns.rb +33 -0
  49. data/io/tcpserver.rb +141 -0
  50. data/io.rb +148 -0
  51. data/lib/.gitignore +2 -0
  52. data/lib/trepanning.rb +467 -0
  53. data/processor/.gitignore +3 -0
  54. data/processor/Makefile +7 -0
  55. data/processor/breakpoint.rb +167 -0
  56. data/processor/command/.gitignore +2 -0
  57. data/processor/command/alias.rb +65 -0
  58. data/processor/command/backtrace.rb +68 -0
  59. data/processor/command/base/.gitignore +2 -0
  60. data/processor/command/base/subcmd.rb +226 -0
  61. data/processor/command/base/submgr.rb +185 -0
  62. data/processor/command/base/subsubcmd.rb +125 -0
  63. data/processor/command/base/subsubmgr.rb +196 -0
  64. data/processor/command/break.rb +78 -0
  65. data/processor/command/complete.rb +39 -0
  66. data/processor/command/condition.rb +64 -0
  67. data/processor/command/continue.rb +61 -0
  68. data/processor/command/delete.rb +44 -0
  69. data/processor/command/directory.rb +51 -0
  70. data/processor/command/disable.rb +71 -0
  71. data/processor/command/disassemble.rb +180 -0
  72. data/processor/command/display.rb +84 -0
  73. data/processor/command/down.rb +54 -0
  74. data/processor/command/edit.rb +74 -0
  75. data/processor/command/enable.rb +43 -0
  76. data/processor/command/eval.rb +93 -0
  77. data/processor/command/exit.rb +83 -0
  78. data/processor/command/finish.rb +80 -0
  79. data/processor/command/frame.rb +93 -0
  80. data/processor/command/help/.gitignore +1 -0
  81. data/processor/command/help/README +10 -0
  82. data/processor/command/help/command.txt +58 -0
  83. data/processor/command/help/examples.txt +16 -0
  84. data/processor/command/help/filename.txt +40 -0
  85. data/processor/command/help/location.txt +37 -0
  86. data/processor/command/help/suffixes.txt +17 -0
  87. data/processor/command/help.rb +228 -0
  88. data/processor/command/info.rb +30 -0
  89. data/processor/command/info_subcmd/.gitignore +3 -0
  90. data/processor/command/info_subcmd/breakpoints.rb +103 -0
  91. data/processor/command/info_subcmd/files.rb +219 -0
  92. data/processor/command/info_subcmd/frame.rb +68 -0
  93. data/processor/command/info_subcmd/line.rb +75 -0
  94. data/processor/command/info_subcmd/locals.rb +22 -0
  95. data/processor/command/info_subcmd/macro.rb +62 -0
  96. data/processor/command/info_subcmd/method.rb +71 -0
  97. data/processor/command/info_subcmd/program.rb +51 -0
  98. data/processor/command/info_subcmd/ruby.rb +64 -0
  99. data/processor/command/info_subcmd/source.rb +75 -0
  100. data/processor/command/info_subcmd/stack.rb +25 -0
  101. data/processor/command/info_subcmd/variables.rb +35 -0
  102. data/processor/command/info_subcmd/variables_subcmd/.gitignore +2 -0
  103. data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
  104. data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
  105. data/processor/command/info_subcmd/variables_subcmd/globals.rb +69 -0
  106. data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
  107. data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
  108. data/processor/command/kill.rb +79 -0
  109. data/processor/command/list.rb +234 -0
  110. data/processor/command/macro.rb +86 -0
  111. data/processor/command/next.rb +67 -0
  112. data/processor/command/nexti.rb +59 -0
  113. data/processor/command/parsetree.rb +51 -0
  114. data/processor/command/pr.rb +37 -0
  115. data/processor/command/ps.rb +40 -0
  116. data/processor/command/restart.rb +60 -0
  117. data/processor/command/save.rb +58 -0
  118. data/processor/command/server.rb +72 -0
  119. data/processor/command/set.rb +47 -0
  120. data/processor/command/set_subcmd/.gitignore +2 -0
  121. data/processor/command/set_subcmd/abbrev.rb +25 -0
  122. data/processor/command/set_subcmd/auto.rb +33 -0
  123. data/processor/command/set_subcmd/auto_subcmd/.gitignore +2 -0
  124. data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
  125. data/processor/command/set_subcmd/auto_subcmd/eval.rb +53 -0
  126. data/processor/command/set_subcmd/auto_subcmd/irb.rb +33 -0
  127. data/processor/command/set_subcmd/auto_subcmd/list.rb +33 -0
  128. data/processor/command/set_subcmd/basename.rb +25 -0
  129. data/processor/command/set_subcmd/confirm.rb +24 -0
  130. data/processor/command/set_subcmd/debug.rb +26 -0
  131. data/processor/command/set_subcmd/debug_subcmd/.gitignore +2 -0
  132. data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +36 -0
  133. data/processor/command/set_subcmd/debug_subcmd/skip.rb +23 -0
  134. data/processor/command/set_subcmd/debug_subcmd/step.rb +23 -0
  135. data/processor/command/set_subcmd/different.rb +61 -0
  136. data/processor/command/set_subcmd/hidelevel.rb +62 -0
  137. data/processor/command/set_subcmd/highlight.rb +39 -0
  138. data/processor/command/set_subcmd/kernelstep.rb +60 -0
  139. data/processor/command/set_subcmd/max.rb +26 -0
  140. data/processor/command/set_subcmd/max_subcmd/.gitignore +2 -0
  141. data/processor/command/set_subcmd/max_subcmd/list.rb +49 -0
  142. data/processor/command/set_subcmd/max_subcmd/stack.rb +50 -0
  143. data/processor/command/set_subcmd/max_subcmd/string.rb +76 -0
  144. data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
  145. data/processor/command/set_subcmd/reload.rb +42 -0
  146. data/processor/command/set_subcmd/substitute.rb +24 -0
  147. data/processor/command/set_subcmd/substitute_subcmd/.gitignore +3 -0
  148. data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
  149. data/processor/command/set_subcmd/timer.rb +58 -0
  150. data/processor/command/set_subcmd/trace.rb +37 -0
  151. data/processor/command/set_subcmd/trace_subcmd/.gitignore +2 -0
  152. data/processor/command/set_subcmd/trace_subcmd/buffer.rb +42 -0
  153. data/processor/command/set_subcmd/trace_subcmd/print.rb +41 -0
  154. data/processor/command/shell.rb +131 -0
  155. data/processor/command/show.rb +39 -0
  156. data/processor/command/show_subcmd/.gitignore +3 -0
  157. data/processor/command/show_subcmd/abbrev.rb +20 -0
  158. data/processor/command/show_subcmd/aliases.rb +46 -0
  159. data/processor/command/show_subcmd/args.rb +25 -0
  160. data/processor/command/show_subcmd/auto.rb +28 -0
  161. data/processor/command/show_subcmd/auto_subcmd/.gitignore +3 -0
  162. data/processor/command/show_subcmd/auto_subcmd/dis.rb +37 -0
  163. data/processor/command/show_subcmd/auto_subcmd/eval.rb +24 -0
  164. data/processor/command/show_subcmd/auto_subcmd/irb.rb +23 -0
  165. data/processor/command/show_subcmd/auto_subcmd/list.rb +22 -0
  166. data/processor/command/show_subcmd/basename.rb +20 -0
  167. data/processor/command/show_subcmd/confirm.rb +18 -0
  168. data/processor/command/show_subcmd/debug.rb +26 -0
  169. data/processor/command/show_subcmd/debug_subcmd/.gitignore +3 -0
  170. data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +21 -0
  171. data/processor/command/show_subcmd/debug_subcmd/skip.rb +22 -0
  172. data/processor/command/show_subcmd/debug_subcmd/step.rb +22 -0
  173. data/processor/command/show_subcmd/different.rb +26 -0
  174. data/processor/command/show_subcmd/directories.rb +22 -0
  175. data/processor/command/show_subcmd/hidelevel.rb +41 -0
  176. data/processor/command/show_subcmd/highlight.rb +25 -0
  177. data/processor/command/show_subcmd/kernelstep.rb +34 -0
  178. data/processor/command/show_subcmd/max.rb +27 -0
  179. data/processor/command/show_subcmd/max_subcmd/.gitignore +2 -0
  180. data/processor/command/show_subcmd/max_subcmd/list.rb +38 -0
  181. data/processor/command/show_subcmd/max_subcmd/stack.rb +36 -0
  182. data/processor/command/show_subcmd/max_subcmd/string.rb +42 -0
  183. data/processor/command/show_subcmd/max_subcmd/width.rb +37 -0
  184. data/processor/command/show_subcmd/reload.rb +18 -0
  185. data/processor/command/show_subcmd/timer.rb +18 -0
  186. data/processor/command/show_subcmd/trace.rb +27 -0
  187. data/processor/command/show_subcmd/trace_subcmd/.gitignore +2 -0
  188. data/processor/command/show_subcmd/trace_subcmd/buffer.rb +64 -0
  189. data/processor/command/show_subcmd/trace_subcmd/print.rb +23 -0
  190. data/processor/command/show_subcmd/version.rb +23 -0
  191. data/processor/command/source.rb +133 -0
  192. data/processor/command/step.rb +97 -0
  193. data/processor/command/tbreak.rb +20 -0
  194. data/processor/command/unalias.rb +49 -0
  195. data/processor/command/undisplay.rb +63 -0
  196. data/processor/command/up.rb +89 -0
  197. data/processor/command.rb +173 -0
  198. data/processor/default.rb +64 -0
  199. data/processor/disassemble.rb +59 -0
  200. data/processor/display.rb +53 -0
  201. data/processor/eval.rb +97 -0
  202. data/processor/eventbuf.rb +101 -0
  203. data/processor/frame.rb +265 -0
  204. data/processor/help.rb +94 -0
  205. data/processor/hook.rb +134 -0
  206. data/processor/list.rb +123 -0
  207. data/processor/load_cmds.rb +253 -0
  208. data/processor/location.rb +228 -0
  209. data/processor/mock.rb +138 -0
  210. data/processor/msg.rb +74 -0
  211. data/processor/running.rb +244 -0
  212. data/processor/stepping.rb +135 -0
  213. data/processor/subcmd.rb +136 -0
  214. data/processor/validate.rb +379 -0
  215. data/processor/virtual.rb +33 -0
  216. data/processor.rb +404 -0
  217. data/rbx-trepanning.gemspec +39 -0
  218. data/sample/.gitignore +2 -0
  219. data/sample/list-terminal-colors.rb +139 -0
  220. data/sample/rocky-dot-trepanxrc +14 -0
  221. data/sample/rocky-trepanx-colors.rb +46 -0
  222. data/test/data/.gitignore +1 -0
  223. data/test/data/enable.right +36 -0
  224. data/test/data/fname-with-blank.cmd +6 -0
  225. data/test/data/fname-with-blank.right +6 -0
  226. data/test/data/inline-call.cmd +6 -0
  227. data/test/data/inline-call.right +14 -0
  228. data/test/data/quit-Xdebug.right +3 -0
  229. data/test/data/quit.cmd +5 -0
  230. data/test/data/quit.right +3 -0
  231. data/test/data/quit2.cmd +6 -0
  232. data/test/data/quit2.right +3 -0
  233. data/test/example/.gitignore +2 -0
  234. data/test/example/debugger-stop.rb +16 -0
  235. data/test/example/factorial.rb +10 -0
  236. data/test/example/fname with blank.rb +1 -0
  237. data/test/example/gcd-server.rb +22 -0
  238. data/test/example/gcd.rb +19 -0
  239. data/test/example/goto2goto.rb +11 -0
  240. data/test/example/inline-call.rb +23 -0
  241. data/test/example/null.rb +1 -0
  242. data/test/example/thread1.rb +3 -0
  243. data/test/functional/.gitignore +3 -0
  244. data/test/functional/fn_helper.rb +112 -0
  245. data/test/functional/test-break-name.rb +52 -0
  246. data/test/functional/test-break.rb +85 -0
  247. data/test/functional/test-eval.rb +115 -0
  248. data/test/functional/test-finish.rb +70 -0
  249. data/test/functional/test-fn_helper.rb +43 -0
  250. data/test/functional/test-list.rb +56 -0
  251. data/test/functional/test-next-bug.rb +49 -0
  252. data/test/functional/test-next.rb +101 -0
  253. data/test/functional/test-recursive-bt.rb +94 -0
  254. data/test/functional/test-step.rb +272 -0
  255. data/test/functional/test-step2.rb +35 -0
  256. data/test/functional/test-tbreak.rb +41 -0
  257. data/test/integration/.gitignore +3 -0
  258. data/test/integration/file-diff.rb +89 -0
  259. data/test/integration/helper.rb +81 -0
  260. data/test/integration/test-fname-with-blank.rb +16 -0
  261. data/test/integration/test-inline-call.rb +20 -0
  262. data/test/integration/test-quit.rb +47 -0
  263. data/test/unit/.gitignore +3 -0
  264. data/test/unit/cmd-helper.rb +50 -0
  265. data/test/unit/mock-helper.rb +10 -0
  266. data/test/unit/test-app-brkpt.rb +31 -0
  267. data/test/unit/test-app-brkptmgr.rb +51 -0
  268. data/test/unit/test-app-cmd_parse.rb +97 -0
  269. data/test/unit/test-app-cmd_parser.rb +23 -0
  270. data/test/unit/test-app-complete.rb +39 -0
  271. data/test/unit/test-app-condition.rb +18 -0
  272. data/test/unit/test-app-display.rb +22 -0
  273. data/test/unit/test-app-iseq.rb +64 -0
  274. data/test/unit/test-app-method.rb +54 -0
  275. data/test/unit/test-app-options.rb +94 -0
  276. data/test/unit/test-app-run.rb +14 -0
  277. data/test/unit/test-app-util.rb +44 -0
  278. data/test/unit/test-app-validate.rb +18 -0
  279. data/test/unit/test-base-cmd.rb +45 -0
  280. data/test/unit/test-base-subcmd.rb +57 -0
  281. data/test/unit/test-base-submgr.rb +24 -0
  282. data/test/unit/test-base-subsubcmd.rb +17 -0
  283. data/test/unit/test-bin-trepanx.rb +48 -0
  284. data/test/unit/test-cmd-alias.rb +48 -0
  285. data/test/unit/test-cmd-break.rb +66 -0
  286. data/test/unit/test-cmd-edit.rb +34 -0
  287. data/test/unit/test-cmd-exit.rb +27 -0
  288. data/test/unit/test-cmd-finish.rb +31 -0
  289. data/test/unit/test-cmd-help.rb +104 -0
  290. data/test/unit/test-cmd-kill.rb +54 -0
  291. data/test/unit/test-cmd-parse_list_cmd.rb +36 -0
  292. data/test/unit/test-cmd-source.rb +34 -0
  293. data/test/unit/test-cmd-step.rb +29 -0
  294. data/test/unit/test-command.rb +45 -0
  295. data/test/unit/test-completion.rb +48 -0
  296. data/test/unit/test-intf-user.rb +46 -0
  297. data/test/unit/test-io-input.rb +27 -0
  298. data/test/unit/test-io-tcp.rb +33 -0
  299. data/test/unit/test-io-tcpclient.rb +54 -0
  300. data/test/unit/test-io-tcpfns.rb +17 -0
  301. data/test/unit/test-io-tcpserver.rb +50 -0
  302. data/test/unit/test-proc-eval.rb +35 -0
  303. data/test/unit/test-proc-frame.rb +81 -0
  304. data/test/unit/test-proc-help.rb +16 -0
  305. data/test/unit/test-proc-hook.rb +30 -0
  306. data/test/unit/test-proc-list.rb +55 -0
  307. data/test/unit/test-proc-load_cmds.rb +51 -0
  308. data/test/unit/test-proc-location.rb +67 -0
  309. data/test/unit/test-proc-main.rb +95 -0
  310. data/test/unit/test-proc-validate.rb +139 -0
  311. data/test/unit/test-subcmd-help.rb +43 -0
  312. metadata +545 -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/Makefile ADDED
@@ -0,0 +1,13 @@
1
+ # I'll admit it -- I'm an absent-minded old-timer who has trouble
2
+ # learning new tricks.
3
+ .PHONY: all test
4
+
5
+ all: test
6
+
7
+ check:
8
+ rake test
9
+ test:
10
+ rake test
11
+
12
+ %:
13
+ rake $@
data/NEWS ADDED
@@ -0,0 +1,105 @@
1
+ Oct 27, 2011 (0.1.0)
2
+ - Add debugger commands:
3
+ * info variables (is in ruby-debug)
4
+ * info locals as alternative to "info variables locals" (is in gdb)
5
+
6
+ - POSIX shell -x (long form: --trace) fixed
7
+
8
+ - Add disabling and enabling on display expressions
9
+
10
+ - Confirm before deleting all displays.
11
+
12
+ - Give breakpoints for files via linecache if they are syntactically
13
+ correct Ruby files
14
+
15
+ - Change whence-file to match gdb's resolution: don't apply PATH to
16
+ relative files.
17
+
18
+ - Command Completion and help text improvements
19
+
20
+ - Syntax highlighting updated to support coderay 1.0 and greater
21
+
22
+ - Bugs fixed, code reorganized.
23
+
24
+
25
+ June 12, 2011 (0.0.9) Fleetwood release
26
+ - Add debugger commands:
27
+ * tbreak (is in gdb)
28
+ * info globals (is in ruby-debug)
29
+ * info locals (is in gdb)
30
+ * info source (is in gdb)
31
+ * info stack (is in gdb, same as backtrace)
32
+ * info macro (in in gdb; remove show macro)
33
+ * show timer (set timer was already there)
34
+ * parsetree
35
+ * pp (is in ruby-debug)
36
+ * set/show reload (is in ruby-debug)
37
+
38
+ - Add options from ruby-debug:
39
+ * --cd
40
+ * --include
41
+ * --require
42
+ * --debug
43
+ - fix bugs, and improve help
44
+
45
+ March 15, 2011 (0.0.8)
46
+
47
+ - Revise breakpoint location parsing
48
+ * Add: break <location> if/unless <condition>
49
+ * Add: step until <condition>
50
+ * VM offsets are now specified via @ rather than o or O
51
+ * Filenames can be quoted and blanks and characters inside escaped
52
+ - Document command syntax by adding it as a new category with sub help
53
+ - More controlled parsing of method names
54
+ - improvements to "info files"
55
+ show if we have a compiled method object for the file
56
+ - eval? now strips more:
57
+ * leading "return" or "case", or "unless"
58
+ * trailing "then"
59
+ - Save and restore some debugger state across a restart
60
+
61
+ Feb 22, 2011 (0.0.7)
62
+ - Add gdb "condition" command
63
+ - More complete command completion
64
+ - Add kill! alias to force without prompting
65
+ - Add eval (no args) and eval? to run current source line or source line
66
+ expression
67
+ - Add "set/show trace buffer on/off" to keep a history of recent places
68
+ we've stopped in the debugger
69
+ - Add "show macro *" to list all macro names.
70
+ - A number of bug fixes
71
+
72
+ Feb 15, 2011 (0.0.6)
73
+ - Repackage using rubinus platform 1.2 rather than 1.2.1
74
+
75
+ Feb 15, 2011 (0.0.5)
76
+ - "disassemble" command: allow disassembly of specified line numbers
77
+ - GNU Readline:
78
+ * Start GNU readline tab (command) completion.
79
+ * Save and restore command history
80
+ * add --readline and --no-readline options to trepanx
81
+ - Macros can return more than one command now
82
+ - help
83
+ * "help macros" shows all macro names
84
+ * "help aliases" shows all alias names
85
+ * "help *" lists macros and aliases now
86
+ - start "info line"
87
+ - "info file" has/shows File::stat()'s mtime and ctime
88
+ - be able to pass --verbose to ruby to rake
89
+
90
+
91
+ Feb 1, 2011 (0.0.4)
92
+ - Add Remote debugging interface. Add options --server --port
93
+ - Add Syntax highlighting on Ruby and Rubinus LLVM listings and locations
94
+ - Section highlighting on some commands; italics on error if term mode
95
+ - Use ;; to allow multiple debugger commands. Document debugger command syntax
96
+ - Numerous bug fixes and code cleanups
97
+
98
+ Jan 1, 2011 (0.0.3)
99
+ - Add finish+
100
+ - Add "step into" "step over" and "step out" as alternates
101
+ for "step", "next", and "finish"
102
+ - Remove extraneous debug command.
103
+
104
+ Dec 25, 26, 2010 (0.0.1, & 0.0.2)
105
+ First general release. Port of trepanning debugger for Ruby 1.9.2.
data/README.textile ADDED
@@ -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.
data/Rakefile ADDED
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env rake
2
+ # -*- Ruby -*-
3
+ # Are we Rubinius? The right versions of it?
4
+ raise RuntimeError,
5
+ 'This package is for Rubinius 1.2.[34] or 2.0.x only!' unless
6
+ Object.constants.include?('Rubinius') &&
7
+ Rubinius.constants.include?('VM') &&
8
+ Rubinius::VERSION =~ /1\.2\.[34]/ || Rubinius::VERSION =~ /2\.0/
9
+
10
+ require 'rubygems'
11
+
12
+ ROOT_DIR = File.dirname(__FILE__)
13
+ Gemspec_filename = 'rbx-trepanning.gemspec'
14
+ require File.join %W(#{ROOT_DIR} app options)
15
+
16
+ def gemspec
17
+ @gemspec ||= eval(File.read(Gemspec_filename), binding, Gemspec_filename)
18
+ end
19
+
20
+ require 'rubygems/package_task'
21
+ desc "Build the gem"
22
+ task :package=>:gem
23
+ task :gem=>:gemspec do
24
+ Dir.chdir(ROOT_DIR) do
25
+ sh "gem build #{Gemspec_filename}"
26
+ FileUtils.mkdir_p 'pkg'
27
+ FileUtils.mv gemspec.file_name, 'pkg'
28
+
29
+ # Now make a 2.0 package by changing 1.2 to 2.0 in the gemspec
30
+ # and creating another gemspec and moving that accordingly
31
+ lines = File.open(Gemspec_filename).readlines.map{|line|
32
+ line.gsub(/'universal', 'rubinius', '1\.2'/,
33
+ "'universal', 'rubinius', '2.0'");
34
+ }
35
+
36
+ two_filename = gemspec.dup.file_name.gsub(/1\.2/, '2.0')
37
+ FileUtils.cp("rbx-trepanning.gemspec", "rbx-trepanning-2.0.gemspec")
38
+ gemspec_filename2 = "rbx-trepanning-2.0.gemspec"
39
+ f = File.open(gemspec_filename2, "w")
40
+ f.write(lines); f.close
41
+ sh "gem build #{gemspec_filename2}"
42
+ FileUtils.mv("#{two_filename}", "pkg/")
43
+ end
44
+ end
45
+
46
+ desc 'Install the gem locally'
47
+ task :install => :gem do
48
+ Dir.chdir(ROOT_DIR) do
49
+ sh %{gem install --local pkg/#{gemspec.file_name}}
50
+ end
51
+ end
52
+
53
+ require 'rake/testtask'
54
+ desc "Test everything."
55
+ Rake::TestTask.new(:test) do |t|
56
+ t.libs << './lib'
57
+ t.pattern = 'test/test-*.rb'
58
+ t.verbose = true
59
+ end
60
+ task :test => :lib
61
+
62
+ desc "same as test"
63
+ task :check => :test
64
+
65
+ require 'rbconfig'
66
+ def RbConfig.ruby
67
+ File.join(RbConfig::CONFIG['bindir'],
68
+ RbConfig::CONFIG['RUBY_INSTALL_NAME'] +
69
+ RbConfig::CONFIG['EXEEXT'])
70
+ end unless defined? RbConfig.ruby
71
+
72
+ def run_standalone_ruby_files(list, opts={})
73
+ puts '*' * 40
74
+ list.each do |ruby_file|
75
+ system(RbConfig.ruby, ruby_file)
76
+ p $?.exitstatus
77
+ break if $?.exitstatus != 0 && !opts[:continue]
78
+ end
79
+ end
80
+
81
+ def run_standalone_ruby_file(directory, opts={})
82
+ puts(('*' * 10) + ' ' + directory + ' ' + ('*' * 10))
83
+ Dir.chdir(directory) do
84
+ Dir.glob('*.rb').each do |ruby_file|
85
+ puts(('-' * 20) + ' ' + ruby_file + ' ' + ('-' * 20))
86
+ system(RbConfig.ruby, ruby_file)
87
+ break if $?.exitstatus != 0 && !opts[:continue]
88
+ end
89
+ end
90
+ end
91
+
92
+ desc 'Create a GNU-style ChangeLog via git2cl'
93
+ task :ChangeLog do
94
+ system('git log --pretty --numstat --summary | git2cl > ChangeLog')
95
+ end
96
+
97
+ desc 'Test units - the smaller tests'
98
+ Rake::TestTask.new(:'test:unit') do |t|
99
+ t.test_files = FileList['test/unit/**/test-*.rb']
100
+ # t.pattern = 'test/**/*test-*.rb' # instead of above
101
+ t.options = '--verbose' if $VERBOSE
102
+ end
103
+
104
+ desc 'Test functional - the medium-sized tests'
105
+ Rake::TestTask.new(:'test:functional') do |t|
106
+ t.test_files = FileList['test/functional/**/test-*.rb']
107
+ t.options = '--verbose' if $VERBOSE
108
+ end
109
+
110
+ desc 'Test integration - end-to-end blackbox tests'
111
+ Rake::TestTask.new(:'test:integration') do |t|
112
+ t.test_files = FileList['test/integration/**/test-*.rb']
113
+ t.options = '--verbose' if $VERBOSE
114
+ end
115
+
116
+ desc 'Test everything - unit tests for now.'
117
+ task :test do
118
+ exceptions = %w(test:unit test:functional test:integration).collect do |task|
119
+ begin
120
+ Rake::Task[task].invoke
121
+ nil
122
+ rescue => e
123
+ e
124
+ end
125
+ end.compact
126
+
127
+ exceptions.each {|e| puts e;puts e.backtrace }
128
+ raise 'Test failures' unless exceptions.empty?
129
+ end
130
+
131
+ desc 'Run each Ruby app file in standalone mode.'
132
+ task :'check:app' do
133
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} app)))
134
+ end
135
+
136
+ desc 'Run each command in standalone mode.'
137
+ task :'check:commands' do
138
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} processor command)))
139
+ end
140
+
141
+ desc 'Run each of the sub-sub commands in standalone mode.'
142
+ task :'check:sub:commands' do
143
+ p "#{ROOT_DIR}/processor/command/*_subcmd/*_subcmd/*.rb"
144
+ Dir.glob("#{ROOT_DIR}/processor/command/*_subcmd").each do |sub_dir|
145
+ run_standalone_ruby_file(sub_dir)
146
+ end
147
+ end
148
+
149
+ desc 'Run each of the sub-sub commands in standalone mode.'
150
+ task :'check:subsub:commands' do
151
+ subsub_files = FileList["#{ROOT_DIR}/processor/command/*_subcmd/*_subcmd/*.rb"]
152
+ run_standalone_ruby_files(subsub_files)
153
+ end
154
+
155
+ desc 'Run each processor Ruby file in standalone mode.'
156
+ task :'check:lib' do
157
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} lib)))
158
+ end
159
+
160
+ desc 'Run each processor Ruby file in standalone mode.'
161
+ task :'check:processor' do
162
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} processor)))
163
+ end
164
+
165
+ desc 'Run each processor Ruby file in standalone mode.'
166
+ task :'check:unit' do
167
+ run_standalone_ruby_files(FileList['test/unit/**/test-*.rb'])
168
+ end
169
+
170
+ desc 'Run functional tests in standalone mode.'
171
+ task :'check:functional' do
172
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test functional)))
173
+ end
174
+
175
+ desc 'Run command parser grammar.'
176
+ task :'check:cmd_parse' do
177
+ sh "kpeg --test --debug #{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))}"
178
+ end
179
+
180
+ desc 'Generate command parser.'
181
+ task :'cmd_parse' do
182
+ require 'tmpdir'
183
+ temp_file = File.join(Dir.tmpdir, "cmd_parser_#{$$}.rb")
184
+ sh("kpeg --name CmdParse --verbose --stand-alone " +
185
+ "#{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))} " +
186
+ "--output #{temp_file}")
187
+ end
188
+
189
+ task :'check:integration' do
190
+ run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test integration)))
191
+ end
192
+
193
+ task :check => %w(check:lib check:processor check:commands).map{|c| c.to_sym}
194
+
195
+ desc "Default action is same as 'test'."
196
+ task :default => :test
197
+
198
+ desc 'Generate the gemspec'
199
+ task :generate do
200
+ puts gemspec.to_ruby
201
+ end
202
+
203
+ desc 'Validate the gemspec'
204
+ task :gemspec do
205
+ gemspec.validate
206
+ end
207
+
208
+ # --------- RDoc Documentation ------
209
+ require 'rdoc/task'
210
+ desc "Generate rdoc documentation"
211
+ Rake::RDocTask.new("rdoc") do |rdoc|
212
+ rdoc.rdoc_dir = 'doc'
213
+ rdoc.title = "Trepanning #{Trepan::VERSION} Documentation"
214
+
215
+ rdoc.rdoc_files.include(%w(lib/trepanning.rb processor/*.rb
216
+ processor/command/*.rb
217
+ app/*.rb intf/*.rb io/*.rb
218
+ ))
219
+ end
220
+
221
+ desc 'Same as rdoc'
222
+ task :doc => :rdoc
223
+
224
+ task :clobber_package do
225
+ FileUtils.rm_rf File.join(ROOT_DIR, 'pkg'), :verbose => true
226
+ end
227
+
228
+ task :clobber_rdoc do
229
+ FileUtils.rm_rf File.join(ROOT_DIR, 'doc'), :verbose => true
230
+ end
231
+
232
+ desc 'Remove residue from running patch'
233
+ task :rm_patch_residue do
234
+ FileUtils.rm_rf Dir.glob('**/*.{rej,orig}'), :verbose => true
235
+ end
236
+
237
+ desc 'Remove ~ backup files'
238
+ task :rm_tilde_backups do
239
+ FileUtils.rm_rf Dir.glob('**/*~'), :verbose => true
240
+ end
241
+
242
+ desc 'Remove built files'
243
+ task :clean => [:clobber_package, :clobber_rdoc, :rm_patch_residue,
244
+ :rm_tilde_backups]
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.
data/app/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /*.rbc
2
+ /*~
data/app/breakpoint.rb ADDED
@@ -0,0 +1,242 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
3
+
4
+ # Breakpoint objects
5
+ class Trepan
6
+ class Breakpoint
7
+ attr_accessor :condition # If non-nil, this is a String to be eval'd
8
+ # which must be true to enter the debugger
9
+ attr_reader :event # Symbol. Optional type of event associated with
10
+ # breakpoint.
11
+ attr_accessor :hits # Fixnum. The number of times a breakpoint
12
+ # has been hit (with a true condition). Do
13
+ # we want to (also) record hits independent
14
+ # of the condition?
15
+ attr_reader :id # Fixnum. Name of breakpoint
16
+ attr_reader :ignore # Fixnum. How many more times do we have
17
+ # to encounter the breakpoint before we stop?
18
+ attr_reader :line
19
+ attr_reader :method
20
+ attr_reader :negate # Boolean. Negate sense of condition. Used in
21
+ # break if .. and break unless ..
22
+ # breakpoint
23
+ @@next_id = 1
24
+
25
+ BRKPT_DEFAULT_SETTINGS = {
26
+ :condition => 'true',
27
+ :enabled => 'true',
28
+ :ignore => 0,
29
+ :negate => false,
30
+ :temp => false,
31
+ :event => :Unknown,
32
+ } unless defined?(BRKPT_DEFAULT_SETTINGS)
33
+
34
+ def initialize(name, method, ip, line, id=nil, opts = {})
35
+ @descriptor = name
36
+ @id = id
37
+ @method = method
38
+ @ip = ip
39
+ @line = line
40
+
41
+ # If not nil, is a Rubinius::VariableScope. This is what we
42
+ # check to have call-frame-specific breakpoints.
43
+ @scope = nil
44
+
45
+ @related_bp = []
46
+
47
+ opts = BRKPT_DEFAULT_SETTINGS.merge(opts)
48
+ opts.keys.each do |key|
49
+ self.instance_variable_set('@'+key.to_s, opts[key])
50
+ end
51
+
52
+ @hits = 0
53
+
54
+ # unless @id
55
+ # @id = @@next_id
56
+ # @@next_id += 1
57
+ # end
58
+
59
+ @activated = false
60
+ end
61
+
62
+ attr_reader :method, :ip, :line, :descriptor
63
+ attr_accessor :related_bp
64
+
65
+ def scoped!(scope, temp = true)
66
+ @temp = temp
67
+ @scope = scope
68
+ end
69
+
70
+ def set_temp!
71
+ @temp = true
72
+ end
73
+
74
+ def scoped?
75
+ !!@scope
76
+ end
77
+
78
+ def related_with(bp)
79
+ @related_bp += [bp] + bp.related_bp
80
+ @related_bp.uniq!
81
+ # List of related breakpoints should be shared.
82
+ bp.related_bp = @related_bp
83
+ end
84
+
85
+ def activate
86
+ @activated = true
87
+ @method.set_breakpoint @ip, self
88
+ end
89
+
90
+ def active?
91
+ @activated
92
+ end
93
+
94
+ # FIXME: give this a better name.
95
+ # Return true if the breakpoint is a temporary breakpoint and is
96
+ # relevant. By releveant we mean that, the breakpoint is either
97
+ # not a scoped breakpoint or it is scoped and test_scope matches
98
+ # the desired scope. We also remove the breakpoint and any related
99
+ # breakpoints if it was hit and temporary.
100
+ #
101
+ # If the breakpoint is not a temporary breakpoint, return nil.
102
+ #
103
+ # See also "condition' below which is run to determine whether or
104
+ # not to stop.
105
+ def hit!(test_scope)
106
+ return nil unless @temp
107
+ return false if @scope && test_scope != @scope
108
+
109
+ @related_bp.each { |bp| bp.remove! }
110
+ remove!
111
+ return true
112
+ end
113
+
114
+ def condition?(bind)
115
+ if @negate != eval(@condition, bind)
116
+ if @ignore > 0
117
+ @ignore -= 1
118
+ return false
119
+ else
120
+ @hits += 1
121
+ return true
122
+ end
123
+ else
124
+ return false
125
+ end
126
+ end
127
+
128
+ def delete!
129
+ remove!
130
+ end
131
+
132
+ def describe
133
+ "#{@descriptor} - #{location}"
134
+ end
135
+
136
+ def disable
137
+ @enabled = false
138
+ end
139
+
140
+ def enabled
141
+ @enabled = true
142
+ end
143
+
144
+ def enabled=(bool)
145
+ @enabled = bool
146
+ end
147
+
148
+ def enabled?
149
+ @enabled
150
+ end
151
+
152
+ # Return a one-character "icon" giving the state of the breakpoint
153
+ # 't': temporary breakpoint
154
+ # 'B': enabled breakpoint
155
+ # 'b': disabled breakpoint
156
+ def icon_char
157
+ temp? ? 't' : (enabled? ? 'B' : 'b')
158
+ end
159
+
160
+ def location
161
+ "#{@method.active_path}:#{@line} (@#{ip})"
162
+ end
163
+
164
+ def remove!
165
+ return unless @activated
166
+ @activated = false
167
+ @method.clear_breakpoint(@ip)
168
+ end
169
+
170
+ def temp?
171
+ @temp
172
+ end
173
+
174
+ def self.for_ip(exec, ip, opts={})
175
+ name = opts[:name] || :anon
176
+ line = exec.line_from_ip(ip)
177
+
178
+ Breakpoint.new(name, exec, ip, line, nil, opts)
179
+ end
180
+
181
+ end
182
+
183
+ class DeferredBreakpoint
184
+ def initialize(debugger, frame, klass, which, name, line=nil, list=nil)
185
+ @debugger = debugger
186
+ @frame = frame
187
+ @klass_name = klass
188
+ @which = which
189
+ @name = name
190
+ @line = line
191
+ @list = list
192
+ end
193
+
194
+ def descriptor
195
+ "#{@klass_name}#{@which}#{@name}"
196
+ end
197
+
198
+ def resolve!
199
+ begin
200
+ klass = @frame.run(@klass_name)
201
+ rescue NameError
202
+ return false
203
+ end
204
+
205
+ begin
206
+ if @which == "#"
207
+ meth = klass.instance_method(@name)
208
+ else
209
+ meth = klass.method(@name)
210
+ end
211
+ rescue NameError
212
+ return false
213
+ end
214
+
215
+ @debugger.processor.msg "Resolved breakpoint for #{@klass_name}#{@which}#{@name}"
216
+
217
+ @debugger.processor.set_breakpoint_method descriptor, meth, @line
218
+
219
+ return true
220
+ end
221
+
222
+ def describe
223
+ "#{descriptor} - unknown location (deferred)"
224
+ end
225
+
226
+ def delete!
227
+ if @list
228
+ @list.delete self
229
+ end
230
+ end
231
+ end
232
+ end
233
+
234
+ if __FILE__ == $0
235
+ method = Rubinius::CompiledMethod.of_sender
236
+ bp = Trepan::Breakpoint.new '<start>', method, 0, 2, 0
237
+ %w(describe location icon_char hits temp? enabled? condition).each do |field|
238
+ puts "#{field}: #{bp.send(field.to_sym)}"
239
+ end
240
+ bp.activate
241
+ bp.remove!
242
+ end