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,84 @@
|
|
1
|
+
module Trepan
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'methodsig'
|
5
|
+
have_methodsig = true
|
6
|
+
rescue LoadError
|
7
|
+
have_methodsig = false
|
8
|
+
end
|
9
|
+
|
10
|
+
# Implements the debugger 'method sig' command.
|
11
|
+
class MethodSigCommand < OldCommand
|
12
|
+
def regexp
|
13
|
+
/^\s*m(?:ethod)?\s+sig(?:nature)?\s+(\S+)\s*$/
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute
|
17
|
+
obj = debug_eval('method(:%s)' % @match[1])
|
18
|
+
if obj.is_a?(Method)
|
19
|
+
begin
|
20
|
+
print "%s\n", obj.signature.to_s
|
21
|
+
rescue
|
22
|
+
errmsg("Can't get signature for '#{@match[1]}'\n")
|
23
|
+
end
|
24
|
+
else
|
25
|
+
errmsg("Can't make method out of '#{@match[1]}'\n")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class << self
|
30
|
+
def help_command
|
31
|
+
'method'
|
32
|
+
end
|
33
|
+
|
34
|
+
def help(cmd)
|
35
|
+
%{
|
36
|
+
m[ethod] sig[nature] <obj>\tshow the signature of a method
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end if have_methodsig
|
41
|
+
|
42
|
+
# Implements the debugger 'method' command.
|
43
|
+
class MethodCommand < OldCommand
|
44
|
+
def regexp
|
45
|
+
/^\s*m(?:ethod)?\s+((iv)|(i(:?nstance\s+)?)\s+)?/
|
46
|
+
end
|
47
|
+
|
48
|
+
def execute
|
49
|
+
if @match[1] == "iv"
|
50
|
+
obj = debug_eval(@match.post_match)
|
51
|
+
obj.instance_variables.sort.each do |v|
|
52
|
+
print "%s = %s\n", v, obj.instance_variable_get(v).inspect
|
53
|
+
end
|
54
|
+
elsif @match[1]
|
55
|
+
obj = debug_eval(@match.post_match)
|
56
|
+
print "%s\n", columnize(obj.methods.sort(),
|
57
|
+
self.class.settings[:width])
|
58
|
+
else
|
59
|
+
obj = debug_eval(@match.post_match)
|
60
|
+
unless obj.kind_of? Module
|
61
|
+
print "Should be Class/Module: %s\n", @match.post_match
|
62
|
+
else
|
63
|
+
print "%s\n", columnize(obj.instance_methods(false).sort(),
|
64
|
+
self.class.settings[:width])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
def help_command
|
71
|
+
'method'
|
72
|
+
end
|
73
|
+
|
74
|
+
def help(cmd)
|
75
|
+
%{
|
76
|
+
m[ethod] i[nstance] <obj>\tshow methods of object
|
77
|
+
m[ethod] iv <obj>\t\tshow instance variables of object
|
78
|
+
m[ethod] <class|module>\t\tshow instance methods of class or module
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Trepan
|
2
|
+
# Implements debugger "reload" command.
|
3
|
+
class ReloadCommand < OldCommand
|
4
|
+
self.allow_in_control = true
|
5
|
+
|
6
|
+
register_setting_get(:reload_source_on_change) do
|
7
|
+
Debugger.reload_source_on_change
|
8
|
+
end
|
9
|
+
register_setting_set(:reload_source_on_change) do |value|
|
10
|
+
Debugger.reload_source_on_change = value
|
11
|
+
end
|
12
|
+
|
13
|
+
def regexp
|
14
|
+
/^\s*r(?:eload)?$/
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
Debugger.source_reload
|
19
|
+
print "Source code is reloaded. Automatic reloading is #{source_reloading}.\n"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def source_reloading
|
25
|
+
Debugger.reload_source_on_change ? 'on' : 'off'
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def help_command
|
30
|
+
'reload'
|
31
|
+
end
|
32
|
+
|
33
|
+
def help(cmd)
|
34
|
+
%{
|
35
|
+
r[eload]\tforces source code reloading
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Trepan
|
2
|
+
module SaveFunctions # :nodoc:
|
3
|
+
|
4
|
+
# Create a temporary file to write in if file is nil
|
5
|
+
def open_save
|
6
|
+
require "tempfile"
|
7
|
+
file = Tempfile.new("rdebug-save")
|
8
|
+
# We want close to not unlink, so redefine.
|
9
|
+
def file.close
|
10
|
+
@tmpfile.close if @tmpfile
|
11
|
+
end
|
12
|
+
return file
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class SaveCommand < OldCommand # :nodoc:
|
17
|
+
self.allow_in_control = true
|
18
|
+
|
19
|
+
def save_breakpoints(file)
|
20
|
+
Debugger.breakpoints.each do |b|
|
21
|
+
file.puts "break #{b.source}:#{b.pos}#{" if #{b.expr}" if b.expr}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def save_catchpoints(file)
|
26
|
+
Debugger.catchpoints.keys.each do |c|
|
27
|
+
file.puts "catch #{c}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def save_displays(file)
|
32
|
+
for d in @state.display
|
33
|
+
if d[0]
|
34
|
+
file.puts "display #{d[1]}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def save_settings(file)
|
40
|
+
# FIXME put routine in set
|
41
|
+
%w(autoeval basename debuggertesting).each do |setting|
|
42
|
+
on_off = show_onoff(Command.settings[setting.to_sym])
|
43
|
+
file.puts "set #{setting} #{on_off}"
|
44
|
+
end
|
45
|
+
%w(autolist autoirb).each do |setting|
|
46
|
+
on_off = show_onoff(Command.settings[setting.to_sym] > 0)
|
47
|
+
file.puts "set #{setting} #{on_off}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def regexp
|
52
|
+
/^\s* sa(?:ve)?
|
53
|
+
(?:\s+(.+))?
|
54
|
+
\s*$/ix
|
55
|
+
end
|
56
|
+
|
57
|
+
def execute
|
58
|
+
if not @match[1] or @match[1].strip.empty?
|
59
|
+
file = open_save()
|
60
|
+
else
|
61
|
+
file = open(@match[1], 'w')
|
62
|
+
end
|
63
|
+
save_breakpoints(file)
|
64
|
+
save_catchpoints(file)
|
65
|
+
# save_displays(file)
|
66
|
+
save_settings(file)
|
67
|
+
print "Saved to '#{file.path}'\n"
|
68
|
+
if @state and @state.interface
|
69
|
+
@state.interface.restart_file = file.path
|
70
|
+
end
|
71
|
+
file.close
|
72
|
+
end
|
73
|
+
|
74
|
+
class << self
|
75
|
+
def help_command
|
76
|
+
'save'
|
77
|
+
end
|
78
|
+
|
79
|
+
def help(cmd)
|
80
|
+
%{
|
81
|
+
save [FILE]
|
82
|
+
Saves current debugger state to FILE as a script file.
|
83
|
+
This includes breakpoints, catchpoints, display expressions and some settings.
|
84
|
+
If no filename is given, we will fabricate one.
|
85
|
+
|
86
|
+
Use the 'source' command in another debug session to restore them.}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
module Trepan
|
2
|
+
# Implements debugger "set" command.
|
3
|
+
class SetCommand < OldCommand
|
4
|
+
SubcmdStruct2=Struct.new(:name, :min, :is_bool, :short_help,
|
5
|
+
:long_help) unless defined?(SubcmdStruct2)
|
6
|
+
Subcommands =
|
7
|
+
[
|
8
|
+
['annotate', 2, false,
|
9
|
+
"Set annotation level",
|
10
|
+
"0 == normal;
|
11
|
+
2 == output annotated suitably for use by programs that control
|
12
|
+
ruby-debug."],
|
13
|
+
['args', 2, false,
|
14
|
+
"Set argument list to give program being debugged when it is started",
|
15
|
+
"Follow this command with any number of args, to be passed to the program."],
|
16
|
+
['autoeval', 4, true,
|
17
|
+
"Evaluate every unrecognized command"],
|
18
|
+
['autolist', 4, true,
|
19
|
+
"Execute 'list' command on every breakpoint"],
|
20
|
+
['autoirb', 4, true,
|
21
|
+
"Invoke IRB on every stop"],
|
22
|
+
['autoreload', 4, true,
|
23
|
+
"Reload source code when changed"],
|
24
|
+
['basename', 1, true,
|
25
|
+
"Report file basename only showing file names"],
|
26
|
+
['callstyle', 2, false,
|
27
|
+
"Set how you want call parameters displayed"],
|
28
|
+
['debuggertesting', 8, false,
|
29
|
+
"Used when testing the debugger"],
|
30
|
+
['forcestep', 2, true,
|
31
|
+
"Make sure 'next/step' commands always move to a new line"],
|
32
|
+
['fullpath', 2, true,
|
33
|
+
"Display full file names in frames"],
|
34
|
+
['history', 2, false,
|
35
|
+
"Generic command for setting command history parameters",
|
36
|
+
"set history filename -- Set the filename in which to record the command history
|
37
|
+
set history save -- Set saving of the history record on exit
|
38
|
+
set history size -- Set the size of the command history"],
|
39
|
+
['keep-frame-bindings', 1, true,
|
40
|
+
"Save frame binding on each call"],
|
41
|
+
['linetrace+', 10, true,
|
42
|
+
"Set line execution tracing to show different lines"],
|
43
|
+
['linetrace', 3, true,
|
44
|
+
"Set line execution tracing"],
|
45
|
+
['listsize', 3, false,
|
46
|
+
"Set number of source lines to list by default"],
|
47
|
+
# ['post-mortem', 3, true,
|
48
|
+
# "Set whether we do post-mortem handling on an uncaught exception"],
|
49
|
+
['trace', 1, true,
|
50
|
+
"Display stack trace when 'eval' raises exception"],
|
51
|
+
['width', 1, false,
|
52
|
+
"Number of characters the debugger thinks are in a line"],
|
53
|
+
].map do |name, min, is_bool, short_help, long_help|
|
54
|
+
SubcmdStruct2.new(name, min, is_bool, short_help, long_help)
|
55
|
+
end unless defined?(Subcommands)
|
56
|
+
|
57
|
+
self.allow_in_control = true
|
58
|
+
|
59
|
+
def regexp
|
60
|
+
/^set (?: \s+ (.*) )?$/ix
|
61
|
+
end
|
62
|
+
|
63
|
+
def execute
|
64
|
+
if not @match[1]
|
65
|
+
print "\"set\" must be followed by the name of an set command:\n"
|
66
|
+
print "List of set subcommands:\n\n"
|
67
|
+
for subcmd in Subcommands do
|
68
|
+
print "set #{subcmd.name} -- #{subcmd.short_help}\n"
|
69
|
+
end
|
70
|
+
else
|
71
|
+
args = @match[1].split(/[ \t]+/)
|
72
|
+
subcmd = args.shift
|
73
|
+
subcmd.downcase!
|
74
|
+
if subcmd =~ /^no/i
|
75
|
+
set_on = false
|
76
|
+
subcmd = subcmd[2..-1]
|
77
|
+
else
|
78
|
+
set_on = true
|
79
|
+
end
|
80
|
+
for try_subcmd in Subcommands do
|
81
|
+
if (subcmd.size >= try_subcmd.min) and
|
82
|
+
(try_subcmd.name[0..subcmd.size-1] == subcmd)
|
83
|
+
begin
|
84
|
+
if try_subcmd.is_bool
|
85
|
+
if args.size > 0
|
86
|
+
set_on = get_onoff(args[0])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
case try_subcmd.name
|
90
|
+
when /^annotate$/
|
91
|
+
level = get_int(args[0], "Set annotate", 0, 3, 0)
|
92
|
+
if level
|
93
|
+
Debugger.annotate = level
|
94
|
+
else
|
95
|
+
return
|
96
|
+
end
|
97
|
+
if defined?(Debugger::RDEBUG_SCRIPT)
|
98
|
+
# rdebug was called initially. 1st arg is script name.
|
99
|
+
Command.settings[:argv][1..-1] = args
|
100
|
+
else
|
101
|
+
# rdebug wasn't called initially. 1st arg is not script name.
|
102
|
+
Command.settings[:argv] = args
|
103
|
+
end
|
104
|
+
when /^args$/
|
105
|
+
Command.settings[:argv][1..-1] = args
|
106
|
+
when /^autolist$/
|
107
|
+
Command.settings[:autolist] = (set_on ? 1 : 0)
|
108
|
+
when /^autoeval$/
|
109
|
+
Command.settings[:autoeval] = set_on
|
110
|
+
when /^basename$/
|
111
|
+
Command.settings[:basename] = set_on
|
112
|
+
when /^callstyle$/
|
113
|
+
if args[0]
|
114
|
+
arg = args[0].downcase.to_sym
|
115
|
+
case arg
|
116
|
+
when :short, :last, :tracked
|
117
|
+
Command.settings[:callstyle] = arg
|
118
|
+
Debugger.track_frame_args = arg == :tracked ? true : false
|
119
|
+
print "%s\n" % show_setting(try_subcmd.name)
|
120
|
+
return
|
121
|
+
end
|
122
|
+
end
|
123
|
+
print "Invalid call style #{arg}. Should be one of: " +
|
124
|
+
"'short', 'last', or 'tracked'.\n"
|
125
|
+
when /^trace$/
|
126
|
+
Command.settings[:stack_trace_on_error] = set_on
|
127
|
+
when /^fullpath$/
|
128
|
+
Command.settings[:full_path] = set_on
|
129
|
+
when /^autoreload$/
|
130
|
+
Command.settings[:reload_source_on_change] = set_on
|
131
|
+
when /^autoirb$/
|
132
|
+
Command.settings[:autoirb] = (set_on ? 1 : 0)
|
133
|
+
when /^debuggertesting$/
|
134
|
+
Command.settings[:debuggertesting] = set_on
|
135
|
+
if set_on
|
136
|
+
Command.settings[:basename] = true
|
137
|
+
end
|
138
|
+
when /^forcestep$/
|
139
|
+
self.class.settings[:force_stepping] = set_on
|
140
|
+
when /^history$/
|
141
|
+
if 2 == args.size
|
142
|
+
interface = @state.interface
|
143
|
+
case args[0]
|
144
|
+
when /^save$/
|
145
|
+
interface.history_save = get_onoff(args[1])
|
146
|
+
when /^size$/
|
147
|
+
interface.history_length = get_int(args[1],
|
148
|
+
"Set history size")
|
149
|
+
else
|
150
|
+
print "Invalid history parameter #{args[0]}. Should be 'save' or 'size'.\n"
|
151
|
+
end
|
152
|
+
else
|
153
|
+
print "Need two parameters for 'set history'; got #{args.size}.\n"
|
154
|
+
return
|
155
|
+
end
|
156
|
+
when /^keep-frame-bindings$/
|
157
|
+
Debugger.keep_frame_binding = set_on
|
158
|
+
when /^linetrace\+$/
|
159
|
+
self.class.settings[:tracing_plus] = set_on
|
160
|
+
when /^linetrace$/
|
161
|
+
Debugger.tracing = set_on
|
162
|
+
when /^listsize$/
|
163
|
+
listsize = get_int(args[0], "Set listsize", 1, nil, 10)
|
164
|
+
if listsize
|
165
|
+
self.class.settings[:listsize] = listsize
|
166
|
+
else
|
167
|
+
return
|
168
|
+
end
|
169
|
+
# when /^post-mortem$/
|
170
|
+
# unless Debugger.post_mortem? == set_on
|
171
|
+
# if set_on
|
172
|
+
# Debugger.post_mortem
|
173
|
+
# else
|
174
|
+
# errmsg "Can't turn off post-mortem once it is on.\n"
|
175
|
+
# return
|
176
|
+
# end
|
177
|
+
# end
|
178
|
+
when /^width$/
|
179
|
+
width = get_int(args[0], "Set width", 10, nil, 80)
|
180
|
+
if width
|
181
|
+
self.class.settings[:width] = width
|
182
|
+
ENV['COLUMNS'] = width.to_s
|
183
|
+
else
|
184
|
+
return
|
185
|
+
end
|
186
|
+
else
|
187
|
+
print "Unknown setting #{@match[1]}.\n"
|
188
|
+
return
|
189
|
+
end
|
190
|
+
print "%s\n" % show_setting(try_subcmd.name)
|
191
|
+
return
|
192
|
+
rescue RuntimeError
|
193
|
+
return
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
print "Unknown set command #{subcmd}\n"
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
class << self
|
202
|
+
def help_command
|
203
|
+
"set"
|
204
|
+
end
|
205
|
+
|
206
|
+
def help(args)
|
207
|
+
if args[1]
|
208
|
+
s = args[1]
|
209
|
+
subcmd = Subcommands.find do |try_subcmd|
|
210
|
+
(s.size >= try_subcmd.min) and
|
211
|
+
(try_subcmd.name[0..s.size-1] == s)
|
212
|
+
end
|
213
|
+
if subcmd
|
214
|
+
str = subcmd.short_help + '.'
|
215
|
+
str += "\n" + subcmd.long_help if subcmd.long_help
|
216
|
+
return str
|
217
|
+
else
|
218
|
+
return "Invalid 'set' subcommand '#{args[1]}'."
|
219
|
+
end
|
220
|
+
end
|
221
|
+
s = %{
|
222
|
+
Modifies parts of the ruby-debug environment. Boolean values take
|
223
|
+
on, off, 1 or 0.
|
224
|
+
You can see these environment settings with the \"show\" command.
|
225
|
+
|
226
|
+
--
|
227
|
+
List of set subcommands:
|
228
|
+
--
|
229
|
+
}
|
230
|
+
for subcmd in Subcommands do
|
231
|
+
s += "set #{subcmd.name} -- #{subcmd.short_help}\n"
|
232
|
+
end
|
233
|
+
return s
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|