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,139 @@
|
|
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
2
|
+
require 'rubygems'; require 'require_relative'
|
|
3
|
+
require_relative '../../io/input' # For GNU_readline?
|
|
4
|
+
Trepan.suppress_warnings { require 'irb' }
|
|
5
|
+
require_relative 'base/cmd'
|
|
6
|
+
require_relative '../../app/irb'
|
|
7
|
+
|
|
8
|
+
class Trepan::Command::IRBCommand < Trepan::Command
|
|
9
|
+
|
|
10
|
+
unless defined?(HELP)
|
|
11
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
12
|
+
HELP = <<-HELP
|
|
13
|
+
#{NAME} [-d]
|
|
14
|
+
|
|
15
|
+
starts an Interactive Ruby (IRB) session.
|
|
16
|
+
|
|
17
|
+
If -d is added you can get access to debugger frame the global variables
|
|
18
|
+
$trepan_frame and $trepan_cmdproc.
|
|
19
|
+
|
|
20
|
+
#{NAME} is extended with methods 'cont', 'ne', and, 'q', 'step' which
|
|
21
|
+
run the corresponding debugger commands 'continue', 'next', 'exit' and 'step'.
|
|
22
|
+
|
|
23
|
+
To issue a debugger command, inside #{NAME} nested inside a debugger use
|
|
24
|
+
'dbgr'. For example:
|
|
25
|
+
|
|
26
|
+
dbgr %w(info program)
|
|
27
|
+
dbgr('info', 'program') # Same as above
|
|
28
|
+
dbgr 'info program' # Single quoted string also works
|
|
29
|
+
|
|
30
|
+
But arguments have to be quoted because #{NAME} will evaluate them:
|
|
31
|
+
|
|
32
|
+
dbgr info program # wrong!
|
|
33
|
+
dbgr info, program # wrong!
|
|
34
|
+
dbgr(info, program) # What I say 3 times is wrong!
|
|
35
|
+
|
|
36
|
+
Here then is a loop to query VM stack values:
|
|
37
|
+
(-1..1).each {|i| dbgr(\"info reg sp \#{i}\")}
|
|
38
|
+
HELP
|
|
39
|
+
|
|
40
|
+
ALIASES = %w(irb)
|
|
41
|
+
CATEGORY = 'support'
|
|
42
|
+
MAX_ARGS = 1 # Need at most this many
|
|
43
|
+
SHORT_HELP = "Run #{NAME} as a command subshell"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# This method runs the command
|
|
47
|
+
def run(args)
|
|
48
|
+
add_debugging =
|
|
49
|
+
if args.size > 1
|
|
50
|
+
'-d' == args[1]
|
|
51
|
+
else
|
|
52
|
+
false
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# unless @state.interface.kind_of?(LocalInterface)
|
|
56
|
+
# print "Command is available only in local mode.\n"
|
|
57
|
+
# throw :debug_error
|
|
58
|
+
# end
|
|
59
|
+
|
|
60
|
+
save_trap = trap('SIGINT') do
|
|
61
|
+
throw :IRB_EXIT, :cont if $trepan_in_irb
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
$trepan = @proc.dbgr
|
|
65
|
+
if add_debugging
|
|
66
|
+
$trepan_cmdproc = @proc
|
|
67
|
+
$trepan_frame = @proc.frame
|
|
68
|
+
end
|
|
69
|
+
$trepan_in_irb = true
|
|
70
|
+
$trepan_irb_statements = nil
|
|
71
|
+
$trepan_command = nil
|
|
72
|
+
|
|
73
|
+
conf = {:BACK_TRACE_LIMIT => settings[:maxstack],
|
|
74
|
+
:RC => true}
|
|
75
|
+
|
|
76
|
+
# ?? Should we set GNU readline to what we have,
|
|
77
|
+
# or let IRB make its own determination?
|
|
78
|
+
|
|
79
|
+
# Save the Readline history and set the Readline completion function
|
|
80
|
+
# to be IRB's function
|
|
81
|
+
if Trepan::GNU_readline?
|
|
82
|
+
@proc.intf.save_history if @proc.intf.respond_to?(:save_history)
|
|
83
|
+
require 'irb/completion'
|
|
84
|
+
Readline.completion_proc = IRB::InputCompletor::CompletionProc
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# And just when you thought, we'd never get around to
|
|
88
|
+
# actually running irb...
|
|
89
|
+
cont = IRB.start_session(@proc.frame.binding, @proc, conf)
|
|
90
|
+
trap('SIGINT', save_trap) # Restore our old interrupt function.
|
|
91
|
+
|
|
92
|
+
# Restore the debuggers' Readline history and the Readline completion
|
|
93
|
+
# function
|
|
94
|
+
if Trepan::GNU_readline? && $trepan_completion_proc
|
|
95
|
+
@proc.intf.read_history if @proc.intf.respond_to?(:read_history)
|
|
96
|
+
Readline.completion_proc = $trepan_completion_proc
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Respect any backtrace limit set in irb.
|
|
100
|
+
back_trace_limit = IRB.CurrentContext.back_trace_limit
|
|
101
|
+
if settings[:maxstack] != back_trace_limit
|
|
102
|
+
msg("\nSetting debugger's BACK_TRACE_LIMIT (%d) to match irb's last setting (%d)" %
|
|
103
|
+
[settings[:maxstack], back_trace_limit])
|
|
104
|
+
settings[:maxstack]= IRB.CurrentContext.back_trace_limit
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
case cont
|
|
108
|
+
when :continue
|
|
109
|
+
@proc.continue
|
|
110
|
+
when :finish
|
|
111
|
+
@proc.finish
|
|
112
|
+
when :next
|
|
113
|
+
@proc.next # (1, {})
|
|
114
|
+
when :quit
|
|
115
|
+
@proc.quit
|
|
116
|
+
when :step
|
|
117
|
+
@proc.step # (1, {})
|
|
118
|
+
else
|
|
119
|
+
@proc.print_location
|
|
120
|
+
end
|
|
121
|
+
ensure
|
|
122
|
+
$trepan_in_irb = false
|
|
123
|
+
# restore old trap if any
|
|
124
|
+
trap('SIGINT', save_trap) if save_trap
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if __FILE__ == $0
|
|
129
|
+
require_relative '../mock'
|
|
130
|
+
# dbgr, cmd = MockDebugger::setup
|
|
131
|
+
dbgr, cmd = MockDebugger::setup(nil, false)
|
|
132
|
+
cmd.proc.frame.instance_variable_set('@binding', binding)
|
|
133
|
+
# Get an IRB session -- the hard way :-)
|
|
134
|
+
if ARGV.size > 0
|
|
135
|
+
cmd.run([cmd.name])
|
|
136
|
+
else
|
|
137
|
+
puts "Pass an arg to enter irb. e.g: #{$0} irb"
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 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
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
9
|
+
HELP = <<-HELP
|
|
10
|
+
Generic command for showing things about the debugger. You can
|
|
11
|
+
give unique prefix of the name of a subcommand to get information
|
|
12
|
+
about just that subcommand.
|
|
13
|
+
|
|
14
|
+
Type "#{NAME}" for a list of "show" subcommands and what they do.
|
|
15
|
+
Type "help #{NAME} *" for just a list of "show" subcommands.
|
|
16
|
+
HELP
|
|
17
|
+
|
|
18
|
+
CATEGORY = 'status'
|
|
19
|
+
NEED_STACK = false
|
|
20
|
+
SHORT_HELP = 'Show parts of the debugger environment'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def run(args)
|
|
24
|
+
if args.size > 1
|
|
25
|
+
first = args[1].downcase
|
|
26
|
+
alen = 'auto'.size
|
|
27
|
+
args[1..1] = ['auto', first[alen..-1]] if
|
|
28
|
+
first.start_with?('auto') && first.size > alen
|
|
29
|
+
end
|
|
30
|
+
super
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
if __FILE__ == $0
|
|
36
|
+
require_relative '../mock'
|
|
37
|
+
dbgr, cmd = MockDebugger::setup
|
|
38
|
+
cmd.run([cmd.name])
|
|
39
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*~
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'; require 'require_relative'
|
|
4
|
+
require_relative '../base/subcmd'
|
|
5
|
+
|
|
6
|
+
class Trepan::Subcommand::ShowAbbrev < Trepan::ShowBoolSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = "Show whether we allow abbreviate debugger command names"
|
|
10
|
+
MIN_ABBREV = 'ab'.size
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if __FILE__ == $0
|
|
16
|
+
# Demo it.
|
|
17
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
|
18
|
+
require_relative '../../mock'
|
|
19
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowAbbrev)
|
|
20
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 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
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
8
|
+
unless defined?(HELP)
|
|
9
|
+
HELP = <<-EOH
|
|
10
|
+
#{CMD} [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
|
+
SHORT_HELP = "Show defined aliases"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def complete(prefix)
|
|
20
|
+
Trepan::Complete.complete_token(@proc.aliases.keys, prefix)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def run(args)
|
|
24
|
+
if args.size > 2
|
|
25
|
+
args[2..-1].each do |alias_name|
|
|
26
|
+
if @proc.aliases.member?(alias_name)
|
|
27
|
+
msg "%s: %s" % [alias_name, @proc.aliases[alias_name]]
|
|
28
|
+
else
|
|
29
|
+
msg "%s is not a defined alias" % alias_name
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
elsif @proc.aliases.empty?
|
|
33
|
+
msg "No aliases defined."
|
|
34
|
+
else
|
|
35
|
+
section "List of aliases names currently defined:"
|
|
36
|
+
msg columnize_commands(@proc.aliases.keys.sort)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if __FILE__ == $0
|
|
42
|
+
# Demo it.
|
|
43
|
+
require_relative '../../mock'
|
|
44
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowAlias)
|
|
45
|
+
cmd.run(cmd.prefix + %w(u foo))
|
|
46
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 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
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = 'Show argument list to give program when it is restarted'
|
|
10
|
+
MIN_ABBREV = 'ar'.size
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def run(args)
|
|
14
|
+
if Trepan::OldCommand.settings[:argv] and Trepan::OldCommand.settings[:argv].size > 0
|
|
15
|
+
if defined?(Trepan::PROG_SCRIPT)
|
|
16
|
+
# rdebug was called initially. 1st arg is script name.
|
|
17
|
+
args = Trepan::OldCommand.settings[:argv][1..-1].join(' ')
|
|
18
|
+
else
|
|
19
|
+
# rdebug wasn't called initially. 1st arg is not script name.
|
|
20
|
+
args = Trepan::OldCommand.settings[:argv].join(' ')
|
|
21
|
+
end
|
|
22
|
+
else
|
|
23
|
+
args = ''
|
|
24
|
+
end
|
|
25
|
+
msg "Argument list to give program being debugged when it is started is \"#{args}\"."
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
if __FILE__ == $0
|
|
30
|
+
# Demo it.
|
|
31
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
|
32
|
+
require_relative '../../mock'
|
|
33
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowBasename)
|
|
34
|
+
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
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
10
|
+
HELP = 'Show settings which some sort of "automatic" default behavior'
|
|
11
|
+
MIN_ABBREV = 'au'.size
|
|
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,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
|
+
|
|
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
|
+
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::ShowAuto,
|
|
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,20 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 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
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = "Show only file basename in showing file names"
|
|
10
|
+
MIN_ABBREV = 'ba'.size
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if __FILE__ == $0
|
|
16
|
+
# Demo it.
|
|
17
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
|
18
|
+
require_relative '../../mock'
|
|
19
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowBasename)
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
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::ShowCallstyle < Trepan::Subcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = "Show confirm potentially dangerous operations setting"
|
|
10
|
+
MIN_ABBREV = 'call'.size
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def run(args)
|
|
14
|
+
msg("Frame call-display style is #{settings[:callstyle]}.")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if __FILE__ == $0
|
|
19
|
+
# Demo it.
|
|
20
|
+
require_relative '../../mock'
|
|
21
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowCallstyle, false)
|
|
22
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'; require 'require_relative'
|
|
4
|
+
require_relative '../base/subcmd'
|
|
5
|
+
|
|
6
|
+
class Trepan::Subcommand::ShowConfirm < Trepan::ShowBoolSubcommand
|
|
7
|
+
unless defined?(HELP)
|
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
|
+
HELP = "Show confirm potentially dangerous operations setting"
|
|
10
|
+
MIN_ABBREV = 'co'.size
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
if __FILE__ == $0
|
|
15
|
+
# Demo it.
|
|
16
|
+
require_relative '../../mock'
|
|
17
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowConfirm, false)
|
|
18
|
+
end
|