rbx-trepanning 0.0.2-universal-rubinius-1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +376 -0
- data/LICENSE +25 -0
- data/NEWS +2 -0
- data/README.textile +35 -0
- data/Rakefile +165 -0
- data/THANKS +14 -0
- data/app/breakpoint.rb +218 -0
- data/app/breakpoint.rbc +3564 -0
- data/app/brkptmgr.rb +138 -0
- data/app/brkptmgr.rbc +2827 -0
- data/app/default.rb +61 -0
- data/app/default.rbc +1011 -0
- data/app/display.rb +35 -0
- data/app/display.rbc +968 -0
- data/app/frame.rb +98 -0
- data/app/frame.rbc +1808 -0
- data/app/irb.rb +112 -0
- data/app/irb.rbc +2111 -0
- data/app/iseq.rb +95 -0
- data/app/iseq.rbc +1801 -0
- data/app/method.rb +173 -0
- data/app/method.rbc +2492 -0
- data/app/mock.rb +13 -0
- data/app/mock.rbc +398 -0
- data/app/options.rb +123 -0
- data/app/options.rbc +2183 -0
- data/app/run.rb +86 -0
- data/app/run.rbc +1244 -0
- data/app/util.rb +49 -0
- data/app/util.rbc +1144 -0
- data/app/validate.rb +30 -0
- data/app/validate.rbc +676 -0
- data/bin/trepan.compiled.rbc +1043 -0
- data/bin/trepanx +63 -0
- data/bin/trepanx.compiled.rbc +985 -0
- data/interface/base_intf.rb +95 -0
- data/interface/base_intf.rbc +1742 -0
- data/interface/script.rb +104 -0
- data/interface/script.rbc +1642 -0
- data/interface/user.rb +91 -0
- data/interface/user.rbc +1418 -0
- data/io/base_io.rb +94 -0
- data/io/base_io.rbc +1404 -0
- data/io/input.rb +112 -0
- data/io/input.rbc +1979 -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/lib/trepanning.rb +398 -0
- data/lib/trepanning.rbc +6661 -0
- data/processor/breakpoint.rb +161 -0
- data/processor/command/alias.rb +55 -0
- data/processor/command/backtrace.rb +46 -0
- data/processor/command/base/cmd.rb +124 -0
- data/processor/command/base/subcmd.rb +213 -0
- data/processor/command/base/submgr.rb +179 -0
- data/processor/command/base/subsubcmd.rb +103 -0
- data/processor/command/base/subsubmgr.rb +184 -0
- data/processor/command/break.rb +100 -0
- data/processor/command/continue.rb +82 -0
- data/processor/command/delete.rb +30 -0
- data/processor/command/directory.rb +43 -0
- data/processor/command/disassemble.rb +103 -0
- data/processor/command/down.rb +54 -0
- data/processor/command/eval.rb +31 -0
- data/processor/command/exit.rb +58 -0
- data/processor/command/finish.rb +78 -0
- data/processor/command/frame.rb +89 -0
- data/processor/command/help.rb +146 -0
- data/processor/command/info.rb +28 -0
- data/processor/command/info_subcmd/breakpoints.rb +75 -0
- data/processor/command/info_subcmd/file.rb +153 -0
- data/processor/command/info_subcmd/method.rb +71 -0
- data/processor/command/info_subcmd/program.rb +59 -0
- data/processor/command/info_subcmd/variables.rb +40 -0
- data/processor/command/irb.rb +96 -0
- data/processor/command/kill.rb +70 -0
- data/processor/command/list.rb +296 -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/set.rb +47 -0
- data/processor/command/set_subcmd/auto.rb +28 -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 +26 -0
- data/processor/command/set_subcmd/debug.rb +27 -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 +60 -0
- data/processor/command/set_subcmd/hidelevel.rb +63 -0
- data/processor/command/set_subcmd/kernelstep.rb +61 -0
- data/processor/command/set_subcmd/max.rb +29 -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 +54 -0
- data/processor/command/set_subcmd/max_subcmd/width.rb +49 -0
- data/processor/command/set_subcmd/substitute.rb +25 -0
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +56 -0
- data/processor/command/set_subcmd/trace.rb +37 -0
- data/processor/command/set_subcmd/trace_subcmd/print.rb +57 -0
- data/processor/command/show.rb +27 -0
- data/processor/command/show_subcmd/alias.rb +43 -0
- data/processor/command/show_subcmd/args.rb +26 -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 +22 -0
- data/processor/command/show_subcmd/debug.rb +27 -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 +27 -0
- data/processor/command/show_subcmd/hidelevel.rb +42 -0
- data/processor/command/show_subcmd/kernelstep.rb +37 -0
- data/processor/command/show_subcmd/max.rb +30 -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 +29 -0
- data/processor/command/show_subcmd/trace_subcmd/print.rb +38 -0
- data/processor/command/source.rb +83 -0
- data/processor/command/step.rb +49 -0
- data/processor/command/tbreak.rb +19 -0
- data/processor/command/unalias.rb +44 -0
- data/processor/command/up.rb +87 -0
- data/processor/default.rb +56 -0
- data/processor/disassemble.rb +32 -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 +101 -0
- data/processor/location.rb +128 -0
- data/processor/main.rb +394 -0
- data/processor/mock.rb +137 -0
- data/processor/msg.rb +28 -0
- data/processor/running.rb +230 -0
- data/processor/stepping.rb +115 -0
- data/processor/subcmd.rb +160 -0
- data/processor/validate.rb +355 -0
- data/test/data/enable.right +36 -0
- data/test/data/fname-with-blank.cmd +6 -0
- data/test/data/fname-with-blank.right +1 -0
- data/test/data/quit-Xdebug.right +3 -0
- data/test/data/quit.cmd +5 -0
- data/test/data/quit.right +0 -0
- data/test/example/fname with blank.rb +1 -0
- data/test/example/gcd-xx.rb +18 -0
- data/test/example/gcd.rb +19 -0
- data/test/example/gcd1.rb +24 -0
- data/test/example/null.rb +1 -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/test-fname-with-blank.rb +12 -0
- data/test/integration/test-quit.rb +25 -0
- data/test/unit/cmd-helper.rb +46 -0
- data/test/unit/test-app-brkpt.rb +30 -0
- data/test/unit/test-app-brkptmgr.rb +51 -0
- data/test/unit/test-app-iseq.rb +49 -0
- data/test/unit/test-app-method.rb +54 -0
- data/test/unit/test-app-options.rb +61 -0
- data/test/unit/test-app-run.rb +16 -0
- data/test/unit/test-app-util.rb +28 -0
- data/test/unit/test-app-validate.rb +18 -0
- data/test/unit/test-base-subcmd.rb +61 -0
- data/test/unit/test-bin-trepanx.rb +48 -0
- data/test/unit/test-cmd-alias.rb +49 -0
- data/test/unit/test-cmd-break.rb +23 -0
- data/test/unit/test-cmd-exit.rb +27 -0
- data/test/unit/test-cmd-help.rb +101 -0
- data/test/unit/test-cmd-kill.rb +48 -0
- data/test/unit/test-intf-user.rb +46 -0
- data/test/unit/test-io-input.rb +27 -0
- data/test/unit/test-proc-eval.rb +37 -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 +41 -0
- data/test/unit/test-proc-location.rb +48 -0
- data/test/unit/test-proc-main.rb +96 -0
- data/test/unit/test-proc-validate.rb +91 -0
- data/test/unit/test-subcmd-help.rb +51 -0
- metadata +337 -0
@@ -0,0 +1,30 @@
|
|
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::ShowMax < Trepan::SubSubcommandMgr
|
8
|
+
unless defined?(HELP)
|
9
|
+
HELP = 'Show "maximum length" settings'
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
PREFIX = %W(show #{NAME})
|
12
|
+
end
|
13
|
+
|
14
|
+
def run(args)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
if __FILE__ == $0
|
20
|
+
require_relative '../../mock'
|
21
|
+
cmd_ary = Trepan::SubSubcommand::ShowMax::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
|
+
prefix_run = cmd_ary[1..-1]
|
27
|
+
cmd.run(prefix_run)
|
28
|
+
# # require_relative '../../../lib/trepanning'
|
29
|
+
# # Trepan.debug(:set_restart => true)
|
30
|
+
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,29 @@
|
|
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::ShowTrace < Trepan::SubSubcommandMgr
|
8
|
+
|
9
|
+
unless defined?(HELP)
|
10
|
+
HELP = "Show event tracing printing"
|
11
|
+
NAME = File.basename(__FILE__, '.rb')
|
12
|
+
PREFIX = %W(show #{NAME})
|
13
|
+
MIN_ABBREV = 'tr'.size
|
14
|
+
SHORT_HELP = HELP
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if __FILE__ == $0
|
19
|
+
# Demo it.
|
20
|
+
require_relative '../../mock'
|
21
|
+
dbgr, cmd = MockDebugger::setup('set', false)
|
22
|
+
parent_cmd = cmds['show']
|
23
|
+
command = Trepan::SubSubcommand::ShowTrace.new(dbgr.processor,
|
24
|
+
parent_cmd)
|
25
|
+
|
26
|
+
name = File.basename(__FILE__, '.rb')
|
27
|
+
cmd_args = ['show', name]
|
28
|
+
command.run(cmd_args)
|
29
|
+
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,83 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
|
4
|
+
# Our local modules
|
5
|
+
require 'rubygems'; require 'require_relative'
|
6
|
+
require_relative 'base/cmd'
|
7
|
+
require_relative '../../interface/script'
|
8
|
+
require_relative '../../io/null_output'
|
9
|
+
# Mfile = import_relative('file', '...lib', 'pydbgr')
|
10
|
+
|
11
|
+
class Trepan::Command::SourceCommand < Trepan::Command
|
12
|
+
unless defined?(HELP)
|
13
|
+
NAME = File.basename(__FILE__, '.rb')
|
14
|
+
HELP = <<-HELP
|
15
|
+
#{NAME} [-v][-Y|-N][-c][-q] FILE
|
16
|
+
|
17
|
+
Read debugger commands from a file named FILE. Optional -v switch
|
18
|
+
(before the filename) causes each command in FILE to be echoed as it
|
19
|
+
is executed. Option -Y sets the default value in any confirmation
|
20
|
+
command to be 'yes' and -N sets the default value to 'no'.
|
21
|
+
|
22
|
+
Option -q will turn off any debugger output that normally occurs in the
|
23
|
+
running of the program.
|
24
|
+
|
25
|
+
Note that the command startup file '.trepanx' is read automatically
|
26
|
+
via a source command the debugger is started.
|
27
|
+
|
28
|
+
An error in any command terminates execution of the command file
|
29
|
+
unless option -c is given.
|
30
|
+
HELP
|
31
|
+
CATEGORY = 'support'
|
32
|
+
MIN_ARGS = 1 # Need at least this many
|
33
|
+
MAX_ARGS = nil
|
34
|
+
SHORT_HELP = 'Read and run debugger commands from a file'
|
35
|
+
end
|
36
|
+
|
37
|
+
def run(args)
|
38
|
+
verbose = false
|
39
|
+
parms = args[1..-1]
|
40
|
+
opts = {}
|
41
|
+
intf = @proc.dbgr.intf
|
42
|
+
output = intf[-1].output
|
43
|
+
parms.each do |arg|
|
44
|
+
case arg
|
45
|
+
when '-v'
|
46
|
+
opts[:verbose] = true
|
47
|
+
when '-Y'
|
48
|
+
opts[:confirm_val] = true
|
49
|
+
when '-N'
|
50
|
+
opts[:confirm_val] = false
|
51
|
+
when '-c'
|
52
|
+
opts[:abort_on_error] = false
|
53
|
+
when '-q'
|
54
|
+
output = Trepan::OutputNull.new(nil)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
filename = args[-1]
|
59
|
+
|
60
|
+
expanded_file = File.expand_path(filename)
|
61
|
+
unless File.readable?(expanded_file)
|
62
|
+
errmsg("Debugger command file '%s' is not a readable file" % filename)
|
63
|
+
return false
|
64
|
+
end
|
65
|
+
|
66
|
+
# Push a new debugger interface.
|
67
|
+
script_intf = Trepan::ScriptInterface.new(expanded_file, output, opts)
|
68
|
+
intf << script_intf
|
69
|
+
return false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Demo it
|
74
|
+
if __FILE__ == $0
|
75
|
+
require_relative '../mock'
|
76
|
+
dbgr, cmd = MockDebugger::setup
|
77
|
+
Trepan::Command::SourceCommand
|
78
|
+
puts "Args given: #{ARGV.size}"
|
79
|
+
if ARGV.size > 0
|
80
|
+
puts "running... #{cmd.name} #{ARGV}"
|
81
|
+
cmd.run([cmd.name, *ARGV])
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'; require 'require_relative'
|
2
|
+
require_relative 'base/cmd'
|
3
|
+
require_relative '../stepping'
|
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
|
+
Behaves like 'next', but if there is a method call on the current line,
|
12
|
+
exception is stopped in the called method.
|
13
|
+
|
14
|
+
See also 'continue', 'next' and 'nexti' commands.
|
15
|
+
HELP
|
16
|
+
NEED_RUNNING = true
|
17
|
+
SHORT_HELP = 'Step into next method call or to next line'
|
18
|
+
|
19
|
+
Keyword_to_related_cmd = {
|
20
|
+
'out' => 'finish',
|
21
|
+
'over' => 'next',
|
22
|
+
'into' => 'step',
|
23
|
+
}
|
24
|
+
|
25
|
+
def run(args)
|
26
|
+
if args.size == 1
|
27
|
+
step_count = 1
|
28
|
+
opts = {}
|
29
|
+
else
|
30
|
+
step_str = args[1]
|
31
|
+
opts = @proc.parse_next_step_suffix(step_str)
|
32
|
+
count_opts = {
|
33
|
+
:msg_on_error =>
|
34
|
+
"The #{NAME} command argument must eval to an integer. Got: %s" %
|
35
|
+
step_str,
|
36
|
+
:min_value => 1
|
37
|
+
}
|
38
|
+
step_count = @proc.get_an_int(step_str, count_opts)
|
39
|
+
return unless step_count
|
40
|
+
end
|
41
|
+
|
42
|
+
@proc.step('step', step_count, opts)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
if __FILE__ == $0
|
47
|
+
require_relative '../mock'
|
48
|
+
dbgr, cmd = MockDebugger::setup
|
49
|
+
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::SetBreakpointCommand
|
7
|
+
ALIASES = %w(tb tbrk)
|
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
|
+
HELP
|
13
|
+
SHORT_HELP = 'Set a temporary breakpoint'
|
14
|
+
|
15
|
+
def run(args)
|
16
|
+
super args, true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -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 n)
|
42
|
+
cmd.run %w(cmd.name n)
|
43
|
+
cmd.run %w(cmd.name foo bar c)
|
44
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require '/home/rocky-rvm/.rvm/src/rbx-trepanning/processor/command/base/cmd'
|
4
|
+
require_relative 'base/cmd'
|
5
|
+
|
6
|
+
# up command. Like 'down' butthe direction (set by DIRECTION) is different.
|
7
|
+
#
|
8
|
+
# NOTE: The down command subclasses this, so beware when changing!
|
9
|
+
class Trepan::Command::UpCommand < Trepan::Command
|
10
|
+
|
11
|
+
# Silence already initialized constant .. warnings
|
12
|
+
old_verbose = $VERBOSE
|
13
|
+
$VERBOSE = nil
|
14
|
+
HELP =
|
15
|
+
"u(p) [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
|
+
"
|
22
|
+
|
23
|
+
ALIASES = %w(u)
|
24
|
+
CATEGORY = 'stack'
|
25
|
+
MAX_ARGS = 1 # Need at most this many
|
26
|
+
NAME = File.basename(__FILE__, '.rb')
|
27
|
+
NEED_STACK = true
|
28
|
+
SHORT_HELP = 'Move frame in the direction of the caller of the last-selected frame'
|
29
|
+
$VERBOSE = old_verbose
|
30
|
+
|
31
|
+
def initialize(proc)
|
32
|
+
super
|
33
|
+
@direction = +1 # -1 for down.
|
34
|
+
end
|
35
|
+
|
36
|
+
# Run 'up' command.
|
37
|
+
def run(args)
|
38
|
+
|
39
|
+
# FIXME: move into @proc and test based on NEED_STACK.
|
40
|
+
if @proc.stack_size == 0
|
41
|
+
errmsg('No frames recorded.')
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
|
45
|
+
if args.size == 1
|
46
|
+
# Form is: "up" which means "up 1"
|
47
|
+
count = 1
|
48
|
+
else
|
49
|
+
count_str = args[1]
|
50
|
+
name_or_id = args[1]
|
51
|
+
opts = {
|
52
|
+
:msg_on_error =>
|
53
|
+
"The '#{NAME}' command argument must eval to an integer. Got: %s" % count_str,
|
54
|
+
:min_value => -@proc.stack_size,
|
55
|
+
:max_value => @proc.stack_size-1
|
56
|
+
}
|
57
|
+
count = @proc.get_an_int(count_str, opts)
|
58
|
+
return false unless count
|
59
|
+
end
|
60
|
+
@proc.adjust_frame(@direction * count, false)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
if __FILE__ == $0
|
65
|
+
# Demo it.
|
66
|
+
require_relative '../mock'
|
67
|
+
dbgr, cmd = MockDebugger::setup
|
68
|
+
|
69
|
+
# def sep ; puts '=' * 40 end
|
70
|
+
# cmd.run [cmd.name]
|
71
|
+
# %w(-1 0 1 -2).each do |count|
|
72
|
+
# puts "#{cmd.name} #{count}"
|
73
|
+
# cmd.run([cmd.name, count])
|
74
|
+
# sep
|
75
|
+
# end
|
76
|
+
# def foo(cmd, cmd.name)
|
77
|
+
# puts "#{cmd.name}"
|
78
|
+
# cmd.run([cmd.name])
|
79
|
+
# sep
|
80
|
+
# %w(-2 -1).each do |count|
|
81
|
+
# puts "#{cmd.name} #{count}"
|
82
|
+
# cmd.run([cmd.name, count])
|
83
|
+
# sep
|
84
|
+
# end
|
85
|
+
# end
|
86
|
+
# foo(cmd, cmd.name)
|
87
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
require 'rubygems'; require 'require_relative'
|
3
|
+
require_relative '../app/default'
|
4
|
+
class Trepan
|
5
|
+
class CmdProcessor
|
6
|
+
|
7
|
+
DEFAULT_SETTINGS = {
|
8
|
+
:autoeval => true, # Ruby eval non-debugger commands
|
9
|
+
:autoirb => false, # Go into IRB in debugger command loop
|
10
|
+
:autolist => false, # Run 'list'
|
11
|
+
|
12
|
+
:basename => false, # Show basename of filenames only
|
13
|
+
:different => 'nostack', # stop *only* when different position?
|
14
|
+
|
15
|
+
:debugdbgr => false, # Debugging the debugger
|
16
|
+
:debugexcept => true, # Internal debugging of command exceptions
|
17
|
+
:debugmacro => false, # debugging macros
|
18
|
+
:debugskip => false, # Internal debugging of step/next skipping
|
19
|
+
:directory => # last-resort path-search for files
|
20
|
+
'$cdir:$cwd', # that are not fully qualified.
|
21
|
+
|
22
|
+
:hidestack => nil, # Fixnum. How many hidden outer
|
23
|
+
# debugger stack frames to hide?
|
24
|
+
# nil or -1 means compute value. 0
|
25
|
+
# means hide none. Less than 0 means show
|
26
|
+
# all stack entries.
|
27
|
+
:maxlist => 10, # Number of source lines to list
|
28
|
+
:maxstack => 10, # backtrace limit
|
29
|
+
:maxstring => 150, # Strings which are larger than this
|
30
|
+
# will be truncated to this length when
|
31
|
+
# printed
|
32
|
+
:maxwidth => (ENV['COLUMNS'] || '80').to_i,
|
33
|
+
:prompt => 'trepanx', # core part of prompt. Additional info like
|
34
|
+
# debug nesting and
|
35
|
+
:save_cmdfile => nil, # If set, debugger command file to be
|
36
|
+
# used on restart
|
37
|
+
:timer => false, # show elapsed time between events
|
38
|
+
:traceprint => false, # event tracing printing
|
39
|
+
:tracebuffer => false, # save events to a trace buffer.
|
40
|
+
:user_cmd_dir => File.join(Trepanning::HOME_DIR, 'tepanx', 'command'),
|
41
|
+
# User command directory
|
42
|
+
|
43
|
+
# Rubinius-specific user variables
|
44
|
+
:show_ip => false,
|
45
|
+
:show_bytecode => false,
|
46
|
+
:highlight => false
|
47
|
+
|
48
|
+
} unless defined?(DEFAULT_SETTINGS)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if __FILE__ == $0
|
53
|
+
# Show it:
|
54
|
+
require 'pp'
|
55
|
+
PP.pp(Trepan::CmdProcessor::DEFAULT_SETTINGS)
|
56
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'; require 'require_relative'
|
2
|
+
require_relative '../app/iseq'
|
3
|
+
|
4
|
+
class Trepan
|
5
|
+
class CmdProcessor
|
6
|
+
|
7
|
+
def show_bytecode(line=@frame.vm_location.line)
|
8
|
+
meth = @frame.method
|
9
|
+
start = meth.first_ip_on_line(line)
|
10
|
+
fin = meth.first_ip_on_line(line+1)
|
11
|
+
|
12
|
+
if fin == -1
|
13
|
+
fin = meth.iseq.size
|
14
|
+
end
|
15
|
+
|
16
|
+
# FIXME: Add section instead of "msg"
|
17
|
+
msg "Bytecode between #{start} and #{fin-1} for line #{line}"
|
18
|
+
|
19
|
+
iseq_decoder = Rubinius::InstructionDecoder.new(meth.iseq)
|
20
|
+
partial = iseq_decoder.decode_between(start, fin)
|
21
|
+
|
22
|
+
ip = start
|
23
|
+
|
24
|
+
partial.each do |ins|
|
25
|
+
inst = Rubinius::CompiledMethod::Instruction.new(ins, meth, ip)
|
26
|
+
prefix = Trepanning::ISeq::disasm_prefix(ip, frame.next_ip, meth)
|
27
|
+
msg "#{prefix} #{inst}"
|
28
|
+
ip += ins.size
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|