rbx-trepanning 0.0.5-universal-rubinius-1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2002 -0
- data/LICENSE +25 -0
- data/NEWS +31 -0
- data/README.textile +34 -0
- data/Rakefile +165 -0
- data/THANKS +14 -0
- data/app/breakpoint.rb +219 -0
- data/app/breakpoint.rbc +3551 -0
- data/app/brkptmgr.rb +140 -0
- data/app/brkptmgr.rbc +2903 -0
- data/app/client.rb +61 -0
- data/app/client.rbc +1225 -0
- data/app/complete.rb +52 -0
- data/app/complete.rbc +1288 -0
- data/app/default.rb +71 -0
- data/app/default.rbc +1132 -0
- data/app/display.rb +148 -0
- data/app/display.rbc +2578 -0
- data/app/frame.rb +98 -0
- data/app/frame.rbc +1808 -0
- data/app/irb.rb +111 -0
- data/app/irb.rbc +2094 -0
- data/app/iseq.rb +117 -0
- data/app/iseq.rbc +2192 -0
- data/app/llvm.rbc +2478 -0
- data/app/method.rb +173 -0
- data/app/method.rbc +2492 -0
- data/app/method_name.rbc +2467 -0
- data/app/mock.rb +13 -0
- data/app/mock.rbc +398 -0
- data/app/options.rb +137 -0
- data/app/options.rbc +2898 -0
- data/app/rbx-llvm.rb +165 -0
- data/app/rbx-llvm.rbc +2478 -0
- data/app/run.rb +86 -0
- data/app/run.rbc +1244 -0
- data/app/util.rb +49 -0
- data/app/util.rbc +1146 -0
- data/app/validate.rb +30 -0
- data/app/validate.rbc +676 -0
- data/bin/trepan.compiled.rbc +1043 -0
- data/bin/trepanx +69 -0
- data/bin/trepanx.compiled.rbc +1049 -0
- data/data/irbrc +41 -0
- data/data/irbrc.compiled.rbc +640 -0
- data/interface/base_intf.rb +105 -0
- data/interface/base_intf.rbc +1899 -0
- data/interface/client.rb +80 -0
- data/interface/client.rbc +1072 -0
- data/interface/comcodes.rb +20 -0
- data/interface/comcodes.rbc +385 -0
- data/interface/script.rb +104 -0
- data/interface/script.rbc +1642 -0
- data/interface/server.rb +143 -0
- data/interface/server.rbc +2213 -0
- data/interface/user.rb +150 -0
- data/interface/user.rbc +2867 -0
- data/io/base_io.rb +148 -0
- data/io/base_io.rbc +2111 -0
- data/io/input.rb +135 -0
- data/io/input.rbc +2528 -0
- data/io/null_output.rb +42 -0
- data/io/null_output.rbc +730 -0
- data/io/string_array.rb +156 -0
- data/io/string_array.rbc +2466 -0
- data/io/tcpclient.rb +129 -0
- data/io/tcpclient.rbc +2419 -0
- data/io/tcpfns.rb +33 -0
- data/io/tcpfns.rbc +694 -0
- data/io/tcpserver.rb +141 -0
- data/io/tcpserver.rbc +2638 -0
- data/lib/trepanning.rb +474 -0
- data/lib/trepanning.rbc +7705 -0
- data/lib/trepanning2.rb +441 -0
- data/processor/breakpoint.rb +164 -0
- data/processor/command/alias.rb +55 -0
- data/processor/command/backtrace.rb +76 -0
- data/processor/command/base/cmd.rb +173 -0
- data/processor/command/base/subcmd.rb +229 -0
- data/processor/command/base/submgr.rb +182 -0
- data/processor/command/base/subsubcmd.rb +103 -0
- data/processor/command/base/subsubmgr.rb +195 -0
- data/processor/command/break.rb +100 -0
- data/processor/command/complete.rb +37 -0
- data/processor/command/continue.rb +91 -0
- data/processor/command/delete.rb +30 -0
- data/processor/command/directory.rb +51 -0
- data/processor/command/disassemble.rb +145 -0
- data/processor/command/display.rb +82 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/eval.rb +51 -0
- data/processor/command/exit.rb +62 -0
- data/processor/command/finish.rb +80 -0
- data/processor/command/frame.rb +89 -0
- data/processor/command/help.rb +251 -0
- data/processor/command/info.rb +28 -0
- data/processor/command/info_subcmd/breakpoints.rb +73 -0
- data/processor/command/info_subcmd/files.rb +209 -0
- data/processor/command/info_subcmd/line.rb +86 -0
- data/processor/command/info_subcmd/method.rb +71 -0
- data/processor/command/info_subcmd/program.rb +49 -0
- data/processor/command/info_subcmd/ruby.rb +62 -0
- data/processor/command/info_subcmd/variables.rb +48 -0
- data/processor/command/irb.rb +128 -0
- data/processor/command/kill.rb +70 -0
- data/processor/command/list.rb +300 -0
- data/processor/command/macro.rb +76 -0
- data/processor/command/next.rb +66 -0
- data/processor/command/nexti.rb +59 -0
- data/processor/command/pr.rb +38 -0
- data/processor/command/ps.rb +40 -0
- data/processor/command/restart.rb +60 -0
- data/processor/command/server.rb +72 -0
- data/processor/command/set.rb +47 -0
- data/processor/command/set_subcmd/auto.rb +27 -0
- data/processor/command/set_subcmd/auto_subcmd/dis.rb +33 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +54 -0
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +34 -0
- data/processor/command/set_subcmd/auto_subcmd/list.rb +34 -0
- data/processor/command/set_subcmd/basename.rb +25 -0
- data/processor/command/set_subcmd/confirm.rb +24 -0
- data/processor/command/set_subcmd/debug.rb +26 -0
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +36 -0
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +23 -0
- data/processor/command/set_subcmd/debug_subcmd/step.rb +23 -0
- data/processor/command/set_subcmd/different.rb +59 -0
- data/processor/command/set_subcmd/hidelevel.rb +62 -0
- data/processor/command/set_subcmd/highlight.rb +33 -0
- data/processor/command/set_subcmd/kernelstep.rb +60 -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/substitute.rb +24 -0
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
- data/processor/command/set_subcmd/trace.rb +36 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +57 -0
- data/processor/command/show.rb +38 -0
- data/processor/command/show_subcmd/alias.rb +42 -0
- data/processor/command/show_subcmd/args.rb +25 -0
- data/processor/command/show_subcmd/auto.rb +28 -0
- data/processor/command/show_subcmd/auto_subcmd/dis.rb +37 -0
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +28 -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/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/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/highlight.rb +24 -0
- data/processor/command/show_subcmd/kernelstep.rb +34 -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/trace.rb +27 -0
- data/processor/command/show_subcmd/trace_subcmd/print.rb +38 -0
- data/processor/command/show_subcmd/version.rb +23 -0
- data/processor/command/source.rb +126 -0
- data/processor/command/step.rb +84 -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 +86 -0
- data/processor/default.rb +58 -0
- data/processor/disassemble.rb +46 -0
- data/processor/display.rb +18 -0
- data/processor/eval.rb +96 -0
- data/processor/frame.rb +211 -0
- data/processor/help.rb +72 -0
- data/processor/hook.rb +133 -0
- data/processor/load_cmds.rb +185 -0
- data/processor/location.rb +137 -0
- data/processor/main.rb +412 -0
- data/processor/mock.rb +144 -0
- data/processor/msg.rb +43 -0
- data/processor/running.rb +234 -0
- data/processor/stepping.rb +114 -0
- data/processor/subcmd.rb +161 -0
- data/processor/validate.rb +355 -0
- data/sample/list-terminal-colors.rb +139 -0
- data/sample/list-terminal-colors.rbc +2318 -0
- data/sample/rocky-dot-trepanxrc +14 -0
- data/sample/rocky-trepanx-colors.rb +47 -0
- data/sample/rocky-trepanx-colors.rbc +530 -0
- data/test/data/enable.right +36 -0
- data/test/data/fname-with-blank.cmd +6 -0
- data/test/data/fname-with-blank.right +4 -0
- data/test/data/inline-call.cmd +6 -0
- data/test/data/inline-call.right +13 -0
- data/test/data/quit-Xdebug.right +3 -0
- data/test/data/quit.cmd +5 -0
- data/test/data/quit.right +2 -0
- data/test/data/quit2.cmd +6 -0
- data/test/data/quit2.right +3 -0
- data/test/data/step-bug.cmd +11 -0
- data/test/data/step-bug.right +3 -0
- data/test/example/fname with blank.rb +1 -0
- data/test/example/gcd-server.rb +22 -0
- data/test/example/gcd.rb +19 -0
- data/test/example/inline-call.rb +23 -0
- data/test/example/null.rb +1 -0
- data/test/example/step-bug.rb +14 -0
- data/test/example/thread1.rb +3 -0
- data/test/functional/fn_helper.rb +112 -0
- data/test/functional/test-break-name.rb +52 -0
- data/test/functional/test-break.rb +51 -0
- data/test/functional/test-finish.rb +70 -0
- data/test/functional/test-fn_helper.rb +43 -0
- data/test/functional/test-list.rb +55 -0
- data/test/functional/test-next-bug.rb +49 -0
- data/test/functional/test-next.rb +101 -0
- data/test/functional/test-step.rb +272 -0
- data/test/functional/test-step2.rb +35 -0
- data/test/functional/test-tbreak.rb +41 -0
- data/test/integration/file-diff.rb +89 -0
- data/test/integration/helper.rb +78 -0
- data/test/integration/skip-test-step-bug.rb +17 -0
- data/test/integration/test-fname-with-blank.rb +16 -0
- data/test/integration/test-inline-call.rb +20 -0
- data/test/integration/test-quit.rb +47 -0
- data/test/unit/cmd-helper.rb +50 -0
- data/test/unit/mock-helper.rb +10 -0
- data/test/unit/test-app-brkpt.rb +29 -0
- data/test/unit/test-app-brkptmgr.rb +51 -0
- data/test/unit/test-app-iseq.rb +64 -0
- data/test/unit/test-app-method.rb +54 -0
- data/test/unit/test-app-options.rb +82 -0
- data/test/unit/test-app-run.rb +16 -0
- data/test/unit/test-app-util.rb +27 -0
- data/test/unit/test-app-validate.rb +18 -0
- data/test/unit/test-base-cmd.rb +47 -0
- data/test/unit/test-base-subcmd.rb +61 -0
- data/test/unit/test-base-submgr.rb +24 -0
- data/test/unit/test-bin-trepanx.rb +48 -0
- data/test/unit/test-cmd-alias.rb +48 -0
- data/test/unit/test-cmd-break.rb +22 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-finish.rb +27 -0
- data/test/unit/test-cmd-help.rb +104 -0
- data/test/unit/test-cmd-kill.rb +47 -0
- data/test/unit/test-cmd-source.rb +34 -0
- data/test/unit/test-cmd-step.rb +29 -0
- data/test/unit/test-completion.rb +38 -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-frame.rb +79 -0
- data/test/unit/test-proc-help.rb +16 -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 +53 -0
- data/test/unit/test-proc-main.rb +99 -0
- data/test/unit/test-proc-validate.rb +91 -0
- data/test/unit/test-subcmd-help.rb +47 -0
- metadata +398 -0
@@ -0,0 +1,26 @@
|
|
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::ShowDifferent < Trepan::ShowBoolSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
|
+
HELP = "Show status of 'set different'"
|
10
|
+
MIN_ABBREV = 'dif'.size
|
11
|
+
end
|
12
|
+
|
13
|
+
def run(args)
|
14
|
+
if 'nostack' == @proc.settings[:different]
|
15
|
+
msg "%s is nostack." % HELP[5..-1].capitalize
|
16
|
+
else
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if __FILE__ == $0
|
23
|
+
# Demo it.
|
24
|
+
require_relative '../../mock'
|
25
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowDifferent)
|
26
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../base/subsubcmd'
|
5
|
+
|
6
|
+
class Trepan::Subcommand::ShowHidelevel < Trepan::ShowIntSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
|
+
HELP = 'Show the number of stack levels to hide'
|
10
|
+
MIN_ABBREV = 'hide'.size
|
11
|
+
end
|
12
|
+
def run(args)
|
13
|
+
if @proc.settings[:hidelevel]
|
14
|
+
super
|
15
|
+
else
|
16
|
+
help = self.class.const_get(:HELP)
|
17
|
+
msg "%s is auto selection." % help[5..-1].capitalize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
if __FILE__ == $0
|
24
|
+
# Demo it.
|
25
|
+
require_relative '../../mock'
|
26
|
+
|
27
|
+
# FIXME: DRY the below code
|
28
|
+
dbgr, cmd = MockDebugger::setup('show')
|
29
|
+
subcommand = Trepan::Subcommand::ShowHidelevel.new(cmd)
|
30
|
+
|
31
|
+
subcommand.run(subcommand.name)
|
32
|
+
subcommand.proc.settings[:hidelevel] = 1
|
33
|
+
subcommand.run(subcommand.name)
|
34
|
+
|
35
|
+
# require_relative '../../../../lib/trepanning'
|
36
|
+
# dbgr = Trepan.new(:set_restart => true)
|
37
|
+
# dbgr.debugger
|
38
|
+
subcommand.summary_help(subcommand.name)
|
39
|
+
puts
|
40
|
+
puts '-' * 20
|
41
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 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::Subcommand::ShowHighlight < Trepan::ShowBoolSubcommand
|
8
|
+
unless defined?(HELP)
|
9
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
10
|
+
HELP = 'Show whether we use terminal highlighting'
|
11
|
+
end
|
12
|
+
|
13
|
+
def run(args)
|
14
|
+
val = :term == @proc.settings[:highlight]
|
15
|
+
onoff = show_onoff(val)
|
16
|
+
msg("%s is %s." % [@name, onoff])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
if __FILE__ == $0
|
21
|
+
require_relative '../../mock'
|
22
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowHighlight, false)
|
23
|
+
cmd.run(cmd.prefix)
|
24
|
+
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::ShowKernelstep < Trepan::Subcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
9
|
+
HELP = "Show stepping into kernel methods"
|
10
|
+
MIN_ABBREV = 'kern'.size
|
11
|
+
|
12
|
+
# Specific to this class
|
13
|
+
KERNEL_METHOD_FILE_RE = /^kernel\//
|
14
|
+
end
|
15
|
+
|
16
|
+
def ignore?
|
17
|
+
@proc.ignore_file_re.member?(KERNEL_METHOD_FILE_RE)
|
18
|
+
end
|
19
|
+
|
20
|
+
def show
|
21
|
+
msg("stepping into kernel methods is %s." %
|
22
|
+
(ignore? ? 'disallowed' : 'allowed'))
|
23
|
+
end
|
24
|
+
|
25
|
+
def run(args)
|
26
|
+
show
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if __FILE__ == $0
|
31
|
+
# Demo it.
|
32
|
+
require_relative '../../mock'
|
33
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowKernelstep)
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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::ShowMax < Trepan::SubSubcommandMgr
|
8
|
+
unless defined?(HELP)
|
9
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
10
|
+
HELP = 'Show "maximum length" settings'
|
11
|
+
end
|
12
|
+
|
13
|
+
def run(args)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if __FILE__ == $0
|
19
|
+
require_relative '../../mock'
|
20
|
+
cmd_ary = Trepan::SubSubcommand::ShowMax::PREFIX
|
21
|
+
dbgr, parent_cmd = MockDebugger::setup(cmd_ary[0], false)
|
22
|
+
cmd = Trepan::SubSubcommand::ShowMax.new(dbgr.processor,
|
23
|
+
parent_cmd)
|
24
|
+
cmd_name = cmd_ary.join('')
|
25
|
+
prefix_run = cmd_ary[1..-1]
|
26
|
+
cmd.run(prefix_run)
|
27
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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::ShowMaxList < Trepan::ShowIntSubSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
HELP = 'Show the number of source file lines to list'
|
9
|
+
MIN_ABBREV = 'lis'.size
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
PREFIX = %w(show max list)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
if __FILE__ == $0
|
17
|
+
# Demo it.
|
18
|
+
require_relative '../../../mock'
|
19
|
+
|
20
|
+
# FIXME: DRY the below code
|
21
|
+
cmd_ary = Trepan::SubSubcommand::ShowMaxList::PREFIX
|
22
|
+
dbgr, parent_cmd = MockDebugger::setup(cmd_ary[0], false)
|
23
|
+
cmd = Trepan::SubSubcommand::ShowMax.new(dbgr.processor,
|
24
|
+
parent_cmd)
|
25
|
+
cmd_name = cmd_ary.join('')
|
26
|
+
subcmd = Trepan::SubSubcommand::ShowMaxList.new(parent_cmd.proc,
|
27
|
+
cmd,
|
28
|
+
cmd.name)
|
29
|
+
prefix_run = cmd_ary[1..-1]
|
30
|
+
subcmd.run(prefix_run)
|
31
|
+
|
32
|
+
# require_relative '../../../../lib/trepanning'
|
33
|
+
# dbgr = Trepan.new(:set_restart => true)
|
34
|
+
# dbgr.debugger
|
35
|
+
puts subcmd.summary_help(cmd.name)
|
36
|
+
puts
|
37
|
+
puts '-' * 20
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
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::ShowMaxStack < Trepan::ShowIntSubSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
HELP = 'Show the number of backtrace lines the debugger will show'
|
9
|
+
MIN_ABBREV = 'sta'.size
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
PREFIX = %w(show max stack)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
if __FILE__ == $0
|
17
|
+
# Demo it.
|
18
|
+
require_relative '../../../mock'
|
19
|
+
|
20
|
+
# FIXME: DRY the below code
|
21
|
+
dbgr, show_cmd = MockDebugger::setup('show')
|
22
|
+
testcmdMgr = Trepan::Subcmd.new(show_cmd)
|
23
|
+
# max_cmd = Trepan::SubSubcommand::ShowMax.new(dbgr.core.processor,
|
24
|
+
# show_cmd)
|
25
|
+
|
26
|
+
# cmd_name = Trepan::SubSubcommand::ShowMaxStack::PREFIX.join('')
|
27
|
+
# maxx_cmd = Trepan::SubSubcommand::ShowMaxStack.new(show_cmd.proc,
|
28
|
+
# max_cmd,
|
29
|
+
# cmd_name)
|
30
|
+
# # require_relative '../../../../lib/trepanning'
|
31
|
+
# # dbgr = Trepan.new(:set_restart => true)
|
32
|
+
# # dbgr.debugger
|
33
|
+
puts max_cmd.summary_help(maxx_cmd)
|
34
|
+
puts
|
35
|
+
# maxx_cmd.run([])
|
36
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../base/subsubcmd'
|
5
|
+
|
6
|
+
class Trepan::SubSubcommand::ShowMaxString < Trepan::ShowIntSubSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
HELP = 'Show the number of characters in a string before truncating.
|
9
|
+
|
10
|
+
Sometimes the string representation of an object is very long. This
|
11
|
+
setting limits how much of the string representation you want to
|
12
|
+
see. However if the string has an embedded newline then we will assume
|
13
|
+
the output is intended to be formated as.'
|
14
|
+
MIN_ABBREV = 'st'.size
|
15
|
+
NAME = File.basename(__FILE__, '.rb')
|
16
|
+
PREFIX = %w(show max string)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
if __FILE__ == $0
|
22
|
+
# Demo it.
|
23
|
+
require_relative '../../../mock'
|
24
|
+
|
25
|
+
# FIXME: DRY the below code
|
26
|
+
dbgr, show_cmd = MockDebugger::setup('show')
|
27
|
+
testcmdMgr = Trepan::Subcmd.new(show_cmd)
|
28
|
+
# max_cmd = Trepan::SubSubcommand::ShowMax.new(dbgr.core.processor,
|
29
|
+
# show_cmd)
|
30
|
+
|
31
|
+
# cmd_name = Trepan::SubSubcommand::ShowMaxString::PREFIX.join('')
|
32
|
+
# maxx_cmd = Trepan::SubSubcommand::ShowMaxString.new(show_cmd.proc,
|
33
|
+
# max_cmd,
|
34
|
+
# cmd_name)
|
35
|
+
|
36
|
+
# # require_relative '../../../../lib/trepanning'
|
37
|
+
# # dbgr = Trepan.new(:set_restart => true)
|
38
|
+
# # dbgr.debugger
|
39
|
+
puts max_cmd.summary_help(maxx_cmd)
|
40
|
+
puts
|
41
|
+
maxx_cmd.run([])
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require 'rubygems'; require 'require_relative'
|
4
|
+
require_relative '../../base/subsubcmd'
|
5
|
+
|
6
|
+
class Trepan::SubSubcommand::ShowMaxWidth < Trepan::ShowIntSubSubcommand
|
7
|
+
unless defined?(HELP)
|
8
|
+
HELP = 'Show the number of characters the debugger thinks are in a line.'
|
9
|
+
MIN_ABBREV = 'wid'.size
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
PREFIX = %w(show max width)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
if __FILE__ == $0
|
17
|
+
# Demo it.
|
18
|
+
require_relative '../../../mock'
|
19
|
+
|
20
|
+
# FIXME: DRY the below code
|
21
|
+
dbgr, show_cmd = MockDebugger::setup('show')
|
22
|
+
testcmdMgr = Trepan::Subcmd.new(show_cmd)
|
23
|
+
# max_cmd = Trepan::SubSubcommand::ShowMax.new(dbgr.core.processor,
|
24
|
+
# show_cmd)
|
25
|
+
# cmd_name = Trepan::SubSubcommand::ShowMaxWidth::PREFIX.join('')
|
26
|
+
# maxx_cmd = Trepan::SubSubcommand::ShowMaxWidth.new(show_cmd.proc,
|
27
|
+
# max_cmd,
|
28
|
+
# cmd_name)
|
29
|
+
|
30
|
+
name = File.basename(__FILE__, '.rb')
|
31
|
+
# require_relative '../../../../lib/trepanning'
|
32
|
+
# dbgr = Trepan.new(:set_restart => true)
|
33
|
+
# dbgr.debugger
|
34
|
+
# puts max_cmd.summary_help(maxx_cmd)
|
35
|
+
# puts
|
36
|
+
# maxx_cmd.run([])
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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::ShowTrace < Trepan::SubSubcommandMgr
|
8
|
+
|
9
|
+
unless defined?(HELP)
|
10
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
11
|
+
HELP = "Show event tracing printing"
|
12
|
+
MIN_ABBREV = 'tr'.size
|
13
|
+
SHORT_HELP = HELP
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
if __FILE__ == $0
|
18
|
+
# Demo it.
|
19
|
+
require_relative '../../mock'
|
20
|
+
cmd_ary = Trepan::SubSubcommand::ShowTrace::PREFIX
|
21
|
+
dbgr, parent_cmd = MockDebugger::setup(cmd_ary[0], false)
|
22
|
+
cmd = Trepan::SubSubcommand::ShowTrace.new(dbgr.processor,
|
23
|
+
parent_cmd)
|
24
|
+
cmd_name = cmd_ary.join('')
|
25
|
+
prefix_run = cmd_ary[1..-1]
|
26
|
+
cmd.run(prefix_run)
|
27
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../../base/subsubcmd'
|
4
|
+
|
5
|
+
class Trepan::SubSubcommand::ShowTracePrint < Trepan::ShowBoolSubSubcommand
|
6
|
+
unless defined?(HELP)
|
7
|
+
HELP = "Show tracing print status"
|
8
|
+
MIN_ABBREV = 'p'.size
|
9
|
+
NAME = File.basename(__FILE__, '.rb')
|
10
|
+
PREFIX = %w(show trace buffer)
|
11
|
+
SHORT_HELP = "Show tracing print status"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
if __FILE__ == $0
|
17
|
+
# Demo it.
|
18
|
+
require_relative '../../../mock'
|
19
|
+
require_relative '../../../subcmd'
|
20
|
+
name = File.basename(__FILE__, '.rb')
|
21
|
+
|
22
|
+
# FIXME: DRY the below code
|
23
|
+
dbgr, show_cmd = MockDebugger::setup('show')
|
24
|
+
testcmdMgr = Trepan::Subcmd.new(show_cmd)
|
25
|
+
trace_cmd = Trepan::SubSubcommand::ShowTrace.new(dbgr.core.processor,
|
26
|
+
show_cmd)
|
27
|
+
|
28
|
+
# FIXME: remove the 'join' below
|
29
|
+
cmd_name = Trepan::SubSubcommand::ShowTracePrint::PREFIX.join('')
|
30
|
+
tb_cmd = Trepan::SubSubcommand::ShowTracePrint.new(show_cmd.proc,
|
31
|
+
trace_cmd,
|
32
|
+
cmd_name)
|
33
|
+
# require_relative '../../../../lib/trepanning'
|
34
|
+
# dbgr = Trepan.new(:set_restart => true)
|
35
|
+
# dbgr.debugger
|
36
|
+
tb_cmd.run([])
|
37
|
+
|
38
|
+
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,126 @@
|
|
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 parse_options(options, args) # :nodoc
|
53
|
+
seen_yes_no = false
|
54
|
+
parser = OptionParser.new do |opts|
|
55
|
+
opts.on("-c", "--[no-]continue",
|
56
|
+
"Continue in the face of errors") do
|
57
|
+
|v|
|
58
|
+
options[:abort_on_error] = !v
|
59
|
+
end
|
60
|
+
opts.on("-v",
|
61
|
+
"--[no-]verbose", "echo each command as it is executed") do
|
62
|
+
|v|
|
63
|
+
options[:verbose] = v
|
64
|
+
end
|
65
|
+
opts.on("-N", "--no", "Use 'no' in any confirmation prompts") do
|
66
|
+
|v|
|
67
|
+
if seen_yes_no
|
68
|
+
msg("Yes/No option already seen. This option (no) ignored.")
|
69
|
+
end
|
70
|
+
options[:confirm_val] = false
|
71
|
+
end
|
72
|
+
opts.on("-q", "--[no-]quiet", "Silence debugger output") do
|
73
|
+
|v|
|
74
|
+
options[:quiet] = v
|
75
|
+
end
|
76
|
+
opts.on("-Y", "--yes", "Use 'yes' in any confirmation prompts") do
|
77
|
+
|v|
|
78
|
+
if seen_yes_no
|
79
|
+
msg("Yes/No option already seen. This option, --yes, ignored.")
|
80
|
+
end
|
81
|
+
options[:confirm_val] = true
|
82
|
+
seen_yes_no = true
|
83
|
+
end
|
84
|
+
end
|
85
|
+
parser.parse(args)
|
86
|
+
return options
|
87
|
+
end
|
88
|
+
|
89
|
+
def run(args)
|
90
|
+
options = parse_options(DEFAULT_OPTIONS.dup, args[1..-2])
|
91
|
+
intf = @proc.dbgr.intf
|
92
|
+
output = options[:quiet] ? Trepan::OutputNull.new(nil) : intf[-1].output
|
93
|
+
|
94
|
+
filename = args[-1]
|
95
|
+
|
96
|
+
expanded_file = File.expand_path(filename)
|
97
|
+
unless File.readable?(expanded_file)
|
98
|
+
errmsg("Debugger command file '%s' is not a readable file" % filename)
|
99
|
+
return false
|
100
|
+
end
|
101
|
+
|
102
|
+
# Push a new debugger interface.
|
103
|
+
script_intf = Trepan::ScriptInterface.new(expanded_file, output, options)
|
104
|
+
intf << script_intf
|
105
|
+
return false
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Demo it
|
110
|
+
if __FILE__ == $0
|
111
|
+
require_relative '../mock'
|
112
|
+
dbgr, cmd = MockDebugger::setup
|
113
|
+
%w(--quiet -q --no-quiet --continue --no-continue -c -v --verbose
|
114
|
+
--no-verbose).each do |opt|
|
115
|
+
puts "parsing #{opt}"
|
116
|
+
options =
|
117
|
+
cmd.parse_options(Trepan::Command::SourceCommand::DEFAULT_OPTIONS.dup,
|
118
|
+
opt)
|
119
|
+
p options
|
120
|
+
end
|
121
|
+
|
122
|
+
if ARGV.size >= 1
|
123
|
+
puts "running... #{cmd.name} #{ARGV}"
|
124
|
+
cmd.run([cmd.name, *ARGV])
|
125
|
+
end
|
126
|
+
end
|