rbx-trepanning 0.0.2-universal-rubinius-1.2

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 +35 -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 +49 -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
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subsubcmd'
5
+ require_relative '../base/subsubmgr'
6
+
7
+ class Trepan::SubSubcommand::SetSubstitute < Trepan::SubSubcommandMgr
8
+ unless defined?(HELP)
9
+ HELP = 'Set instruction sequence-to-filename mapping'
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %W(set #{NAME})
12
+ end
13
+ end
14
+
15
+ if __FILE__ == $0
16
+ require_relative '../../mock'
17
+ dbgr, set_cmd = MockDebugger::setup('set')
18
+ command = Trepan::SubSubcommand::SetSubstitute.new(dbgr.processor, set_cmd)
19
+ name = File.basename(__FILE__, '.rb')
20
+ cmd_args = ['set', name]
21
+ set_cmd.instance_variable_set('@last_args', cmd_args)
22
+ # require_relative '../../../lib/trepanning'
23
+ # Trepan.debug(:set_restart => true)
24
+ command.run(cmd_args)
25
+ end
@@ -0,0 +1,56 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+ require_relative '../substitute'
6
+
7
+ class Trepan::SubSubcommand::SetSubstitutePath < Trepan::SubSubcommand
8
+ unless defined?(HELP)
9
+ HELP =
10
+ 'Add a substitution rule replacing FROM into TO in source file names.
11
+ If a substitution rule was previously set for FROM, the old rule
12
+ is replaced by the new one.'
13
+ MIN_ABBREV = 'fi'.size
14
+ MAX_ARGS = 2
15
+ NAME = File.basename(__FILE__, '.rb')
16
+ SHORT_HELP = 'Use PATH in place of an filename'
17
+ PREFIX = %w(set substitute path)
18
+ end
19
+
20
+ def run(args)
21
+ if args.size != 3
22
+ errmsg "This command needs 2 arguments, got #{args.size-1}."
23
+ return
24
+ end
25
+ from_path = args[1]
26
+ to_path = args[2]
27
+ # FIXME Check from_path name to see if it is loaded
28
+ if File.exist?(to_path)
29
+ LineCache::remap_file(from_path, to_path)
30
+ else
31
+ errmsg "File #{to_path} doesn't exist"
32
+ end
33
+ end
34
+ end
35
+
36
+ if __FILE__ == $0
37
+ # Demo it.
38
+ require_relative '../../../mock'
39
+ require_relative '../../../subcmd'
40
+ name = File.basename(__FILE__, '.rb')
41
+
42
+ # FIXME: DRY the below code
43
+ dbgr, set_cmd = MockDebugger::setup('set')
44
+ testcmdMgr = Trepan::Subcmd.new(set_cmd)
45
+ cmd_name = Trepan::SubSubcommand::SetSubstitutePath::PREFIX.join('')
46
+ setx_cmd = Trepan::SubSubcommand::SetSubstitutePath.new(set_cmd.proc,
47
+ set_cmd,
48
+ cmd_name)
49
+ # require_relative '../../../../lib/trepanning'
50
+ # dbgr = Trepan.new(:set_restart => true)
51
+ # dbgr.debugger
52
+ setx_cmd.run([])
53
+
54
+ # name = File.basename(__FILE__, '.rb')
55
+ # subcommand.summary_help(name)
56
+ end
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subsubcmd'
5
+ require_relative '../base/subsubmgr'
6
+
7
+ class Trepan::SubSubcommand::SetTrace < Trepan::SubSubcommandMgr
8
+ unless defined?(HELP)
9
+ HELP = "Set tracing of various sorts.
10
+
11
+ The types of tracing include global variables, events from the trace
12
+ buffer, or printing those events.
13
+
14
+ See 'help set trace *' or a list of subcommands or 'help set trace
15
+ <name>' for help on a particular trace subcommand."
16
+
17
+ IN_LIST = true
18
+ MIN_ABBREV = 'tr'.size
19
+ NAME = File.basename(__FILE__, '.rb')
20
+ PREFIX = %W(set #{NAME})
21
+ SHORT_HELP = 'Set tracing of various sorts.'
22
+ end
23
+
24
+ end
25
+
26
+ if __FILE__ == $0
27
+ # Demo it.
28
+ require_relative '../../mock'
29
+ cmd_ary = Trepan::SubSubcommand::SetTrace::PREFIX
30
+ dbgr, parent_cmd = MockDebugger::setup(cmd_ary[0], false)
31
+ command = Trepan::SubSubcommand::SetTrace.new(dbgr.processor,
32
+ parent_cmd)
33
+ # require_relative '../../../lib/trepanning'
34
+ # Trepan.debug(:set_restart => true)
35
+ command.run(cmd_ary)
36
+ command.run(['set', command.name, 'print'])
37
+ end
@@ -0,0 +1,57 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+ require_relative '../trace'
6
+ class Trepan::SubSubcommand::SetTracePrint < Trepan::SetBoolSubSubcommand
7
+ unless defined?(HELP)
8
+ HELP =
9
+ "set trace print [on|off|1|0]
10
+
11
+ Set printing trace events."
12
+
13
+ MIN_ABBREV = 'p'.size
14
+ NAME = File.basename(__FILE__, '.rb')
15
+ PREFIX = %w(set trace print)
16
+ SHORT_HELP = 'Set print trace events'
17
+ end
18
+
19
+ def run(args)
20
+ super
21
+ if settings[:traceprint]
22
+ @proc.unconditional_prehooks.insert_if_new(-1, *@proc.trace_hook)
23
+ else
24
+ @proc.unconditional_prehooks.delete_by_name('trace')
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ if __FILE__ == $0
31
+ # Demo it.
32
+ require_relative '../../../mock'
33
+ require_relative '../../../subcmd'
34
+ name = File.basename(__FILE__, '.rb')
35
+
36
+ # FIXME: DRY the below code
37
+ cmd_ary = Trepan::SubSubcommand::SetTracePrint::PREFIX
38
+ dbgr, parent_cmd = MockDebugger::setup(cmd_ary[0], false)
39
+ trace_cmd = Trepan::SubSubcommand::SetTrace.new(dbgr.processor,
40
+ parent_cmd)
41
+ cmd_name = cmd_ary.join('')
42
+ subcmd = Trepan::SubSubcommand::SetTracePrint.new(parent_cmd.proc,
43
+ trace_cmd,
44
+ cmd_name)
45
+ prefix_run = cmd_ary[2..-1]
46
+ # require_relative '../../../../lib/trepanning'
47
+ # dbgr = Trepan.new(:set_restart => true)
48
+ # dbgr.debugger
49
+
50
+ subcmd.run(prefix_run)
51
+ %w(off on 1 0).each { |arg| subcmd.run(prefix_run + [arg]) }
52
+ puts
53
+ puts '-' * 20
54
+ puts subcmd.save_command()
55
+
56
+ end
57
+
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative 'base/submgr'
5
+
6
+ class Trepan::Command::ShowCommand < Trepan::SubcommandMgr
7
+ unless defined?(HELP)
8
+ HELP =
9
+ 'Generic command for showing things about the debugger. You can
10
+ give unique prefix of the name of a subcommand to get information
11
+ about just that subcommand.
12
+
13
+ Type "show" for a list of "show" subcommands and what they do.
14
+ Type "help show *" for just a list of "show" subcommands.'
15
+
16
+ CATEGORY = 'status'
17
+ NAME = File.basename(__FILE__, '.rb')
18
+ NEED_STACK = false
19
+ SHORT_HELP = 'Show parts of the debugger environment'
20
+ end
21
+ end
22
+
23
+ if __FILE__ == $0
24
+ require_relative '../mock'
25
+ dbgr, cmd = MockDebugger::setup
26
+ cmd.run([cmd.name])
27
+ end
@@ -0,0 +1,43 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subcmd'
5
+
6
+ class Trepan::Subcommand::ShowAlias < Trepan::Subcommand
7
+ NAME = File.basename(__FILE__, '.rb')
8
+ unless defined?(HELP)
9
+ HELP = <<-EOH
10
+ show #{NAME} [NAME1 NAME2 ...]
11
+
12
+ If aliases names are given, show their definition. If left blank, show
13
+ all alias names
14
+ EOH
15
+ MIN_ABBREV = 'al'.size
16
+ PREFIX = %W(show #{NAME})
17
+ SHORT_HELP = "Show defined aliases"
18
+ end
19
+
20
+ def run(args)
21
+ if args.size > 2
22
+ args[2..-1].each do |alias_name|
23
+ if @proc.aliases.member?(alias_name)
24
+ msg "%s: %s" % [alias_name, @proc.aliases[alias_name]]
25
+ else
26
+ msg "%s is not a defined alias" % alias_name
27
+ end
28
+ end
29
+ elsif @proc.aliases.empty?
30
+ msg "No aliases defined."
31
+ else
32
+ msg "List of aliases names currently defined:"
33
+ msg columnize_commands(@proc.aliases.keys.sort)
34
+ end
35
+ end
36
+ end
37
+
38
+ if __FILE__ == $0
39
+ # Demo it.
40
+ require_relative '../../mock'
41
+ cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowAlias)
42
+ cmd.run(cmd.prefix + %w(u foo))
43
+ end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subcmd'
5
+
6
+ class Trepan::Subcommand::ShowArgs < Trepan::Subcommand
7
+ unless defined?(HELP)
8
+ NAME = File.basename(__FILE__, '.rb')
9
+ HELP = 'Show argument list to give program when it is restarted'
10
+ MIN_ABBREV = 'ar'.size
11
+ PREFIX = %W(show #{NAME})
12
+ end
13
+
14
+ def run(args)
15
+ dbgr = @proc.dbgr
16
+ msg "Restart directory: #{Rubinius::OS_STARTUP_DIR}"
17
+ msg "Restart args:\n\t#{dbgr.restart_argv.inspect}"
18
+ end
19
+
20
+ end
21
+
22
+ if __FILE__ == $0
23
+ # Demo it.
24
+ require_relative '../../mock'
25
+ cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowArgs)
26
+ end
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subsubcmd'
5
+ require_relative '../base/subsubmgr'
6
+
7
+ class Trepan::SubSubcommand::ShowAuto < Trepan::SubSubcommandMgr
8
+ unless defined?(HELP)
9
+ HELP = 'Show settings which some sort of "automatic" default behavior'
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %w(show auto)
12
+ end
13
+ end
14
+
15
+ if __FILE__ == $0
16
+ require_relative '../../mock'
17
+ dbgr = MockDebugger::MockDebugger.new
18
+ cmds = dbgr.core.processor.commands
19
+ show_cmd = cmds['show']
20
+ # command = Trepan::SubSubcommand::ShowAuto.new(dbgr.core.processor,
21
+ # show_cmd)
22
+ # name = File.basename(__FILE__, '.rb')
23
+ # cmd_args = ['show', name]
24
+ # show_cmd.instance_variable_set('@last_args', cmd_args)
25
+ # # require_relative '../../../lib/trepanning'
26
+ # # Trepan.debug(:set_restart => true)
27
+ # command.run(cmd_args)
28
+ end
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+
6
+ class Trepan::SubSubcommand::ShowAutoDis < Trepan::ShowBoolSubSubcommand
7
+ unless defined?(HELP)
8
+ HELP = "Show running a 'dis' command each time we enter the debugger"
9
+ MIN_ABBREV = 'l'.size
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %w(show auto dis)
12
+ end
13
+
14
+ end
15
+
16
+ if __FILE__ == $0
17
+ # Demo it.
18
+ require_relative '../../../mock'
19
+ require_relative '../../../subcmd'
20
+
21
+ # FIXME: DRY the below code
22
+
23
+ dbgr, show_cmd = MockDebugger::setup('show', false)
24
+ testcmdMgr = Trepan::Subcmd.new(show_cmd)
25
+ auto_cmd = Trepan::SubSubcommand::ShowAuto.new(dbgr.processor,
26
+ show_cmd)
27
+
28
+ # FIXME: remove the 'join' below
29
+ cmd_name = Trepan::SubSubcommand::ShowAutoDis::PREFIX.join('')
30
+ autox_cmd = Trepan::SubSubcommand::ShowAutoDis.new(show_cmd.proc, auto_cmd,
31
+ cmd_name)
32
+ # require_relative '../../../../lib/trepanning'
33
+ # dbgr = Trepan.new(:set_restart => true)
34
+ # dbgr.debugger
35
+ autox_cmd.run([])
36
+
37
+ end
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+
6
+ class Trepan::SubSubcommand::ShowAutoEval < Trepan::ShowBoolSubSubcommand
7
+ unless defined?(HELP)
8
+ HELP = "set auto eval [ON|OFF]
9
+
10
+ Set this on if you want things that don't look like debugger command to be eval'd
11
+ as a string."
12
+
13
+ MIN_ABBREV = 'ev'.size
14
+ NAME = File.basename(__FILE__, '.rb')
15
+ PREFIX = %W(show auto #{NAME})
16
+ SHORT_HELP = "Show evaluation of unrecognized debugger commands"
17
+ end
18
+
19
+ end
20
+
21
+ if __FILE__ == $0
22
+ # Demo it.
23
+ require_relative '../../../mock'
24
+ require_relative '../auto'
25
+ cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::ShowAuto,
26
+ Trepan::SubSubcommand::ShowAutoEval)
27
+
28
+ end
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+ require_relative '../auto'
6
+
7
+ class Trepan::SubSubcommand::ShowAutoIrb < Trepan::ShowBoolSubSubcommand
8
+ unless defined?(HELP)
9
+ HELP = "Show if IRB is invoked on debugger stops"
10
+ MIN_ABBREV = 'ir'.size
11
+ NAME = File.basename(__FILE__, '.rb')
12
+ PREFIX = %W(show auto #{NAME})
13
+ end
14
+
15
+ end
16
+
17
+ if __FILE__ == $0
18
+ # Demo it.
19
+ require_relative '../../../mock'
20
+ require_relative '../auto'
21
+ cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::ShowIrb,
22
+ Trepan::SubSubcommand::ShowAutoIrb)
23
+ end
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+
6
+ class Trepan::SubSubcommand::ShowAutoList < Trepan::ShowBoolSubSubcommand
7
+ unless defined?(HELP)
8
+ HELP = "Show running a 'list' command each time we enter the debugger"
9
+ MIN_ABBREV = 'l'.size
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %W(show auto #{NAME})
12
+ end
13
+
14
+ end
15
+
16
+ if __FILE__ == $0
17
+ # Demo it.
18
+ require_relative '../../../mock'
19
+ require_relative '../auto'
20
+ cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::ShowAuto,
21
+ Trepan::SubSubcommand::ShowAutoList)
22
+ end
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subcmd'
5
+
6
+ class Trepan::Subcommand::ShowBasename < Trepan::ShowBoolSubcommand
7
+ unless defined?(HELP)
8
+ HELP = "Show only file basename in showing file names"
9
+ MIN_ABBREV = 'ba'.size
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %W(show #{NAME})
12
+ end
13
+
14
+ end
15
+
16
+ if __FILE__ == $0
17
+ # Demo it.
18
+ $0 = __FILE__ + 'notagain' # So we don't run this agin
19
+ require_relative '../../mock'
20
+ cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowBasename, false)
21
+ cmd.run(cmd.prefix)
22
+ end
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subsubcmd'
5
+ require_relative '../base/subsubmgr'
6
+
7
+ class Trepan::SubSubcommand::ShowDebug < Trepan::SubSubcommandMgr
8
+ unless defined?(HELP)
9
+ HELP = 'Show internal debugger settings.'
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %W(show #{NAME})
12
+ end
13
+ end
14
+
15
+ if __FILE__ == $0
16
+ require_relative '../../mock'
17
+ dbgr, cmd = MockDebugger::setup('show')
18
+ show_cmd = cmds['show']
19
+ # command = Trepan::SubSubcommand::ShowDebug.new(dbgr.core.processor,
20
+ # show_cmd)
21
+ # name = File.basename(__FILE__, '.rb')
22
+ # cmd_args = ['show', name]
23
+ # show_cmd.instance_variable_set('@last_args', cmd_args)
24
+ # # require_relative '../../../lib/trepanning'
25
+ # # Trepan.debug(:set_restart => true)
26
+ # command.run(cmd_args)
27
+ end
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+
6
+ class Trepan::SubSubcommand::ShowDebugDbgr < Trepan::ShowBoolSubSubcommand
7
+ unless defined?(HELP)
8
+ HELP = "Show debugging the debugger"
9
+ NAME = File.basename(__FILE__, '.rb')
10
+ PREFIX = %W(show debug #{NAME})
11
+ end
12
+
13
+ end
14
+
15
+ if __FILE__ == $0
16
+ # Demo it.
17
+ require_relative '../../../mock'
18
+ require_relative '../debug'
19
+ cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::ShowDebug,
20
+ Trepan::SubSubcommand::ShowDebugDbgr)
21
+ end
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+
6
+ class Trepan::SubSubcommand::ShowDebugSkip < Trepan::ShowBoolSubSubcommand
7
+ unless defined?(HELP)
8
+ HELP = 'Show debugging of statement skip logic'
9
+ MIN_ABBREV = 'st'.size
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %W(show debug #{NAME})
12
+ end
13
+
14
+ end
15
+
16
+ if __FILE__ == $0
17
+ # Demo it.
18
+ require_relative '../../../mock'
19
+ require_relative '../debug'
20
+ cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::ShowDebug,
21
+ Trepan::SubSubcommand::ShowDebugSkip)
22
+ end
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../../base/subsubcmd'
5
+
6
+ class Trepan::SubSubcommand::ShowDebugStep < Trepan::ShowBoolSubSubcommand
7
+ unless defined?(HELP)
8
+ HELP = 'Show debugging of statement step logic'
9
+ MIN_ABBREV = 'st'.size
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %W(show debug #{NAME})
12
+ end
13
+
14
+ end
15
+
16
+ if __FILE__ == $0
17
+ # Demo it.
18
+ require_relative '../../../mock'
19
+ require_relative '../debug'
20
+ cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::ShowDebug,
21
+ Trepan::SubSubcommand::ShowDebugStep)
22
+ end
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subcmd'
5
+
6
+ class Trepan::Subcommand::ShowDifferent < Trepan::ShowBoolSubcommand
7
+ unless defined?(HELP)
8
+ HELP = "Show status of 'set different'"
9
+ MIN_ABBREV = 'dif'.size
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %W(show #{NAME})
12
+ end
13
+
14
+ def run(args)
15
+ if 'nostack' == @proc.settings[:different]
16
+ msg "%s is nostack." % HELP[5..-1].capitalize
17
+ else
18
+ super
19
+ end
20
+ end
21
+ end
22
+
23
+ if __FILE__ == $0
24
+ # Demo it.
25
+ require_relative '../../mock'
26
+ cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowDifferent)
27
+ end
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subsubcmd'
5
+
6
+ class Trepan::Subcommand::ShowHidelevel < Trepan::ShowIntSubcommand
7
+ unless defined?(HELP)
8
+ HELP = 'Show the number of stack levels to hide'
9
+ MIN_ABBREV = 'hide'.size
10
+ NAME = File.basename(__FILE__, '.rb')
11
+ PREFIX = %w(show hidelevel)
12
+ end
13
+ def run(args)
14
+ if @proc.settings[:hidelevel]
15
+ super
16
+ else
17
+ help = self.class.const_get(:HELP)
18
+ msg "%s is auto selection." % help[5..-1].capitalize
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+ if __FILE__ == $0
25
+ # Demo it.
26
+ require_relative '../../mock'
27
+
28
+ # FIXME: DRY the below code
29
+ dbgr, cmd = MockDebugger::setup('show')
30
+ subcommand = Trepan::Subcommand::ShowHidelevel.new(cmd)
31
+
32
+ subcommand.run(subcommand.name)
33
+ subcommand.proc.settings[:hidelevel] = 1
34
+ subcommand.run(subcommand.name)
35
+
36
+ # require_relative '../../../../lib/trepanning'
37
+ # dbgr = Trepan.new(:set_restart => true)
38
+ # dbgr.debugger
39
+ subcommand.summary_help(subcommand.name)
40
+ puts
41
+ puts '-' * 20
42
+ end
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require 'rubygems'; require 'require_relative'
4
+ require_relative '../base/subcmd'
5
+
6
+ class Trepan::Subcommand::ShowKernelstep < Trepan::Subcommand
7
+ unless defined?(HELP)
8
+ NAME = File.basename(__FILE__, '.rb')
9
+ HELP = "Show stepping into kernel methods"
10
+
11
+ IN_LIST = true
12
+ MIN_ABBREV = 'kern'.size
13
+ PREFIX = %W(set #{NAME})
14
+
15
+ # Specific to this class
16
+ KERNEL_METHOD_FILE_RE = /^kernel\//
17
+ end
18
+
19
+ def ignore?
20
+ @proc.ignore_file_re.member?(KERNEL_METHOD_FILE_RE)
21
+ end
22
+
23
+ def show
24
+ msg("stepping into kernel methods is %s." %
25
+ (ignore? ? 'disallowed' : 'allowed'))
26
+ end
27
+
28
+ def run(args)
29
+ show
30
+ end
31
+ end
32
+
33
+ if __FILE__ == $0
34
+ # Demo it.
35
+ require_relative '../../mock'
36
+ cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowKernelstep)
37
+ end