rb8-trepanning 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/CHANGES +34 -0
- data/ChangeLog +875 -0
- data/README.textile +59 -0
- data/Rakefile +215 -0
- data/app/.gitignore +1 -0
- data/app/cmd_parse.kpeg +241 -0
- data/app/cmd_parse.rb +212 -0
- data/app/cmd_parser.rb +1948 -0
- data/app/complete.rb +79 -0
- data/app/default.rb +90 -0
- data/app/display.rb +148 -0
- data/app/eventbuffer.rb +147 -0
- data/app/frame.rb +166 -0
- data/app/irb.rb +114 -0
- data/app/options.rb +200 -0
- data/app/run.rb +74 -0
- data/app/util.rb +65 -0
- data/bin/.gitignore +1 -0
- data/bin/trepan8 +115 -0
- data/data/.gitignore +1 -0
- data/data/irbrc +41 -0
- data/interface/.gitignore +1 -0
- data/interface/base_intf.rb +109 -0
- data/interface/client.rb +82 -0
- data/interface/comcodes.rb +20 -0
- data/interface/script.rb +110 -0
- data/interface/server.rb +147 -0
- data/interface/user.rb +165 -0
- data/io/base_io.rb +148 -0
- data/io/input.rb +158 -0
- data/io/null_output.rb +46 -0
- data/io/string_array.rb +156 -0
- data/io/tcpclient.rb +129 -0
- data/io/tcpfns.rb +33 -0
- data/io/tcpserver.rb +141 -0
- data/lib/debugger.rb +8 -0
- data/lib/trepanning.rb +283 -0
- data/processor/.gitignore +1 -0
- data/processor/command-ruby-debug/breakpoints.rb +155 -0
- data/processor/command-ruby-debug/catchpoint.rb +55 -0
- data/processor/command-ruby-debug/condition.rb +49 -0
- data/processor/command-ruby-debug/control.rb +31 -0
- data/processor/command-ruby-debug/display.rb +120 -0
- data/processor/command-ruby-debug/enable.rb +202 -0
- data/processor/command-ruby-debug/frame.rb +199 -0
- data/processor/command-ruby-debug/help.rb +63 -0
- data/processor/command-ruby-debug/info.rb +359 -0
- data/processor/command-ruby-debug/method.rb +84 -0
- data/processor/command-ruby-debug/reload.rb +40 -0
- data/processor/command-ruby-debug/save.rb +90 -0
- data/processor/command-ruby-debug/set.rb +237 -0
- data/processor/command-ruby-debug/show.rb +251 -0
- data/processor/command-ruby-debug/source.rb +36 -0
- data/processor/command-ruby-debug/threads.rb +189 -0
- data/processor/command-ruby-debug/trace.rb +57 -0
- data/processor/command-ruby-debug/variables.rb +199 -0
- data/processor/command.rb +270 -0
- data/processor/command/.gitignore +1 -0
- data/processor/command/alias.rb +54 -0
- data/processor/command/backtrace.rb +123 -0
- data/processor/command/base/cmd.rb +177 -0
- data/processor/command/base/subcmd.rb +230 -0
- data/processor/command/base/submgr.rb +188 -0
- data/processor/command/base/subsubcmd.rb +128 -0
- data/processor/command/base/subsubmgr.rb +199 -0
- data/processor/command/break.rb +114 -0
- data/processor/command/catch.rb +71 -0
- data/processor/command/complete.rb +39 -0
- data/processor/command/continue.rb +57 -0
- data/processor/command/directory.rb +50 -0
- data/processor/command/disable.rb +85 -0
- data/processor/command/display.rb +78 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/edit.rb +79 -0
- data/processor/command/enable.rb +48 -0
- data/processor/command/eval.rb +90 -0
- data/processor/command/exit.rb +66 -0
- data/processor/command/finish.rb +59 -0
- data/processor/command/frame.rb +97 -0
- data/processor/command/help.rb +230 -0
- data/processor/command/help/.gitignore +1 -0
- data/processor/command/help/README +10 -0
- data/processor/command/help/command.txt +58 -0
- data/processor/command/help/examples.txt +16 -0
- data/processor/command/help/filename.txt +40 -0
- data/processor/command/help/location.txt +37 -0
- data/processor/command/help/suffixes.txt +17 -0
- data/processor/command/info.rb +28 -0
- data/processor/command/info_subcmd/.gitignore +1 -0
- data/processor/command/info_subcmd/args.rb +39 -0
- data/processor/command/info_subcmd/breakpoints.rb +80 -0
- data/processor/command/info_subcmd/catch.rb +36 -0
- data/processor/command/info_subcmd/files.rb +39 -0
- data/processor/command/info_subcmd/globals.rb +64 -0
- data/processor/command/info_subcmd/line.rb +30 -0
- data/processor/command/info_subcmd/locals.rb +69 -0
- data/processor/command/info_subcmd/macro.rb +62 -0
- data/processor/command/info_subcmd/program.rb +51 -0
- data/processor/command/info_subcmd/ruby.rb +57 -0
- data/processor/command/info_subcmd/source.rb +74 -0
- data/processor/command/info_subcmd/stack.rb +25 -0
- data/processor/command/info_subcmd/threads.rb +75 -0
- data/processor/command/kill.rb +78 -0
- data/processor/command/list.rb +117 -0
- data/processor/command/macro.rb +68 -0
- data/processor/command/next.rb +79 -0
- data/processor/command/parsetree.rb +56 -0
- data/processor/command/pp.rb +40 -0
- data/processor/command/pr.rb +37 -0
- data/processor/command/ps.rb +40 -0
- data/processor/command/restart.rb +86 -0
- data/processor/command/save.rb +58 -0
- data/processor/command/set.rb +47 -0
- data/processor/command/set_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/abbrev.rb +25 -0
- data/processor/command/set_subcmd/auto.rb +27 -0
- data/processor/command/set_subcmd/auto_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +53 -0
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/list.rb +33 -0
- data/processor/command/set_subcmd/basename.rb +25 -0
- data/processor/command/set_subcmd/callstyle.rb +46 -0
- data/processor/command/set_subcmd/confirm.rb +24 -0
- data/processor/command/set_subcmd/debug.rb +47 -0
- data/processor/command/set_subcmd/different.rb +61 -0
- data/processor/command/set_subcmd/highlight.rb +43 -0
- data/processor/command/set_subcmd/max.rb +26 -0
- data/processor/command/set_subcmd/max_subcmd/list.rb +49 -0
- data/processor/command/set_subcmd/max_subcmd/stack.rb +50 -0
- data/processor/command/set_subcmd/max_subcmd/string.rb +76 -0
- data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
- data/processor/command/set_subcmd/reload.rb +42 -0
- data/processor/command/set_subcmd/timer.rb +58 -0
- data/processor/command/set_subcmd/trace.rb +37 -0
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +42 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +41 -0
- data/processor/command/shell.rb +139 -0
- data/processor/command/show.rb +39 -0
- data/processor/command/show_subcmd/.gitignore +1 -0
- data/processor/command/show_subcmd/abbrev.rb +20 -0
- data/processor/command/show_subcmd/alias.rb +46 -0
- data/processor/command/show_subcmd/args.rb +34 -0
- data/processor/command/show_subcmd/auto.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +27 -0
- data/processor/command/show_subcmd/auto_subcmd/irb.rb +23 -0
- data/processor/command/show_subcmd/auto_subcmd/list.rb +22 -0
- data/processor/command/show_subcmd/basename.rb +20 -0
- data/processor/command/show_subcmd/callstyle.rb +22 -0
- data/processor/command/show_subcmd/confirm.rb +18 -0
- data/processor/command/show_subcmd/debug.rb +26 -0
- data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +21 -0
- data/processor/command/show_subcmd/debug_subcmd/skip.rb +22 -0
- data/processor/command/show_subcmd/debug_subcmd/step.rb +22 -0
- data/processor/command/show_subcmd/different.rb +26 -0
- data/processor/command/show_subcmd/directories.rb +22 -0
- data/processor/command/show_subcmd/highlight.rb +24 -0
- data/processor/command/show_subcmd/max.rb +27 -0
- data/processor/command/show_subcmd/max_subcmd/list.rb +38 -0
- data/processor/command/show_subcmd/max_subcmd/stack.rb +36 -0
- data/processor/command/show_subcmd/max_subcmd/string.rb +42 -0
- data/processor/command/show_subcmd/max_subcmd/width.rb +37 -0
- data/processor/command/show_subcmd/reload.rb +18 -0
- data/processor/command/show_subcmd/timer.rb +18 -0
- data/processor/command/show_subcmd/trace.rb +29 -0
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +65 -0
- data/processor/command/show_subcmd/trace_subcmd/print.rb +23 -0
- data/processor/command/show_subcmd/version.rb +23 -0
- data/processor/command/source.rb +134 -0
- data/processor/command/step.rb +81 -0
- data/processor/command/tbreak.rb +19 -0
- data/processor/command/unalias.rb +44 -0
- data/processor/command/undisplay.rb +59 -0
- data/processor/command/up.rb +72 -0
- data/processor/default.rb +56 -0
- data/processor/display.rb +17 -0
- data/processor/eval.rb +113 -0
- data/processor/eventbuf.rb +105 -0
- data/processor/frame.rb +172 -0
- data/processor/help.rb +92 -0
- data/processor/helper.rb +76 -0
- data/processor/hook.rb +134 -0
- data/processor/load_cmds.rb +258 -0
- data/processor/location.rb +174 -0
- data/processor/main.rb +455 -0
- data/processor/mock.rb +136 -0
- data/processor/msg.rb +61 -0
- data/processor/processor.rb +674 -0
- data/processor/running.rb +168 -0
- data/processor/stepping.rb +18 -0
- data/processor/subcmd.rb +161 -0
- data/processor/validate.rb +355 -0
- data/processor/virtual.rb +34 -0
- data/test/data/.gitignore +1 -0
- data/test/data/break_bad.cmd +19 -0
- data/test/data/break_bad.right +29 -0
- data/test/data/break_loop_bug.cmd +5 -0
- data/test/data/break_loop_bug.right +15 -0
- data/test/data/dollar-0.right +2 -0
- data/test/data/dollar-0a.right +2 -0
- data/test/data/dollar-0b.right +2 -0
- data/test/data/edit.cmd +14 -0
- data/test/data/edit.right +24 -0
- data/test/data/file-with-space.cmd +6 -0
- data/test/data/file-with-space.right +4 -0
- data/test/data/printvar.cmd +17 -0
- data/test/data/printvar.right +31 -0
- data/test/data/raise.cmd +11 -0
- data/test/data/raise.right +19 -0
- data/test/data/source.cmd +5 -0
- data/test/data/source.right +18 -0
- data/test/data/stepping-1.9.right +50 -0
- data/test/data/stepping.cmd +21 -0
- data/test/data/stepping.right +48 -0
- data/test/data/trepan8-save.1 +6 -0
- data/test/example/bp_loop_issue.rb +3 -0
- data/test/example/break-bug.rb +7 -0
- data/test/example/brkpt-class-bug.rb +8 -0
- data/test/example/classes.rb +11 -0
- data/test/example/dollar-0.rb +5 -0
- data/test/example/except-bug1.rb +4 -0
- data/test/example/except-bug2.rb +7 -0
- data/test/example/file with space.rb +1 -0
- data/test/example/gcd.rb +18 -0
- data/test/example/info-var-bug.rb +47 -0
- data/test/example/info-var-bug2.rb +2 -0
- data/test/example/null.rb +1 -0
- data/test/example/pm-bug.rb +3 -0
- data/test/example/pm.rb +11 -0
- data/test/example/raise.rb +3 -0
- data/test/integration/.gitignore +4 -0
- data/test/integration/config.yaml +8 -0
- data/test/integration/helper.rb +154 -0
- data/test/integration/test-break_bad.rb +26 -0
- data/test/integration/test-dollar-0.rb +31 -0
- data/test/integration/test-edit.rb +17 -0
- data/test/integration/test-file-with-space.rb +26 -0
- data/test/integration/test-printvar.rb +17 -0
- data/test/integration/test-raise.rb +21 -0
- data/test/integration/test-source.rb +16 -0
- data/test/integration/test-stepping.rb +24 -0
- data/test/unit/.gitignore +1 -0
- data/test/unit/cmd-helper.rb +52 -0
- data/test/unit/mock-helper.rb +12 -0
- data/test/unit/test-app-cmd_parse.rb +97 -0
- data/test/unit/test-app-cmd_parser.rb +23 -0
- data/test/unit/test-app-complete.rb +39 -0
- data/test/unit/test-app-frame.rb +32 -0
- data/test/unit/test-app-options.rb +92 -0
- data/test/unit/test-app-run.rb +14 -0
- data/test/unit/test-app-util.rb +44 -0
- data/test/unit/test-base-cmd.rb +45 -0
- data/test/unit/test-base-subcmd.rb +57 -0
- data/test/unit/test-base-submgr.rb +23 -0
- data/test/unit/test-base-subsubcmd.rb +17 -0
- data/test/unit/test-cmd-alias.rb +48 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-help.rb +104 -0
- data/test/unit/test-cmd-kill.rb +46 -0
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-completion.rb +42 -0
- data/test/unit/test-intf-user.rb +46 -0
- data/test/unit/test-io-input.rb +27 -0
- data/test/unit/test-io-tcp.rb +33 -0
- data/test/unit/test-io-tcpclient.rb +54 -0
- data/test/unit/test-io-tcpfns.rb +17 -0
- data/test/unit/test-io-tcpserver.rb +50 -0
- data/test/unit/test-proc-eval.rb +36 -0
- data/test/unit/test-proc-hook.rb +30 -0
- data/test/unit/test-proc-load_cmds.rb +50 -0
- data/test/unit/test-proc-location.rb +79 -0
- data/test/unit/test-subcmd-help.rb +44 -0
- data/trepan8.gemspec +52 -0
- metadata +391 -0
|
@@ -0,0 +1,49 @@
|
|
|
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::SetMaxList < Trepan::SubSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
HELP = 'Set max[imum] list NUMBER
|
|
9
|
+
|
|
10
|
+
Set number of source-code lines to list by default.'
|
|
11
|
+
IN_LIST = true
|
|
12
|
+
MIN_ABBREV = 'lis'.size
|
|
13
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
14
|
+
PREFIX = %w(set max list)
|
|
15
|
+
SHORT_HELP = 'Set number of lines to list'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def run(args)
|
|
19
|
+
args.shift
|
|
20
|
+
run_set_int(args.join(' '),
|
|
21
|
+
"The '#{PREFIX.join(' ')}' command requires a list size",
|
|
22
|
+
0, nil)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
alias save_command save_command_from_settings
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
if __FILE__ == $0
|
|
30
|
+
# Demo it.
|
|
31
|
+
require_relative '../../../mock'
|
|
32
|
+
|
|
33
|
+
dbgr, set_cmd = MockDebugger::setup('set', false)
|
|
34
|
+
max_cmd = Trepan::SubSubcommand::SetMax.new(dbgr.processor,
|
|
35
|
+
set_cmd)
|
|
36
|
+
cmd_ary = Trepan::SubSubcommand::SetMaxWidth::PREFIX
|
|
37
|
+
cmd_name = cmd_ary.join('')
|
|
38
|
+
subcmd = Trepan::SubSubcommand::SetMaxList.new(set_cmd.proc,
|
|
39
|
+
max_cmd,
|
|
40
|
+
cmd_name)
|
|
41
|
+
prefix_run = cmd_ary[1..-1]
|
|
42
|
+
subcmd.run(prefix_run)
|
|
43
|
+
subcmd.run(prefix_run + %w(0))
|
|
44
|
+
subcmd.run(prefix_run + %w(20))
|
|
45
|
+
subcmd.summary_help(subcmd.name)
|
|
46
|
+
puts
|
|
47
|
+
puts '-' * 20
|
|
48
|
+
puts subcmd.save_command
|
|
49
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
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::SetMaxStack < Trepan::SubSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
HELP = 'Set number of backtrace lines the debugger will show'
|
|
9
|
+
DEFAULT_MIN = 3
|
|
10
|
+
MIN_ABBREV = 'sta'.size
|
|
11
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
12
|
+
PREFIX = %w(set max stack)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def run(args)
|
|
16
|
+
args.shift
|
|
17
|
+
args = %W(#{DEFAULT_MIN}) if args.empty?
|
|
18
|
+
run_set_int(args.join(' '),
|
|
19
|
+
"The '#{PREFIX.join(' ')}' command requires a list size",
|
|
20
|
+
DEFAULT_MIN, nil)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
alias save_command save_command_from_settings
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if __FILE__ == $0
|
|
28
|
+
# Demo it.
|
|
29
|
+
require_relative '../../../mock'
|
|
30
|
+
dbgr, set_cmd = MockDebugger::setup('set')
|
|
31
|
+
name = File.basename(__FILE__, '.rb')
|
|
32
|
+
|
|
33
|
+
dbgr, set_cmd = MockDebugger::setup('set')
|
|
34
|
+
max_cmd = Trepan::SubSubcommand::SetMax.new(dbgr.processor,
|
|
35
|
+
set_cmd)
|
|
36
|
+
cmd_ary = Trepan::SubSubcommand::SetMaxStack::PREFIX
|
|
37
|
+
cmd_name = cmd_ary.join('')
|
|
38
|
+
subcmd = Trepan::SubSubcommand::SetMaxStack.new(set_cmd.proc,
|
|
39
|
+
max_cmd,
|
|
40
|
+
cmd_name)
|
|
41
|
+
prefix_run = cmd_ary[1..-1]
|
|
42
|
+
subcmd.run(prefix_run)
|
|
43
|
+
subcmd.run(prefix_run + %w(0))
|
|
44
|
+
subcmd.run(prefix_run + %w(20))
|
|
45
|
+
name = File.basename(__FILE__, '.rb')
|
|
46
|
+
subcmd.summary_help(name)
|
|
47
|
+
puts
|
|
48
|
+
puts '-' * 20
|
|
49
|
+
puts subcmd.save_command
|
|
50
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'; require 'require_relative'
|
|
4
|
+
require_relative '../../base/subsubcmd'
|
|
5
|
+
|
|
6
|
+
class Trepan::SubSubcommand::SetMaxString < Trepan::SubSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
9
|
+
# FIXME: DRY the next two lines and throw in "set" too.
|
|
10
|
+
dirname = File.basename(File.dirname(File.expand_path(__FILE__)))
|
|
11
|
+
PREFIX = %W(set #{dirname[0...-'_subcmd'.size]} #{NAME})
|
|
12
|
+
DEFAULT_MIN = 10
|
|
13
|
+
DEFAULT_LENGTH = 80
|
|
14
|
+
|
|
15
|
+
HELP = <<-EOH
|
|
16
|
+
|
|
17
|
+
#{PREFIX.join(' ')} [NUM]
|
|
18
|
+
|
|
19
|
+
Sometimes the string representation of an object is very long. This
|
|
20
|
+
setting limits how much of the string representation you want to
|
|
21
|
+
see.
|
|
22
|
+
|
|
23
|
+
NUM must have a value at least #{DEFAULT_MIN}. If no value is supplied
|
|
24
|
+
#{DEFAULT_LENGTH} is used.
|
|
25
|
+
|
|
26
|
+
To disable any limit on the string size, use a negative number.
|
|
27
|
+
|
|
28
|
+
If the string has an embedded newline then we will assume the output
|
|
29
|
+
is intended to be formated as is.
|
|
30
|
+
|
|
31
|
+
Examples:
|
|
32
|
+
#{PREFIX.join(' ')} #{DEFAULT_LENGTH} # set maximum string length to 80
|
|
33
|
+
#{PREFIX.join(' ')} # same as above
|
|
34
|
+
#{PREFIX.join(' ')} -1 # set unlimited maximum string
|
|
35
|
+
#{PREFIX.join(' ')} -10 # same as above
|
|
36
|
+
#{PREFIX.join(' ')} #{DEFAULT_MIN-1} # invalid - number too small.
|
|
37
|
+
|
|
38
|
+
EOH
|
|
39
|
+
MIN_ABBREV = 'str'.size
|
|
40
|
+
SHORT_HELP = "Set maximum # chars in a string before truncation"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def run(args)
|
|
44
|
+
args.shift
|
|
45
|
+
args = %W(#{DEFAULT_LENGTH}) if args.empty?
|
|
46
|
+
run_set_int(args.join(' '),
|
|
47
|
+
"The 'set maximum string' command requires number at least #{DEFAULT_MIN}",
|
|
48
|
+
DEFAULT_MIN, nil)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
alias save_command save_command_from_settings
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if __FILE__ == $0
|
|
56
|
+
# Demo it.
|
|
57
|
+
require_relative '../../../mock'
|
|
58
|
+
# FIXME: DRY this code.
|
|
59
|
+
dbgr, set_cmd = MockDebugger::setup('set')
|
|
60
|
+
max_cmd = Trepan::SubSubcommand::SetMax.new(dbgr.processor,
|
|
61
|
+
set_cmd)
|
|
62
|
+
cmd_name = Trepan::SubSubcommand::SetMaxString::PREFIX.join('')
|
|
63
|
+
name = Trepan::SubSubcommand::SetMaxString::PREFIX[0]
|
|
64
|
+
subcmd = Trepan::SubSubcommand::SetMaxString.new(set_cmd.proc,
|
|
65
|
+
max_cmd,
|
|
66
|
+
cmd_name)
|
|
67
|
+
subcmd.run([])
|
|
68
|
+
subcmd.run(%W(#{name} 0))
|
|
69
|
+
subcmd.run(%W(#{name} 20))
|
|
70
|
+
subcmd.run(%W(#{name} 100))
|
|
71
|
+
name = File.basename(__FILE__, '.rb')
|
|
72
|
+
subcmd.summary_help(name)
|
|
73
|
+
puts
|
|
74
|
+
puts '-' * 20
|
|
75
|
+
puts subcmd.save_command
|
|
76
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
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::SetMaxWidth < Trepan::SubSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
HELP = 'Set max[imum] width NUMBER
|
|
9
|
+
|
|
10
|
+
Set number of characters the debugger thinks are in a line.'
|
|
11
|
+
IN_LIST = true
|
|
12
|
+
MIN_ABBREV = 'wid'.size
|
|
13
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
14
|
+
PREFIX = %w(set max width)
|
|
15
|
+
SHORT_HELP = 'Set number of characters the debugger thinks are in a line'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def run(args)
|
|
19
|
+
args.shift
|
|
20
|
+
run_set_int(args.join(' '),
|
|
21
|
+
"The 'width' command requires a line width",
|
|
22
|
+
0, nil)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
alias save_command save_command_from_settings
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
if __FILE__ == $0
|
|
30
|
+
# Demo it.
|
|
31
|
+
require_relative '../../../mock'
|
|
32
|
+
name = File.basename(__FILE__, '.rb')
|
|
33
|
+
|
|
34
|
+
dbgr, set_cmd = MockDebugger::setup('set')
|
|
35
|
+
# max_cmd = Trepan::SubSubcommand::SetMax.new(dbgr.core.processor,
|
|
36
|
+
# set_cmd)
|
|
37
|
+
# cmd_name = Trepan::SubSubcommand::SetMaxWidth::PREFIX.join('')
|
|
38
|
+
# subcmd = Trepan::SubSubcommand::SetMaxWidth.new(set_cmd.proc,
|
|
39
|
+
# max_cmd,
|
|
40
|
+
# cmd_name)
|
|
41
|
+
# subcmd.run(['max', 'width'])
|
|
42
|
+
# subcmd.run(%w(set max width 0))
|
|
43
|
+
# subcmd.run(%w(set max width 20))
|
|
44
|
+
name = File.basename(__FILE__, '.rb')
|
|
45
|
+
subcmd.summary_help(name)
|
|
46
|
+
# puts
|
|
47
|
+
# puts '-' * 20
|
|
48
|
+
# puts subcmd.save_command
|
|
49
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'; require 'require_relative'
|
|
4
|
+
require_relative '../base/subcmd'
|
|
5
|
+
|
|
6
|
+
class Trepan::Subcommand::SetReload < Trepan::SetBoolSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
SHORT_HELP = "Set whether to reread source text when it changes."
|
|
10
|
+
IN_LIST = true
|
|
11
|
+
MIN_ABBREV = 're'.size
|
|
12
|
+
HELP = <<-EOH
|
|
13
|
+
#{CMD} {on|off}
|
|
14
|
+
|
|
15
|
+
Source text is cached on the first read. This ensures that if you
|
|
16
|
+
change the source text after the debugged program is runnning you will
|
|
17
|
+
still see the source code as pertains to the running program rather
|
|
18
|
+
than what is in the filesystem.
|
|
19
|
+
|
|
20
|
+
However sometimes this may not be what you want. In particular in running
|
|
21
|
+
Ruby on Rails in development, Rails will also detect file changes and
|
|
22
|
+
will reload the source code. So here the debugger will be out of sync.
|
|
23
|
+
|
|
24
|
+
Set this to true, and the debugger will notice such changes and reread
|
|
25
|
+
the source text when it discovers it has changed.
|
|
26
|
+
|
|
27
|
+
See also "info source" and "info files" and note the SHA1
|
|
28
|
+
and file modification time.
|
|
29
|
+
EOH
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
if __FILE__ == $0
|
|
34
|
+
# Demo it.
|
|
35
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
|
36
|
+
require_relative '../../mock'
|
|
37
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetReload, false)
|
|
38
|
+
cmd.run(cmd.prefix + ['off'])
|
|
39
|
+
cmd.run(cmd.prefix + ['ofn'])
|
|
40
|
+
cmd.run(cmd.prefix)
|
|
41
|
+
puts cmd.save_command
|
|
42
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'; require 'require_relative'
|
|
4
|
+
require_relative '../base/subsubcmd'
|
|
5
|
+
|
|
6
|
+
class Trepan::Subcommand::SetTimer < Trepan::SetBoolSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = <<-EOH
|
|
10
|
+
#{PREFIX.join(' ')} [on|off]
|
|
11
|
+
|
|
12
|
+
Tracks and shows elapsed time between debugger events.
|
|
13
|
+
|
|
14
|
+
Since debugger overhead can be large depending on what you are doing,
|
|
15
|
+
there are many ways to customize the debugger to take less time (and
|
|
16
|
+
do less).
|
|
17
|
+
|
|
18
|
+
Stepping is slow, running to a breakpoint without stepping is
|
|
19
|
+
relatively fast compared to previous versions of the debugger and
|
|
20
|
+
compared to stepping.
|
|
21
|
+
|
|
22
|
+
Stopping at fewer events can also speed things up. Trace event
|
|
23
|
+
buffering slows things down.
|
|
24
|
+
|
|
25
|
+
Buy turning this setting on, you may be able to get a feel for what
|
|
26
|
+
how expensive the various settings.
|
|
27
|
+
|
|
28
|
+
See also: 'set events', 'set trace buffer', 'step', and 'break'.
|
|
29
|
+
EOH
|
|
30
|
+
|
|
31
|
+
MIN_ABBREV = 'ti'.size
|
|
32
|
+
SHORT_HELP = "Set to show elapsed time between debugger events"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def run(args)
|
|
36
|
+
super
|
|
37
|
+
if @proc.settings[:timer]
|
|
38
|
+
@proc.cmdloop_posthooks.insert_if_new(-1, 'timer', @proc.timer_hook[1])
|
|
39
|
+
@proc.cmdloop_prehooks.insert_if_new(-1, 'timer', @proc.timer_hook[1])
|
|
40
|
+
else
|
|
41
|
+
@proc.cmdloop_posthooks.delete_by_name('timer')
|
|
42
|
+
@proc.cmdloop_prehooks.delete_by_name('timer')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if __FILE__ == $0
|
|
49
|
+
# Demo it.
|
|
50
|
+
require_relative '../../mock'
|
|
51
|
+
require_relative '../../hook'
|
|
52
|
+
|
|
53
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetTimer)
|
|
54
|
+
cmd.run(cmd.prefix)
|
|
55
|
+
%w(off on).each do |arg|
|
|
56
|
+
cmd.run(cmd.prefix + [arg])
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 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
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
10
|
+
HELP = "Set tracing of various sorts.
|
|
11
|
+
|
|
12
|
+
The types of tracing include events from the trace buffer, or printing
|
|
13
|
+
those events.
|
|
14
|
+
|
|
15
|
+
See 'help #{PREFIX.join(' ')} *' for a list of subcommands or 'help set trace
|
|
16
|
+
<name>' for help on a particular trace subcommand."
|
|
17
|
+
|
|
18
|
+
IN_LIST = true
|
|
19
|
+
MIN_ABBREV = 'tr'.size
|
|
20
|
+
SHORT_HELP = 'Set tracing of various sorts.'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if __FILE__ == $0
|
|
26
|
+
# Demo it.
|
|
27
|
+
require_relative '../../mock'
|
|
28
|
+
dbgr, cmd = MockDebugger::setup('set')
|
|
29
|
+
# cmds = dbgr.core.processor.commands
|
|
30
|
+
# set_cmd = cmds['set']
|
|
31
|
+
# command = Trepan::SubSubcommand::SetTrace.new(dbgr.core.processor,
|
|
32
|
+
# set_cmd)
|
|
33
|
+
# set_cmd.instance_variable_set('@last_args', command.class.const_get('CMD'))
|
|
34
|
+
# # require_relative '../../../lib/trepanning'
|
|
35
|
+
# # Trepan.debug
|
|
36
|
+
# command.run(command.class.const_get('PREFIX'))
|
|
37
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'; require 'require_relative'
|
|
4
|
+
require_relative '../../base/subsubcmd'
|
|
5
|
+
|
|
6
|
+
class Trepan::SubSubcommand::SetTraceBuffer < Trepan::SetBoolSubSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = <<-EOH
|
|
10
|
+
#{CMD} [on|off|1|0]
|
|
11
|
+
|
|
12
|
+
Set saving trace events in a buffer
|
|
13
|
+
EOH
|
|
14
|
+
MIN_ABBREV = 'b'.size
|
|
15
|
+
SHORT_HELP = 'Set saving trace events in a buffer'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def run(args)
|
|
19
|
+
super
|
|
20
|
+
if settings[:tracebuffer]
|
|
21
|
+
# @proc.start_capture
|
|
22
|
+
@proc.unconditional_prehooks.insert_if_new(-1, *@proc.tracebuf_hook)
|
|
23
|
+
else
|
|
24
|
+
@proc.unconditional_prehooks.delete_by_name('tracebuffer')
|
|
25
|
+
# @proc.stop_capture
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
if __FILE__ == $0
|
|
32
|
+
# Demo it.
|
|
33
|
+
require_relative '../../../mock'
|
|
34
|
+
require_relative '../trace'
|
|
35
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetTrace,
|
|
36
|
+
Trepan::SubSubcommand::SetTraceBuffer)
|
|
37
|
+
%w(off on 1 0).each do |arg|
|
|
38
|
+
cmd.run([cmd.name, arg])
|
|
39
|
+
end
|
|
40
|
+
puts cmd.save_command()
|
|
41
|
+
end
|
|
42
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'; require 'require_relative'
|
|
4
|
+
require_relative '../../base/subsubcmd'
|
|
5
|
+
|
|
6
|
+
class Trepan::SubSubcommand::SetTracePrint < Trepan::SetBoolSubSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = <<-EOH
|
|
10
|
+
#{CMD} [on|off|1|0]
|
|
11
|
+
|
|
12
|
+
Set printing trace events.
|
|
13
|
+
EOH
|
|
14
|
+
|
|
15
|
+
MIN_ABBREV = 'p'.size
|
|
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 '../trace'
|
|
34
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetTrace,
|
|
35
|
+
Trepan::SubSubcommand::SetTracePrint)
|
|
36
|
+
%w(off on 1 0).each do |arg|
|
|
37
|
+
cmd.run([cmd.name, arg])
|
|
38
|
+
end
|
|
39
|
+
puts cmd.save_command()
|
|
40
|
+
end
|
|
41
|
+
|