trepanning 0.1.2 → 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/ChangeLog +354 -0
- data/NEWS +21 -0
- data/Rakefile +27 -20
- data/app/cmd_parse.kpeg +20 -4
- data/app/cmd_parse.rb +11 -10
- data/app/cmd_parser.rb +119 -55
- data/app/complete.rb +1 -0
- data/app/core.rb +3 -3
- data/app/disassemble.rb +13 -3
- data/app/file.rb +2 -1
- data/app/frame.rb +3 -1
- data/app/mock.rb +3 -0
- data/app/options.rb +48 -31
- data/app/util.rb +50 -0
- data/interface/base_intf.rb +4 -0
- data/interface/client.rb +4 -0
- data/interface/script.rb +1 -1
- data/interface/server.rb +4 -0
- data/interface/user.rb +5 -0
- data/io/input.rb +3 -2
- data/io/null_output.rb +7 -1
- data/processor/breakpoint.rb +3 -2
- data/processor/command/base/subcmd.rb +1 -1
- data/processor/command/base/submgr.rb +4 -1
- data/processor/command/base/subsubcmd.rb +2 -2
- data/processor/command/base/subsubmgr.rb +1 -1
- data/processor/command/break.rb +7 -3
- data/processor/command/complete.rb +1 -0
- data/processor/command/continue.rb +1 -1
- data/processor/command/disassemble.rb +1 -1
- data/processor/command/edit.rb +35 -14
- data/processor/command/enable.rb +5 -3
- data/processor/command/eval.rb +35 -14
- data/processor/command/exit.rb +2 -0
- data/processor/command/help.rb +0 -9
- data/processor/command/help/command.txt +37 -27
- data/processor/command/help/examples.txt +16 -0
- data/processor/command/help/suffixes.txt +17 -0
- data/processor/command/info.rb +1 -1
- data/processor/command/info_subcmd/args.rb +7 -13
- data/processor/command/info_subcmd/breakpoints.rb +8 -2
- data/processor/command/info_subcmd/frame.rb +2 -0
- data/processor/command/info_subcmd/globals.rb +63 -0
- data/processor/command/info_subcmd/iseq.rb +3 -1
- data/processor/command/info_subcmd/locals.rb +16 -15
- data/processor/command/{show_subcmd → info_subcmd}/macro.rb +7 -7
- data/processor/command/info_subcmd/program.rb +2 -0
- data/processor/command/info_subcmd/registers.rb +5 -1
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +2 -3
- data/processor/command/info_subcmd/registers_subcmd/helper.rb +8 -9
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +10 -5
- data/processor/command/info_subcmd/registers_subcmd/pc.rb +9 -4
- data/processor/command/info_subcmd/registers_subcmd/sp.rb +4 -5
- data/processor/command/info_subcmd/ruby.rb +3 -1
- data/processor/command/info_subcmd/source.rb +78 -0
- data/processor/command/info_subcmd/stack.rb +23 -0
- data/processor/command/kill.rb +4 -6
- data/processor/command/list.rb +118 -120
- data/processor/command/macro.rb +1 -1
- data/processor/command/parsetree.rb +56 -0
- data/processor/command/pp.rb +40 -0
- data/processor/command/pr.rb +1 -2
- data/processor/command/quit.rb +2 -1
- data/processor/command/set_subcmd/abbrev.rb +24 -0
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +2 -3
- data/processor/command/set_subcmd/auto_subcmd/list.rb +2 -3
- data/processor/command/set_subcmd/highlight.rb +8 -2
- data/processor/command/set_subcmd/reload.rb +41 -0
- data/processor/command/set_subcmd/timer.rb +8 -18
- data/processor/command/set_subcmd/trace.rb +2 -2
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +2 -2
- data/processor/command/set_subcmd/trace_subcmd/print.rb +3 -3
- data/processor/command/{irb.rb → shell.rb} +9 -6
- data/processor/command/show_subcmd/abbrev.rb +19 -0
- data/processor/command/show_subcmd/directories.rb +21 -0
- data/processor/command/show_subcmd/hidelevel.rb +1 -1
- data/processor/command/show_subcmd/highlight.rb +2 -1
- data/processor/command/show_subcmd/reload.rb +17 -0
- data/processor/command/show_subcmd/timer.rb +17 -0
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/source.rb +15 -14
- data/processor/command/tbreak.rb +20 -0
- data/processor/command/watchg.rb +114 -0
- data/processor/default.rb +43 -41
- data/processor/display.rb +3 -2
- data/processor/eval.rb +5 -3
- data/processor/eventbuf.rb +3 -2
- data/processor/frame.rb +12 -3
- data/processor/hook.rb +3 -2
- data/processor/load_cmds.rb +186 -179
- data/processor/location.rb +154 -159
- data/processor/main.rb +44 -16
- data/processor/mock.rb +0 -11
- data/processor/msg.rb +3 -1
- data/processor/running.rb +3 -2
- data/processor/validate.rb +25 -4
- data/processor/virtual.rb +32 -0
- data/test/data/debugger-stop.right +1 -0
- data/test/data/fname-with-blank.right +1 -0
- data/test/example/gcd.rb +1 -0
- data/test/functional/{test-trace-var.rb → test-watchg.rb} +15 -4
- data/test/unit/cmd-helper.rb +0 -3
- data/test/unit/test-app-cmd_parser.rb +2 -2
- data/test/unit/test-app-file.rb +1 -0
- data/test/unit/test-app-frame.rb +1 -1
- data/test/unit/test-app-util.rb +21 -0
- data/test/unit/test-base-cmd.rb +4 -6
- data/test/unit/test-base-subcmd.rb +1 -4
- data/test/unit/test-base-submgr.rb +1 -2
- data/test/unit/test-base-subsubcmd.rb +0 -4
- data/test/unit/test-cmd-edit.rb +33 -0
- data/test/unit/test-cmd-parse_list_cmd.rb +33 -0
- data/test/unit/test-completion.rb +1 -1
- data/test/unit/test-proc-frame.rb +4 -1
- data/test/unit/test-proc-load_cmds.rb +2 -1
- data/test/unit/test-proc-location.rb +9 -26
- data/test/unit/test-proc-main.rb +1 -4
- data/test/unit/test-proc-validate.rb +28 -18
- data/test/unit/test-subcmd-help.rb +0 -4
- data/trepanning.gemspec +1 -1
- metadata +27 -10
- data/processor/command/set_subcmd/trace_subcmd/var.rb +0 -57
data/processor/command/macro.rb
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
begin
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'parse_tree'
|
|
6
|
+
require_relative 'base/cmd'
|
|
7
|
+
require_relative '../../app/cmd_parse'
|
|
8
|
+
class Trepan::Command::ParseTreeCommand < Trepan::Command
|
|
9
|
+
|
|
10
|
+
unless defined?(HELP)
|
|
11
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
12
|
+
HELP = <<-HELP
|
|
13
|
+
#{NAME}
|
|
14
|
+
#{NAME} method
|
|
15
|
+
|
|
16
|
+
In the first form, print a ParseTree S-expression of the current
|
|
17
|
+
class.
|
|
18
|
+
In the second form, preint a ParseTree S-expression of the current method.
|
|
19
|
+
In the third form print a ParseTree S-expression of CLASS.
|
|
20
|
+
In the fourth form, print a ParseTree S-expression of the given method.
|
|
21
|
+
HELP
|
|
22
|
+
|
|
23
|
+
# ALIASES = %w(p)
|
|
24
|
+
CATEGORY = 'data'
|
|
25
|
+
SHORT_HELP = 'PrettyPrint a ParseTree S-expression'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def run(args)
|
|
29
|
+
@processor ||= ParseTree19.new(false)
|
|
30
|
+
meth = nil
|
|
31
|
+
case args.size
|
|
32
|
+
when 1
|
|
33
|
+
method_name = @proc.frame.method
|
|
34
|
+
when 2
|
|
35
|
+
method_name = args[1]
|
|
36
|
+
else
|
|
37
|
+
errmsg 'Expecting a method name'
|
|
38
|
+
return
|
|
39
|
+
end
|
|
40
|
+
meth = Trepan::CmdParser.meth_for_string(method_name, @proc.frame.binding)
|
|
41
|
+
if meth and meth.kind_of?(Method)
|
|
42
|
+
msg @processor.parse_tree_for_method(meth, true).pretty_inspect
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if __FILE__ == $0
|
|
47
|
+
require 'pp'
|
|
48
|
+
require_relative '../mock'
|
|
49
|
+
dbgr, cmd = MockDebugger::setup
|
|
50
|
+
cmd.proc.frame.instance_variable_set('@binding', TOPLEVEL_BINDING)
|
|
51
|
+
cmd.run([cmd.name, 'FileUtils.rm'])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
rescue LoadError
|
|
56
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'pp'
|
|
5
|
+
require_relative 'base/cmd'
|
|
6
|
+
class Trepan::Command::PPCommand < Trepan::Command
|
|
7
|
+
|
|
8
|
+
unless defined?(HELP)
|
|
9
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
10
|
+
HELP =
|
|
11
|
+
"#{NAME} EXPRESSION
|
|
12
|
+
|
|
13
|
+
Prtty Print the value of the EXPRESSION. Variables accessible are
|
|
14
|
+
those of the environment of the selected stack frame, plus globals.
|
|
15
|
+
|
|
16
|
+
If the length output string large, the first part of the value is
|
|
17
|
+
shown and ... indicates it has been truncated.
|
|
18
|
+
|
|
19
|
+
See 'set max string' to change the string truncation limit.
|
|
20
|
+
"
|
|
21
|
+
CATEGORY = 'data'
|
|
22
|
+
SHORT_HELP = 'pretty print expression truncating long output'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def run(args)
|
|
26
|
+
obj = @proc.debug_eval(@proc.cmd_argstr)
|
|
27
|
+
msg (obj.respond_to?(:pretty_inspect) ? obj.pretty_inspect : obj.inspect)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
if __FILE__ == $0
|
|
32
|
+
require_relative '../mock'
|
|
33
|
+
dbgr, cmd = MockDebugger::setup
|
|
34
|
+
['(0..10).to_a', '$LOADED_FEATURES'].each do |expr_str|
|
|
35
|
+
cmd_argstr = expr_str
|
|
36
|
+
cmd.proc.instance_variable_set('@cmd_argstr', cmd_argstr)
|
|
37
|
+
cmd.run([cmd.name, cmd_argstr])
|
|
38
|
+
puts '-' * 20
|
|
39
|
+
end
|
|
40
|
+
end
|
data/processor/command/pr.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
3
|
require_relative 'base/cmd'
|
|
4
|
-
require_relative '../eval'
|
|
5
4
|
class Trepan::Command::PrCommand < Trepan::Command
|
|
6
5
|
|
|
7
6
|
unless defined?(HELP)
|
data/processor/command/quit.rb
CHANGED
|
@@ -51,6 +51,8 @@ See also the commands "exit" and "kill".
|
|
|
51
51
|
|
|
52
52
|
exitrc = (args.size > 1) ? exitrc = Integer(args[1]) rescue 0 : 0
|
|
53
53
|
# No graceful way to stop threads...
|
|
54
|
+
@proc.finalize
|
|
55
|
+
@proc.dbgr.intf[-1].finalize
|
|
54
56
|
exit exitrc
|
|
55
57
|
end
|
|
56
58
|
end
|
|
@@ -58,7 +60,6 @@ end
|
|
|
58
60
|
if __FILE__ == $0
|
|
59
61
|
require_relative '../mock'
|
|
60
62
|
dbgr, cmd = MockDebugger::setup
|
|
61
|
-
name = File.basename(__FILE__, '.rb')
|
|
62
63
|
fork { cmd.run([cmd.name]) }
|
|
63
64
|
cmd.run([cmd.name, '5'])
|
|
64
65
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require_relative '../base/subcmd'
|
|
4
|
+
|
|
5
|
+
class Trepan::Subcommand::SetAbbrev < Trepan::SetBoolSubcommand
|
|
6
|
+
unless defined?(HELP)
|
|
7
|
+
HELP = "Set to allow unique abbreviations of commands"
|
|
8
|
+
IN_LIST = true
|
|
9
|
+
MIN_ABBREV = 'ab'.size
|
|
10
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if __FILE__ == $0
|
|
16
|
+
# Demo it.
|
|
17
|
+
$0 = __FILE__ + 'notagain' # So we don't run this again
|
|
18
|
+
require_relative '../../mock'
|
|
19
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetAbbrev, false)
|
|
20
|
+
cmd.run(cmd.prefix + ['off'])
|
|
21
|
+
cmd.run(cmd.prefix + ['ofn'])
|
|
22
|
+
cmd.run(cmd.prefix)
|
|
23
|
+
puts cmd.save_command
|
|
24
|
+
end
|
|
@@ -4,6 +4,7 @@ require_relative '../../base/subsubcmd'
|
|
|
4
4
|
|
|
5
5
|
class Trepan::SubSubcommand::SetAutoEval < Trepan::SetBoolSubSubcommand
|
|
6
6
|
unless defined?(HELP)
|
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
7
8
|
HELP = "Evaluate unrecognized debugger commands.
|
|
8
9
|
|
|
9
10
|
Often inside the debugger, one would like to be able to run arbitrary
|
|
@@ -35,8 +36,6 @@ problem. Another possibility is to go into a real Ruby shell via the
|
|
|
35
36
|
'irb' command.
|
|
36
37
|
"
|
|
37
38
|
MIN_ABBREV = 'ev'.size
|
|
38
|
-
NAME = File.basename(__FILE__, '.rb')
|
|
39
|
-
PREFIX = %W(set auto #{NAME})
|
|
40
39
|
SHORT_HELP = "Set evaluation of unrecognized debugger commands"
|
|
41
40
|
end
|
|
42
41
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
3
|
require_relative '../../base/subsubcmd'
|
|
4
4
|
|
|
5
5
|
class Trepan::Subcommand::SetAutoIrb < Trepan::SetBoolSubSubcommand
|
|
6
6
|
unless defined?(HELP)
|
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
7
8
|
HELP = "Set to automatically go into irb each time we enter the debugger"
|
|
8
9
|
MIN_ABBREV = 'ir'.size
|
|
9
|
-
NAME = File.basename(__FILE__, '.rb')
|
|
10
|
-
PREFIX = %W(set auto #{NAME})
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
def run(args)
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
3
|
require_relative '../../base/subsubcmd'
|
|
4
4
|
|
|
5
5
|
class Trepan::Subcommand::SetAutoList < Trepan::SetBoolSubSubcommand
|
|
6
6
|
unless defined?(HELP)
|
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
7
8
|
HELP = "Set to run a 'list' command each time we enter the debugger"
|
|
8
9
|
MIN_ABBREV = 'l'.size
|
|
9
|
-
NAME = File.basename(__FILE__, '.rb')
|
|
10
|
-
PREFIX = %w(set auto list)
|
|
11
10
|
SHORT_HELP = "Set running a 'list' command each time we enter the debugger"
|
|
12
11
|
end
|
|
13
12
|
|
|
@@ -5,13 +5,19 @@ require_relative '../base/subcmd'
|
|
|
5
5
|
class Trepan::Subcommand::SetHighlight < Trepan::SetBoolSubcommand
|
|
6
6
|
unless defined?(HELP)
|
|
7
7
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
8
|
-
HELP = 'Set whether we use
|
|
8
|
+
HELP = 'Set whether we use terminal highlighting'
|
|
9
9
|
IN_LIST = true
|
|
10
|
-
MIN_ABBREV = '
|
|
10
|
+
MIN_ABBREV = 'hi'.size
|
|
11
11
|
end
|
|
12
|
+
|
|
13
|
+
def complete(prefix)
|
|
14
|
+
Trepan::Complete.complete_token(%w(on off reset), prefix)
|
|
15
|
+
end
|
|
16
|
+
|
|
12
17
|
def run(args)
|
|
13
18
|
if args.size == 3 && 'reset' == args[2]
|
|
14
19
|
LineCache::clear_file_format_cache
|
|
20
|
+
@proc.settings[:highlight] = :term
|
|
15
21
|
else
|
|
16
22
|
super
|
|
17
23
|
@proc.settings[:highlight] = :term if @proc.settings[:highlight]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require_relative '../base/subcmd'
|
|
4
|
+
|
|
5
|
+
class Trepan::Subcommand::SetReload < Trepan::SetBoolSubcommand
|
|
6
|
+
unless defined?(HELP)
|
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
8
|
+
SHORT_HELP = "Set whether to reread source text when it changes."
|
|
9
|
+
IN_LIST = true
|
|
10
|
+
MIN_ABBREV = 're'.size
|
|
11
|
+
HELP = <<-EOH
|
|
12
|
+
#{CMD} {on|off}
|
|
13
|
+
|
|
14
|
+
Source text is cached on the first read. This ensures that if you
|
|
15
|
+
change the source text after the debugged program is runnning you will
|
|
16
|
+
still see the source code as pertains to the running program rather
|
|
17
|
+
than what is in the filesystem.
|
|
18
|
+
|
|
19
|
+
However sometimes this may not be what you want. In particular in running
|
|
20
|
+
Ruby on Rails in development, Rails will also detect file changes and
|
|
21
|
+
will reload the source code. So here the debugger will be out of sync.
|
|
22
|
+
|
|
23
|
+
Set this to true, and the debugger will notice such changes and reread
|
|
24
|
+
the source text when it discovers it has changed.
|
|
25
|
+
|
|
26
|
+
See also "info source" and "info files" and note the SHA1
|
|
27
|
+
and file modification time.
|
|
28
|
+
EOH
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
if __FILE__ == $0
|
|
33
|
+
# Demo it.
|
|
34
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
|
35
|
+
require_relative '../../mock'
|
|
36
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetReload, false)
|
|
37
|
+
cmd.run(cmd.prefix + ['off'])
|
|
38
|
+
cmd.run(cmd.prefix + ['ofn'])
|
|
39
|
+
cmd.run(cmd.prefix)
|
|
40
|
+
puts cmd.save_command
|
|
41
|
+
end
|
|
@@ -5,7 +5,8 @@ require_relative '../base/subsubcmd'
|
|
|
5
5
|
class Trepan::Subcommand::SetTimer < Trepan::SetBoolSubcommand
|
|
6
6
|
unless defined?(HELP)
|
|
7
7
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
8
|
-
HELP
|
|
8
|
+
HELP = <<-EOH
|
|
9
|
+
#{PREFIX.join(' ')} [on|off]
|
|
9
10
|
|
|
10
11
|
Tracks and shows elapsed time between debugger events.
|
|
11
12
|
|
|
@@ -24,7 +25,7 @@ Buy turning this setting on, you may be able to get a feel for what
|
|
|
24
25
|
how expensive the various settings.
|
|
25
26
|
|
|
26
27
|
See also: 'set events', 'set trace buffer', 'step', and 'break'.
|
|
27
|
-
|
|
28
|
+
EOH
|
|
28
29
|
|
|
29
30
|
MIN_ABBREV = 'ti'.size
|
|
30
31
|
SHORT_HELP = "Set to show elapsed time between debugger events"
|
|
@@ -46,22 +47,11 @@ end
|
|
|
46
47
|
if __FILE__ == $0
|
|
47
48
|
# Demo it.
|
|
48
49
|
require_relative '../../mock'
|
|
49
|
-
require_relative '../../subcmd'
|
|
50
50
|
require_relative '../../hook'
|
|
51
|
-
name = File.basename(__FILE__, '.rb')
|
|
52
|
-
|
|
53
|
-
# FIXME: DRY the below code
|
|
54
|
-
dbgr, set_cmd = MockDebugger::setup('set')
|
|
55
|
-
subcommand = Trepan::Subcommand::SetTimer.new(set_cmd)
|
|
56
|
-
testcmdMgr = Trepan::Subcmd.new(subcommand)
|
|
57
|
-
|
|
58
|
-
subcommand.run_show_bool
|
|
59
|
-
subcommand.summary_help(name)
|
|
60
|
-
|
|
61
|
-
# require 'trepanning'
|
|
62
|
-
# Trepan.debug
|
|
63
|
-
subcommand.run(['set', name])
|
|
64
|
-
subcommand.run(['set', name, 'off'])
|
|
65
|
-
subcommand.run(['set', name, 'on'])
|
|
66
51
|
|
|
52
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::SetTimer)
|
|
53
|
+
cmd.run(cmd.prefix)
|
|
54
|
+
%w(off on).each do |arg|
|
|
55
|
+
cmd.run(cmd.prefix + [arg])
|
|
56
|
+
end
|
|
67
57
|
end
|
|
@@ -8,8 +8,8 @@ class Trepan::SubSubcommand::SetTrace < Trepan::SubSubcommandMgr
|
|
|
8
8
|
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
9
9
|
HELP = "Set tracing of various sorts.
|
|
10
10
|
|
|
11
|
-
The types of tracing include
|
|
12
|
-
|
|
11
|
+
The types of tracing include events from the trace buffer, or printing
|
|
12
|
+
those events.
|
|
13
13
|
|
|
14
14
|
See 'help #{PREFIX.join(' ')} *' for a list of subcommands or 'help set trace
|
|
15
15
|
<name>' for help on a particular trace subcommand."
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
3
|
require_relative '../../base/subsubcmd'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
class Trepan::SubSubcommand::SetTraceBuffer < Trepan::SetBoolSubSubcommand
|
|
6
|
-
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
|
7
6
|
unless defined?(HELP)
|
|
7
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
|
8
8
|
HELP = <<-EOH
|
|
9
9
|
#{CMD} [on|off|1|0]
|
|
10
10
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
3
|
require_relative '../../base/subsubcmd'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
class Trepan::SubSubcommand::SetTracePrint < Trepan::SetBoolSubSubcommand
|
|
6
|
-
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
|
7
6
|
unless defined?(HELP)
|
|
7
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
|
8
8
|
HELP = <<-EOH
|
|
9
|
-
|
|
9
|
+
#{CMD} [on|off|1|0]
|
|
10
10
|
|
|
11
11
|
Set printing trace events.
|
|
12
12
|
EOH
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
2
2
|
require 'irb'
|
|
3
3
|
require_relative 'base/cmd'
|
|
4
4
|
require_relative '../../app/irb'
|
|
5
5
|
class Trepan::Command::IRBCommand < Trepan::Command
|
|
6
6
|
|
|
7
7
|
unless defined?(HELP)
|
|
8
|
-
NAME
|
|
8
|
+
NAME = File.basename(__FILE__, '.rb')
|
|
9
9
|
HELP = <<-HELP
|
|
10
|
-
#{NAME} [-d]
|
|
10
|
+
#{NAME} [-d]
|
|
11
|
+
|
|
12
|
+
Start an Interactive Ruby (IRB) session.
|
|
11
13
|
|
|
12
14
|
If -d is added you can get access to debugger frame the global variables
|
|
13
15
|
$trepan_frame and $trepan_cmdproc.
|
|
@@ -32,9 +34,10 @@ Here then is a loop to query VM stack values:
|
|
|
32
34
|
(-1..1).each {|i| dbgr(\"info reg sp \#{i}\")}
|
|
33
35
|
HELP
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
ALIASES = %w(irb)
|
|
38
|
+
CATEGORY = 'support'
|
|
39
|
+
MAX_ARGS = 1 # Need at most this many
|
|
40
|
+
SHORT_HELP = "Run #{NAME} as a command subshell"
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
# This method runs the command
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require_relative '../base/subcmd'
|
|
4
|
+
|
|
5
|
+
class Trepan::Subcommand::ShowAbbrev < Trepan::ShowBoolSubcommand
|
|
6
|
+
unless defined?(HELP)
|
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
8
|
+
HELP = "Show whether we allow abbreviate debugger command names"
|
|
9
|
+
MIN_ABBREV = 'ab'.size
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
if __FILE__ == $0
|
|
15
|
+
# Demo it.
|
|
16
|
+
$0 = __FILE__ + 'notagain' # So we don't run this agin
|
|
17
|
+
require_relative '../../mock'
|
|
18
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowAbbrev)
|
|
19
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
|
3
|
+
require_relative '../base/subcmd'
|
|
4
|
+
|
|
5
|
+
class Trepan::Subcommand::ShowDirectories < Trepan::Subcommand
|
|
6
|
+
unless defined?(HELP)
|
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
|
8
|
+
HELP = "Show current search path for finding source files"
|
|
9
|
+
MIN_ABBREV = 'dir'.size
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def run(args)
|
|
13
|
+
msg "Source directories searched: #{settings[:directory]}"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
if __FILE__ == $0 && caller.size == 0
|
|
18
|
+
# Demo it.
|
|
19
|
+
require_relative '../../mock'
|
|
20
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowDirectories)
|
|
21
|
+
end
|