rb8-trepanning 0.1.3-universal-ruby-1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +58 -0
- metadata +388 -0
@@ -0,0 +1,23 @@
|
|
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::ShowTracePrint < Trepan::ShowBoolSubSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
HELP = "Show tracing print status"
|
9
|
+
MIN_ABBREV = 'p'.size
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
PREFIX = %w(show trace buffer)
|
12
|
+
SHORT_HELP = "Show tracing print status"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
if __FILE__ == $0
|
18
|
+
# Demo it.
|
19
|
+
require_relative '../../../mock'
|
20
|
+
require_relative '../trace'
|
21
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::ShowTrace,
|
22
|
+
Trepan::SubSubcommand::ShowTracePrint)
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../../app/options'
|
5
|
+
require_relative '../base/subcmd'
|
6
|
+
|
7
|
+
class Trepan::Subcommand::ShowVersion < Trepan::Subcommand
|
8
|
+
unless defined?(HELP)
|
9
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
10
|
+
HELP = "Show what version of #{Trepan::PROGRAM} this is"
|
11
|
+
MIN_ABBREV = 'vers'.size
|
12
|
+
end
|
13
|
+
|
14
|
+
def run(args)
|
15
|
+
msg Trepan::show_version
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
if __FILE__ == $0
|
20
|
+
# Demo it.
|
21
|
+
require_relative '../../mock'
|
22
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowVersion)
|
23
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
# Our local modules
|
6
|
+
require 'rubygems'; require 'require_relative'
|
7
|
+
require_relative 'base/cmd'
|
8
|
+
require_relative '../../interface/script'
|
9
|
+
require_relative '../../io/null_output'
|
10
|
+
require_relative '../../app/default'
|
11
|
+
|
12
|
+
class Trepan::Command::SourceCommand < Trepan::Command
|
13
|
+
unless defined?(HELP)
|
14
|
+
NAME = File.basename(__FILE__, '.rb')
|
15
|
+
HELP = <<-HELP
|
16
|
+
#{NAME} [options] FILE
|
17
|
+
|
18
|
+
options:
|
19
|
+
-q | --quiet | --no-quiet
|
20
|
+
-c | --continue | --no-continue
|
21
|
+
-Y | --yes | -N | --no
|
22
|
+
-v | --verbose | --no-verbose
|
23
|
+
|
24
|
+
Read debugger commands from a file named FILE. Optional -v switch
|
25
|
+
causes each command in FILE to be echoed as it is executed. Option -Y
|
26
|
+
sets the default value in any confirmation command to be 'yes' and -N
|
27
|
+
sets the default value to 'no'.
|
28
|
+
|
29
|
+
Option -q will turn off any debugger output that normally occurs in the
|
30
|
+
running of the program.
|
31
|
+
|
32
|
+
Note that the command startup file #{Trepan::CMD_INITFILE_BASE} is read automatically
|
33
|
+
via a #{NAME} command the debugger is started.
|
34
|
+
|
35
|
+
An error in any command terminates execution of the command file
|
36
|
+
unless option -c or --continue is given.
|
37
|
+
HELP
|
38
|
+
CATEGORY = 'support'
|
39
|
+
MIN_ARGS = 1 # Need at least this many
|
40
|
+
MAX_ARGS = nil
|
41
|
+
SHORT_HELP = 'Read and run debugger commands from a file'
|
42
|
+
|
43
|
+
DEFAULT_OPTIONS = {
|
44
|
+
:abort_on_error => false,
|
45
|
+
:confirm_val => false,
|
46
|
+
:quiet => false,
|
47
|
+
:verbose => false
|
48
|
+
}
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def complete(prefix)
|
53
|
+
files = Readline::FILENAME_COMPLETION_PROC.call(prefix) || []
|
54
|
+
opts = %w(-c --continue --no-continue -N --no -y --yes
|
55
|
+
--verbose --no-verbose) + files
|
56
|
+
Trepan::Complete.complete_token(opts, prefix)
|
57
|
+
end
|
58
|
+
|
59
|
+
def parse_options(options, args) # :nodoc
|
60
|
+
seen_yes_no = false
|
61
|
+
parser = OptionParser.new do |opts|
|
62
|
+
opts.on('-c', '--[no-]continue',
|
63
|
+
'Continue in the face of errors') do
|
64
|
+
|v|
|
65
|
+
options[:abort_on_error] = !v
|
66
|
+
end
|
67
|
+
opts.on('-v',
|
68
|
+
'--[no-]verbose', 'echo each command as it is executed') do
|
69
|
+
|v|
|
70
|
+
options[:verbose] = v
|
71
|
+
end
|
72
|
+
opts.on('-N', '--no', "Use 'no' in any confirmation prompts") do
|
73
|
+
|v|
|
74
|
+
if seen_yes_no
|
75
|
+
msg('Yes/No option already seen. This option (no) ignored.')
|
76
|
+
end
|
77
|
+
options[:confirm_val] = false
|
78
|
+
end
|
79
|
+
opts.on('-q', '--[no-]quiet', 'Silence debugger output') do
|
80
|
+
|v|
|
81
|
+
options[:quiet] = v
|
82
|
+
end
|
83
|
+
opts.on('-Y', '--yes', "Use 'yes' in any confirmation prompts") do
|
84
|
+
|v|
|
85
|
+
if seen_yes_no
|
86
|
+
msg("Yes/No option already seen. This option, --yes, ignored.")
|
87
|
+
end
|
88
|
+
options[:confirm_val] = true
|
89
|
+
seen_yes_no = true
|
90
|
+
end
|
91
|
+
end
|
92
|
+
parser.parse(args)
|
93
|
+
return options
|
94
|
+
end
|
95
|
+
|
96
|
+
def run(args)
|
97
|
+
options = parse_options(DEFAULT_OPTIONS.dup, args[1..-2])
|
98
|
+
intf = @proc.interfaces
|
99
|
+
output = options[:quiet] ? Trepan::OutputNull.new(nil) : intf[-1].output
|
100
|
+
|
101
|
+
filename = args[-1]
|
102
|
+
|
103
|
+
expanded_file = File.expand_path(filename)
|
104
|
+
unless File.readable?(expanded_file)
|
105
|
+
errmsg("Debugger command file '%s' (%s) is not a readable file" %
|
106
|
+
[filename, expanded_file])
|
107
|
+
return false
|
108
|
+
end
|
109
|
+
|
110
|
+
# Push a new debugger interface.
|
111
|
+
script_intf = Trepan::ScriptInterface.new(expanded_file, output, options)
|
112
|
+
intf << script_intf
|
113
|
+
return false
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Demo it
|
118
|
+
if __FILE__ == $0
|
119
|
+
require_relative '../mock'
|
120
|
+
dbgr, cmd = MockDebugger::setup
|
121
|
+
%w(--quiet -q --no-quiet --continue --no-continue -c -v --verbose
|
122
|
+
--no-verbose).each do |opt|
|
123
|
+
puts "parsing #{opt}"
|
124
|
+
options =
|
125
|
+
cmd.parse_options(Trepan::Command::SourceCommand::DEFAULT_OPTIONS.dup,
|
126
|
+
opt)
|
127
|
+
p options
|
128
|
+
end
|
129
|
+
|
130
|
+
if ARGV.size >= 1
|
131
|
+
puts "running... #{cmd.name} #{ARGV}"
|
132
|
+
cmd.run([cmd.name, *ARGV])
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require_relative 'base/cmd'
|
4
|
+
|
5
|
+
class Trepan::Command::StepCommand < Trepan::Command
|
6
|
+
|
7
|
+
ALIASES = %w(s s+ s- step+ step-)
|
8
|
+
CATEGORY = 'running'
|
9
|
+
NAME = File.basename(__FILE__, '.rb')
|
10
|
+
HELP = <<-HELP
|
11
|
+
#{NAME}[+|-] [into] [count]
|
12
|
+
|
13
|
+
Execute the current line, stopping at the next line. Sometimes this
|
14
|
+
is called 'step into'.
|
15
|
+
|
16
|
+
Behaves like 'next', but if there is a method call on the current line,
|
17
|
+
execution is stopped in the called method.
|
18
|
+
|
19
|
+
Examples:
|
20
|
+
#{NAME} # step 1 line
|
21
|
+
#{NAME} 1 # same as above
|
22
|
+
#{NAME} into # same as above
|
23
|
+
#{NAME} into 1 # same as above
|
24
|
+
#{NAME} 5/5+0 # same as above
|
25
|
+
#{NAME}+ # same but force stopping on a new line
|
26
|
+
#{NAME}- # same but force stopping on a new line a new frame added
|
27
|
+
#{NAME} until a > b
|
28
|
+
#{NAME} over # same as 'next'
|
29
|
+
#{NAME} out # same as 'finish'
|
30
|
+
|
31
|
+
Related and similar is the 'next' (step over) and 'finish' (step out)
|
32
|
+
commands.
|
33
|
+
|
34
|
+
See also the commands:
|
35
|
+
'continue', 'next', 'nexti' and 'finish' for other ways to progress execution.
|
36
|
+
HELP
|
37
|
+
NEED_RUNNING = true
|
38
|
+
SHORT_HELP = 'Step into next method call or to next line'
|
39
|
+
|
40
|
+
Keyword_to_related_cmd = {
|
41
|
+
'out' => 'finish',
|
42
|
+
'over' => 'next',
|
43
|
+
'into' => 'step',
|
44
|
+
}
|
45
|
+
|
46
|
+
# self.allow_in_post_mortem = false
|
47
|
+
# self.need_context = true
|
48
|
+
|
49
|
+
def run(args)
|
50
|
+
condition = nil
|
51
|
+
opts = {}
|
52
|
+
if args.size == 1
|
53
|
+
step_count = 1
|
54
|
+
else
|
55
|
+
replace_cmd = Keyword_to_related_cmd[args[1]]
|
56
|
+
if replace_cmd
|
57
|
+
cmd = @proc.commands[replace_cmd]
|
58
|
+
return cmd.run([replace_cmd] + args[2..-1])
|
59
|
+
end
|
60
|
+
step_str = args[1]
|
61
|
+
opts = @proc.parse_next_step_suffix(args[0])
|
62
|
+
count_opts = {
|
63
|
+
:msg_on_error =>
|
64
|
+
"The #{NAME} command argument must eval to an integer. Got: %s" %
|
65
|
+
step_str,
|
66
|
+
:min_value => 1
|
67
|
+
}
|
68
|
+
step_count = @proc.get_an_int(step_str, count_opts)
|
69
|
+
return unless step_count
|
70
|
+
end
|
71
|
+
## @proc.state.context.step(step_count, force)
|
72
|
+
@proc.context.step(step_count, opts[:different_pos])
|
73
|
+
@proc.state.proceed
|
74
|
+
@proc.leave_cmd_loop = true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if __FILE__ == $0
|
79
|
+
require_relative '../mock'
|
80
|
+
dbgr, cmd = MockDebugger::setup
|
81
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'; require 'require_relative'
|
2
|
+
require_relative './base/cmd'
|
3
|
+
require_relative 'break'
|
4
|
+
|
5
|
+
class Trepan::Command::SetTempBreakpointCommand <
|
6
|
+
Trepan::Command::BreakCommand
|
7
|
+
ALIASES = []
|
8
|
+
CATEGORY = 'breakpoints'
|
9
|
+
NAME = File.basename(__FILE__, '.rb')
|
10
|
+
HELP = <<-HELP
|
11
|
+
Same as break, but the breakpoint is deleted when it is hit.
|
12
|
+
See also "break".
|
13
|
+
HELP
|
14
|
+
SHORT_HELP = 'Set a temporary breakpoint'
|
15
|
+
|
16
|
+
def run(args)
|
17
|
+
super args, true
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require_relative 'base/cmd'
|
4
|
+
|
5
|
+
class Trepan::Command::UnaliasCommand < Trepan::Command
|
6
|
+
|
7
|
+
unless defined?(HELP)
|
8
|
+
HELP =
|
9
|
+
"unalias COMMAND
|
10
|
+
|
11
|
+
Remove alias for COMMAND
|
12
|
+
|
13
|
+
See also 'alias'.
|
14
|
+
"
|
15
|
+
|
16
|
+
CATEGORY = 'support'
|
17
|
+
MIN_ARGS = 1
|
18
|
+
# MAX_ARGS = 1 # Need at most this many
|
19
|
+
NAME = File.basename(__FILE__, '.rb')
|
20
|
+
NEED_STACK = true
|
21
|
+
SHORT_HELP = 'Remove an alias'
|
22
|
+
end
|
23
|
+
|
24
|
+
# Run command.
|
25
|
+
def run(args)
|
26
|
+
args[1..-1].each do |arg|
|
27
|
+
if @proc.aliases.member?(arg)
|
28
|
+
@proc.aliases.delete(arg)
|
29
|
+
msg "Alias for #{arg} removed."
|
30
|
+
else
|
31
|
+
msg "No alias found for #{arg}."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if __FILE__ == $0
|
38
|
+
# Demo it.
|
39
|
+
require_relative '../mock'
|
40
|
+
dbgr, cmd = MockDebugger::setup
|
41
|
+
cmd.run %w(cmd.name exit!)
|
42
|
+
cmd.run %w(cmd.name exit!)
|
43
|
+
cmd.run %w(cmd.name foo bar c)
|
44
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative 'base/cmd'
|
5
|
+
|
6
|
+
# undisplay display-number...
|
7
|
+
class Trepan::Command::UndisplayCommand < Trepan::Command
|
8
|
+
|
9
|
+
unless defined?(HELP)
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
HELP = <<EOH
|
12
|
+
undisplay DISPLAY_NUMBER ...
|
13
|
+
Cancel some expressions to be displayed when program stops.
|
14
|
+
Arguments are the code numbers of the expressions to stop displaying.
|
15
|
+
No argument means cancel all automatic-display expressions.
|
16
|
+
"delete display" has the same effect as this command.
|
17
|
+
Do "info display" to see current list of code numbers.
|
18
|
+
EOH
|
19
|
+
|
20
|
+
ALIASES = %w(und)
|
21
|
+
CATEGORY = 'data'
|
22
|
+
NEED_STACK = false
|
23
|
+
SHORT_HELP = 'Cancel some expressions to be displayed when program stops'
|
24
|
+
end
|
25
|
+
|
26
|
+
def run(args)
|
27
|
+
|
28
|
+
if args.size == 1
|
29
|
+
@proc.displays.clear
|
30
|
+
return
|
31
|
+
end
|
32
|
+
opts = {}
|
33
|
+
args[1..-1].each do |arg|
|
34
|
+
opts[:msg_on_error] = '%s must be a display number' % arg
|
35
|
+
i = @proc.get_an_int(arg, opts)
|
36
|
+
if i
|
37
|
+
unless @proc.displays.delete_index(i)
|
38
|
+
errmsg("no display number %d." % i)
|
39
|
+
return
|
40
|
+
end
|
41
|
+
end
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if __FILE__ == $0
|
48
|
+
# demo it.
|
49
|
+
require_relative '../mock'
|
50
|
+
dbgr, cmd = MockDebugger::setup
|
51
|
+
|
52
|
+
def run_cmd(cmd, args)
|
53
|
+
cmd.run(args)
|
54
|
+
puts '==' * 10
|
55
|
+
end
|
56
|
+
|
57
|
+
run_cmd(cmd, %W(#{cmd.name} z))
|
58
|
+
run_cmd(cmd, %W(#{cmd.name} 1 10))
|
59
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require_relative 'base/cmd'
|
4
|
+
|
5
|
+
# up command. Like 'down' butthe direction (set by DIRECTION) is different.
|
6
|
+
#
|
7
|
+
# NOTE: The down command subclasses this, so beware when changing!
|
8
|
+
class Trepan::Command::UpCommand < Trepan::Command
|
9
|
+
|
10
|
+
# Silence already initialized constant .. warnings
|
11
|
+
old_verbose = $VERBOSE
|
12
|
+
$VERBOSE = nil
|
13
|
+
NAME = File.basename(__FILE__, '.rb')
|
14
|
+
HELP = <<-HELP
|
15
|
+
#{NAME} [count]
|
16
|
+
|
17
|
+
Move the current frame up in the stack trace (to an older frame). 0 is
|
18
|
+
the most recent frame. If no count is given, move up 1.
|
19
|
+
|
20
|
+
See also 'down' and 'frame'.
|
21
|
+
HELP
|
22
|
+
|
23
|
+
ALIASES = %w(u)
|
24
|
+
CATEGORY = 'stack'
|
25
|
+
MAX_ARGS = 1 # Need at most this many
|
26
|
+
NEED_STACK = true
|
27
|
+
SHORT_HELP = 'Move frame in the direction of the caller of the last-selected frame'
|
28
|
+
$VERBOSE = old_verbose
|
29
|
+
|
30
|
+
def complete(prefix)
|
31
|
+
@proc.frame_complete(prefix, @direction)
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(proc)
|
35
|
+
super
|
36
|
+
@direction = +1 # -1 for down.
|
37
|
+
end
|
38
|
+
|
39
|
+
# Run 'up' command.
|
40
|
+
def run(args)
|
41
|
+
|
42
|
+
# FIXME: move into @proc and test based on NEED_STACK.
|
43
|
+
if @proc.stack_size == 0
|
44
|
+
errmsg('No frames recorded.')
|
45
|
+
return false
|
46
|
+
end
|
47
|
+
|
48
|
+
if args.size == 1
|
49
|
+
# Form is: "up" which means "up 1"
|
50
|
+
count = 1
|
51
|
+
else
|
52
|
+
count_str = args[1]
|
53
|
+
name_or_id = args[1]
|
54
|
+
low, high = @proc.frame_low_high(@direction)
|
55
|
+
opts = {
|
56
|
+
:msg_on_error =>
|
57
|
+
"The '#{NAME}' command argument must eval to an integer. Got: %s" % count_str,
|
58
|
+
:min_value => low, :max_value => high
|
59
|
+
}
|
60
|
+
count = @proc.get_an_int(count_str, opts)
|
61
|
+
return false unless count
|
62
|
+
end
|
63
|
+
@proc.adjust_frame(@direction * count, false)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if __FILE__ == $0
|
68
|
+
# Demo it.
|
69
|
+
require_relative '../mock'
|
70
|
+
dbgr, cmd = MockDebugger::setup
|
71
|
+
cmd.run [cmd.name]
|
72
|
+
end
|