trepanning 0.1.0 → 0.1.1
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 +4 -0
- data/ChangeLog +1279 -235
- data/Makefile +13 -0
- data/NEWS +30 -0
- data/Rakefile +50 -14
- data/app/.gitignore +1 -0
- data/app/breakpoint.rb +7 -2
- data/app/brkptmgr.rb +12 -0
- data/app/cmd_parse.citrus +167 -0
- data/app/cmd_parse.kpeg +221 -0
- data/app/cmd_parse.rb +201 -0
- data/app/cmd_parser.rb +1914 -0
- data/app/complete.rb +79 -0
- data/app/condition.rb +1 -1
- data/app/core.rb +7 -11
- data/app/default.rb +1 -1
- data/app/disassemble.rb +3 -2
- data/app/file.rb +12 -36
- data/app/frame.rb +3 -2
- data/app/irb.rb +9 -5
- data/app/iseq.rb +46 -0
- data/app/options.rb +6 -30
- data/app/run.rb +5 -2
- data/app/util.rb +1 -2
- data/app/yarv.rb +11 -1
- data/bin/.gitignore +1 -0
- data/bin/trepan +6 -6
- data/data/.gitignore +1 -0
- data/interface/.gitignore +1 -0
- data/interface/base_intf.rb +9 -5
- data/interface/comcodes.rb +10 -8
- data/interface/user.rb +76 -17
- data/io/.gitignore +1 -0
- data/io/input.rb +39 -15
- data/io/tcpclient.rb +7 -1
- data/io/tcpfns.rb +5 -3
- data/io/tcpserver.rb +13 -10
- data/lib/.gitignore +1 -0
- data/lib/trepanning.rb +50 -13
- data/processor/.gitignore +1 -0
- data/processor/Makefile +7 -0
- data/processor/breakpoint.rb +7 -2
- data/processor/command/.gitignore +1 -0
- data/processor/command/Makefile +7 -0
- data/processor/command/alias.rb +2 -2
- data/processor/command/backtrace.rb +4 -0
- data/processor/command/base/cmd.rb +45 -2
- data/processor/command/base/subcmd.rb +4 -2
- data/processor/command/base/submgr.rb +23 -19
- data/processor/command/base/subsubcmd.rb +23 -1
- data/processor/command/base/subsubmgr.rb +13 -0
- data/processor/command/break.rb +34 -29
- data/processor/command/complete.rb +37 -0
- data/processor/command/condition.rb +2 -0
- data/processor/command/continue.rb +15 -18
- data/processor/command/disassemble.rb +5 -0
- data/processor/command/down.rb +1 -1
- data/processor/command/eval.rb +70 -0
- data/processor/command/exit.rb +4 -1
- data/processor/command/finish.rb +6 -4
- data/processor/command/frame.rb +6 -3
- data/processor/command/help.rb +97 -54
- data/processor/command/help/.gitignore +1 -0
- data/processor/command/help/README +10 -0
- data/processor/command/help/command.txt +48 -0
- data/processor/command/help/filename.txt +40 -0
- data/processor/command/help/location.txt +37 -0
- data/processor/command/info_subcmd/.gitignore +1 -0
- data/processor/command/info_subcmd/breakpoints.rb +9 -9
- data/processor/command/info_subcmd/{file.rb → files.rb} +92 -27
- data/processor/command/info_subcmd/frame.rb +41 -15
- data/processor/command/info_subcmd/iseq.rb +39 -17
- data/processor/command/info_subcmd/program.rb +2 -8
- data/processor/command/info_subcmd/registers.rb +12 -10
- data/processor/command/info_subcmd/registers_subcmd/.gitignore +1 -0
- data/processor/command/info_subcmd/ruby.rb +60 -0
- data/processor/command/irb.rb +26 -3
- data/processor/command/kill.rb +21 -10
- data/processor/command/list.rb +1 -1
- data/processor/command/macro.rb +37 -23
- data/processor/command/pr.rb +1 -1
- data/processor/command/reload.rb +4 -0
- data/processor/command/reload_subcmd/.gitignore +1 -0
- data/processor/command/restart.rb +9 -9
- data/processor/command/save.rb +29 -36
- data/processor/command/set_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/auto_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/confirm.rb +23 -0
- data/processor/command/set_subcmd/debug_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/different.rb +2 -0
- data/processor/command/set_subcmd/events.rb +2 -0
- data/processor/command/set_subcmd/max.rb +9 -12
- data/processor/command/set_subcmd/max_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/substitute_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/trace.rb +7 -13
- data/processor/command/set_subcmd/trace_subcmd/.gitignore +1 -0
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +12 -27
- data/processor/command/set_subcmd/trace_subcmd/print.rb +10 -8
- data/processor/command/set_subcmd/trace_subcmd/var.rb +6 -10
- data/processor/command/show.rb +12 -1
- data/processor/command/show_subcmd/.gitignore +1 -0
- data/processor/command/show_subcmd/alias.rb +11 -15
- data/processor/command/show_subcmd/auto_subcmd/.gitignore +1 -0
- data/processor/command/show_subcmd/basename.rb +1 -9
- data/processor/command/show_subcmd/confirm.rb +25 -0
- data/processor/command/show_subcmd/debug_subcmd/.gitignore +1 -0
- data/processor/command/show_subcmd/macro.rb +32 -14
- data/processor/command/show_subcmd/max_subcmd/.gitignore +1 -0
- data/processor/command/show_subcmd/trace_subcmd/.gitignore +1 -0
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +11 -31
- data/processor/command/show_subcmd/trace_subcmd/print.rb +4 -20
- data/processor/command/source.rb +7 -1
- data/processor/command/up.rb +7 -4
- data/processor/default.rb +3 -1
- data/processor/eval.rb +13 -0
- data/processor/eventbuf.rb +3 -2
- data/processor/frame.rb +19 -0
- data/processor/help.rb +20 -0
- data/processor/load_cmds.rb +143 -24
- data/processor/location.rb +61 -10
- data/processor/main.rb +30 -11
- data/processor/mock.rb +5 -3
- data/processor/msg.rb +17 -0
- data/processor/running.rb +1 -1
- data/processor/subcmd.rb +3 -2
- data/processor/validate.rb +173 -185
- data/sample/.gitignore +1 -0
- data/sample/list-terminal-colors.rb +139 -0
- data/sample/rocky-dot-trepanrc +14 -0
- data/sample/rocky-trepan-colors.rb +47 -0
- data/test/Makefile +7 -0
- data/test/data/.gitignore +1 -0
- data/test/data/debugger-stop.cmd +3 -0
- data/test/data/debugger-stop.right +5 -0
- data/test/data/fname-with-blank.right +0 -3
- data/test/data/quit.right +0 -1
- data/test/data/quit2.cmd +6 -0
- data/test/data/quit2.right +3 -0
- data/test/data/testing.cmd +1 -0
- data/test/example/.gitignore +1 -0
- data/test/example/debugger-stop.rb +14 -0
- data/test/functional/.gitignore +2 -0
- data/test/functional/fn_helper.rb +7 -9
- data/test/functional/test-break-long.rb +7 -7
- data/test/functional/test-break.rb +7 -7
- data/test/functional/test-condition.rb +4 -4
- data/test/functional/test-delete.rb +6 -5
- data/test/functional/test-eval.rb +115 -0
- data/test/functional/test-raise.rb +1 -1
- data/test/functional/test-return.rb +1 -1
- data/test/integration/.gitignore +2 -0
- data/test/integration/helper.rb +6 -3
- data/test/integration/test-debugger-stop.rb +22 -0
- data/test/integration/test-quit.rb +8 -0
- data/test/unit/.gitignore +1 -0
- data/test/unit/Makefile +7 -0
- data/test/unit/test-app-brkpt.rb +0 -1
- data/test/unit/test-app-cmd_parse.rb +107 -0
- data/test/unit/test-app-cmd_parser.rb +22 -0
- data/test/unit/test-app-complete.rb +38 -0
- data/test/unit/test-app-condition.rb +20 -0
- data/test/unit/test-app-iseq.rb +31 -0
- data/test/unit/test-app-options.rb +9 -1
- data/test/unit/test-app-util.rb +0 -1
- data/test/unit/test-base-cmd.rb +46 -0
- data/test/unit/test-base-subcmd.rb +11 -2
- data/test/unit/test-base-submgr.rb +23 -0
- data/test/unit/test-base-subsubcmd.rb +20 -0
- data/test/unit/test-cmd-break.rb +22 -23
- data/test/unit/test-cmd-help.rb +4 -0
- data/test/unit/test-completion.rb +43 -0
- data/test/unit/test-io-tcpclient.rb +3 -2
- data/test/unit/test-proc-load_cmds.rb +10 -1
- data/test/unit/test-proc-location.rb +39 -0
- data/test/unit/test-proc-main.rb +1 -1
- data/test/unit/test-proc-validate.rb +47 -31
- data/trepanning.gemspec +45 -0
- metadata +247 -179
- data/app/core.rb-consider +0 -198
- data/test/functional/tmp/b3.rb +0 -5
- data/test/functional/tmp/immediate-bug1.rb +0 -9
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -1,5 +1,5 @@
|
|
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
4
|
require_relative '../../app/run'
|
5
5
|
class Trepan::Command::RestartCommand < Trepan::Command
|
@@ -25,19 +25,19 @@ new copy of the debugger is used.
|
|
25
25
|
dbgr = @proc.dbgr
|
26
26
|
argv = dbgr.restart_argv
|
27
27
|
if argv and argv.size > 0
|
28
|
-
# unless File.executable?(argv[0])
|
29
|
-
# msg(["File #{argv[0]} not executable.",
|
30
|
-
# "Adding Ruby interpreter."])
|
31
|
-
# argv.unshift Trepanning::ruby_path
|
32
|
-
# end
|
33
28
|
@proc.run_cmd(%w(show args))
|
34
29
|
if not confirm('Restart (exec)?', false)
|
35
30
|
msg "Restart not confirmed"
|
36
31
|
else
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
if defined?(Trepan::PROG_UNRESOLVED_SCRIPT) &&
|
33
|
+
position = argv.index(Trepan::PROG_UNRESOLVED_SCRIPT)
|
34
|
+
save_filename = @proc.save_commands(:erase =>true)
|
35
|
+
argv.insert(position, '--command', save_filename) if save_filename
|
36
|
+
end
|
40
37
|
Dir.chdir(RubyVM::OS_STARTUP_DIR)
|
38
|
+
msg 'Restarting using...'
|
39
|
+
msg "\t #{argv.inspect}"
|
40
|
+
@proc.finalize
|
41
41
|
exec(*argv)
|
42
42
|
end
|
43
43
|
else
|
data/processor/command/save.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative 'base/cmd'
|
4
4
|
class Trepan::Command::SaveCommand < Trepan::Command
|
5
5
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
NAME = File.basename(__FILE__, '.rb')
|
8
8
|
HELP = <<-HELP
|
9
|
-
#{NAME} [
|
9
|
+
#{NAME} [--[no-]erase] [--output|-o FILENAME]
|
10
10
|
|
11
11
|
Save settings to file FILENAME. If FILENAME not given one will be made
|
12
12
|
selected.
|
@@ -15,49 +15,42 @@ selected.
|
|
15
15
|
CATEGORY = 'running'
|
16
16
|
MAX_ARGS = 1 # Need at most this many
|
17
17
|
SHORT_HELP = 'Send debugger state to a file'
|
18
|
+
|
19
|
+
DEFAULT_OPTIONS = { :erase => true, }
|
18
20
|
end
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@proc.settings[:save_cmdfile] ||
|
27
|
-
File.join(Dir.tmpdir,
|
28
|
-
Dir::Tmpname.make_tmpname(['trepanning-save', '.txt'], nil))
|
22
|
+
def parse_options(options, args) # :nodoc
|
23
|
+
parser = OptionParser.new do |opts|
|
24
|
+
opts.on("-e", "--[no-]erase",
|
25
|
+
"Add line to erase after reading") do
|
26
|
+
|v|
|
27
|
+
options[:erase] = v
|
29
28
|
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
errmsg("System reports: #{exc.inspect}")
|
35
|
-
return
|
36
|
-
end
|
37
|
-
save_file.puts "#\n# Commands to restore trepanning environment\n#\n"
|
38
|
-
@proc.commands.each do |cmd_name, cmd_obj|
|
39
|
-
cmd_obj.save_command if cmd_obj.respond_to?(:save_command)
|
40
|
-
next unless cmd_obj.is_a?(Trepan::SubcommandMgr)
|
41
|
-
cmd_obj.subcmds.subcmds.each do |subcmd_name, subcmd_obj|
|
42
|
-
save_file.puts subcmd_obj.save_command if
|
43
|
-
subcmd_obj.respond_to?(:save_command)
|
44
|
-
next unless subcmd_obj.is_a?(Trepan::SubSubcommandMgr)
|
45
|
-
subcmd_obj.subcmds.subcmds.each do |subsubcmd_name, subsubcmd_obj|
|
46
|
-
save_file.puts subsubcmd_obj.save_command if
|
47
|
-
subsubcmd_obj.respond_to?(:save_command)
|
48
|
-
end
|
29
|
+
opts.on("-o", "--output FILE", String,
|
30
|
+
"Save file to FILE. ") do
|
31
|
+
|filename|
|
32
|
+
options[:filename] = filename
|
49
33
|
end
|
50
34
|
end
|
51
|
-
|
52
|
-
|
35
|
+
parser.parse(args)
|
36
|
+
return options
|
37
|
+
end
|
38
|
+
|
39
|
+
# This method runs the command
|
40
|
+
def run(args)
|
41
|
+
options = parse_options(DEFAULT_OPTIONS.dup, args[1..-1])
|
42
|
+
save_filename = @proc.save_commands(options)
|
43
|
+
msg "Debugger commands written to file: #{save_filename}" if
|
44
|
+
save_filename
|
53
45
|
end
|
54
46
|
end
|
55
47
|
|
56
48
|
if __FILE__ == $0
|
57
49
|
require_relative '../mock'
|
58
50
|
dbgr, cmd = MockDebugger::setup
|
59
|
-
require 'tmpdir'
|
60
|
-
cmd.run([cmd.name, Dir.tmpdir])
|
61
51
|
cmd.run([cmd.name])
|
62
|
-
|
52
|
+
# require_relative '../../lib/trepanning'; debugger
|
53
|
+
cmd.run([cmd.name, '--erase',
|
54
|
+
'--output', File.join(Dir.tmpdir, 'save_file.txt')])
|
55
|
+
# A good test would be to see we can read in those files without error.
|
63
56
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../base/subcmd'
|
4
|
+
|
5
|
+
class Trepan::Subcommand::SetConfirm < Trepan::SetBoolSubcommand
|
6
|
+
unless defined?(HELP)
|
7
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
8
|
+
HELP = "Set whether to confirm potentially dangerous operations."
|
9
|
+
IN_LIST = true
|
10
|
+
MIN_ABBREV = 'co'.size
|
11
|
+
end
|
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::SetConfirm, false)
|
19
|
+
cmd.run(cmd.prefix + ['off'])
|
20
|
+
cmd.run(cmd.prefix + ['ofn'])
|
21
|
+
cmd.run(cmd.prefix)
|
22
|
+
puts cmd.save_command
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -25,6 +25,8 @@ Examples:
|
|
25
25
|
SHORT_HELP = 'Set trace events we may stop on.'
|
26
26
|
end
|
27
27
|
|
28
|
+
completion Trace.const_get("EVENTS").map{|event| event.to_s}
|
29
|
+
|
28
30
|
def save_command
|
29
31
|
step_events_list = @proc.core.step_events_list
|
30
32
|
step_events_list = 'brkpt' unless step_events_list
|
@@ -18,17 +18,14 @@ class Trepan::SubSubcommand::SetMax < Trepan::SubSubcommandMgr
|
|
18
18
|
end
|
19
19
|
|
20
20
|
if __FILE__ == $0
|
21
|
+
# Demo it.
|
21
22
|
require_relative '../../mock'
|
22
|
-
dbgr,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
command.run(cmd_args)
|
31
|
-
require_relative '../../../lib/trepanning'
|
32
|
-
# Trepan.debug
|
33
|
-
command.run(['set', name, 'string', 30])
|
23
|
+
dbgr, parent_cmd = MockDebugger::setup('set', false)
|
24
|
+
cmd = Trepan::SubSubcommand::SetMax.new(dbgr.core.processor,
|
25
|
+
parent_cmd)
|
26
|
+
cmd.run(cmd.prefix + ['string', '30'])
|
27
|
+
|
28
|
+
%w(s lis foo).each do |prefix|
|
29
|
+
p [prefix, cmd.complete(prefix)]
|
30
|
+
end
|
34
31
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -24,19 +24,13 @@ end
|
|
24
24
|
if __FILE__ == $0
|
25
25
|
# Demo it.
|
26
26
|
require_relative '../../mock'
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
command = Trepan::SubSubcommand::SetTrace.new(dbgr.core.processor,
|
34
|
-
set_cmd)
|
35
|
-
name = File.basename(__FILE__, '.rb')
|
36
|
-
cmd_args = ['set', name]
|
37
|
-
set_cmd.instance_variable_set('@last_args', cmd_args)
|
27
|
+
dbgr, cmd = MockDebugger::setup('set')
|
28
|
+
cmds = dbgr.core.processor.commands
|
29
|
+
set_cmd = cmds['set']
|
30
|
+
command = Trepan::SubSubcommand::SetTrace.new(dbgr.core.processor,
|
31
|
+
set_cmd)
|
32
|
+
set_cmd.instance_variable_set('@last_args', command.class.const_get('CMD'))
|
38
33
|
# require_relative '../../../lib/trepanning'
|
39
34
|
# Trepan.debug
|
40
|
-
command.run(
|
41
|
-
command.run(['set', name, '*'])
|
35
|
+
command.run(command.class.const_get('PREFIX'))
|
42
36
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -1,17 +1,16 @@
|
|
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
|
require_relative '../trace'
|
5
5
|
class Trepan::SubSubcommand::SetTraceBuffer < Trepan::SetBoolSubSubcommand
|
6
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
6
7
|
unless defined?(HELP)
|
7
|
-
HELP =
|
8
|
-
|
8
|
+
HELP = <<-EOH
|
9
|
+
#{CMD} [on|off|1|0]
|
9
10
|
|
10
11
|
Set saving trace events in a buffer
|
11
|
-
|
12
|
+
EOH
|
12
13
|
MIN_ABBREV = 'b'.size
|
13
|
-
NAME = File.basename(__FILE__, '.rb')
|
14
|
-
PREFIX = %w(set trace buffer)
|
15
14
|
SHORT_HELP = 'Set saving trace events in a buffer'
|
16
15
|
end
|
17
16
|
|
@@ -31,26 +30,12 @@ end
|
|
31
30
|
if __FILE__ == $0
|
32
31
|
# Demo it.
|
33
32
|
require_relative '../../../mock'
|
34
|
-
require_relative '
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# FIXME: remove the 'join' below
|
43
|
-
cmd_name = Trepan::SubSubcommand::SetTraceBuffer::PREFIX.join('')
|
44
|
-
subcmd = Trepan::SubSubcommand::SetTraceBuffer.new(set_cmd.proc,
|
45
|
-
trace_cmd,
|
46
|
-
cmd_name)
|
47
|
-
# require_relative '../../../../lib/trepanning'
|
48
|
-
# dbgr = Trepan.new
|
49
|
-
# dbgr.debugger
|
50
|
-
|
51
|
-
subcmd.run([cmd_name])
|
52
|
-
%w(off on 1 0).each { |arg| subcmd.run([cmd_name, arg]) }
|
53
|
-
puts subcmd.save_command()
|
54
|
-
|
33
|
+
require_relative '../trace'
|
34
|
+
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetTrace,
|
35
|
+
Trepan::SubSubcommand::SetTraceBuffer)
|
36
|
+
%w(off on 1 0).each do |arg|
|
37
|
+
cmd.run([cmd.name, arg])
|
38
|
+
end
|
39
|
+
puts cmd.save_command()
|
55
40
|
end
|
56
41
|
|
@@ -1,17 +1,17 @@
|
|
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
|
require_relative '../trace'
|
5
5
|
class Trepan::SubSubcommand::SetTracePrint < Trepan::SetBoolSubSubcommand
|
6
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
6
7
|
unless defined?(HELP)
|
7
|
-
HELP =
|
8
|
-
"
|
8
|
+
HELP = <<-EOH
|
9
|
+
"#{CMD} [on|off|1|0]
|
9
10
|
|
10
|
-
Set printing trace events.
|
11
|
+
Set printing trace events.
|
12
|
+
EOH
|
11
13
|
|
12
14
|
MIN_ABBREV = 'p'.size
|
13
|
-
NAME = File.basename(__FILE__, '.rb')
|
14
|
-
PREFIX = %w(set trace print)
|
15
15
|
SHORT_HELP = 'Set print trace events'
|
16
16
|
end
|
17
17
|
|
@@ -32,7 +32,9 @@ if __FILE__ == $0
|
|
32
32
|
require_relative '../trace'
|
33
33
|
cmd = MockDebugger::subsub_setup(Trepan::SubSubcommand::SetTrace,
|
34
34
|
Trepan::SubSubcommand::SetTracePrint)
|
35
|
-
%w(off on 0
|
36
|
-
|
35
|
+
%w(off on 1 0).each do |arg|
|
36
|
+
cmd.run([cmd.name, arg])
|
37
|
+
end
|
38
|
+
puts cmd.save_command()
|
37
39
|
end
|
38
40
|
|
@@ -1,22 +1,22 @@
|
|
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
|
require_relative '../trace'
|
5
5
|
class Trepan::SubSubcommand::SetTraceVar < Trepan::SubSubcommand
|
6
|
+
Trepanning::SubSubcommand.set_name_prefix(__FILE__, self)
|
6
7
|
unless defined?(HELP)
|
7
|
-
HELP =
|
8
|
-
|
8
|
+
HELP = <<-EOH
|
9
|
+
#{CMD} var GLOBAL_VARIABLE
|
9
10
|
|
10
11
|
The debugger calls 'trace_var' to trace changes to the value of
|
11
12
|
GLOBAL_VARIABLE. Note in contrast to other events, stopping for
|
12
13
|
variable tracing occurs *after* the event, not before.
|
13
14
|
|
14
|
-
See also 'set events'.
|
15
|
+
See also 'set events'.
|
16
|
+
EOH
|
15
17
|
|
16
18
|
MIN_ABBREV = 'v'.size
|
17
|
-
NAME = File.basename(__FILE__, '.rb')
|
18
19
|
SHORT_HELP = "Set to display trace a global variable."
|
19
|
-
PREFIX = %w(set trace var)
|
20
20
|
end
|
21
21
|
|
22
22
|
def run(args)
|
@@ -39,7 +39,6 @@ if __FILE__ == $0
|
|
39
39
|
# Demo it.
|
40
40
|
require_relative '../../../mock'
|
41
41
|
require_relative '../../../subcmd'
|
42
|
-
name = File.basename(__FILE__, '.rb')
|
43
42
|
|
44
43
|
# FIXME: DRY the below code
|
45
44
|
dbgr, set_cmd = MockDebugger::setup('set')
|
@@ -54,8 +53,5 @@ if __FILE__ == $0
|
|
54
53
|
# dbgr = Trepan.new
|
55
54
|
# dbgr.debugger
|
56
55
|
eval('set_cmd.proc.frame_setup(RubyVM::ThreadFrame::current); setx_cmd.run([])')
|
57
|
-
|
58
|
-
# name = File.basename(__FILE__, '.rb')
|
59
|
-
# subcommand.summary_help(name)
|
60
56
|
end
|
61
57
|
|
data/processor/command/show.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
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/submgr'
|
4
4
|
|
5
5
|
class Trepan::Command::ShowCommand < Trepan::SubcommandMgr
|
@@ -18,6 +18,17 @@ Type "help #{NAME} *" for just a list of "#{NAME}" subcommands.
|
|
18
18
|
NEED_STACK = false
|
19
19
|
SHORT_HELP = 'Show parts of the debugger environment'
|
20
20
|
end
|
21
|
+
|
22
|
+
def run(args)
|
23
|
+
if args.size > 1
|
24
|
+
first = args[1].downcase
|
25
|
+
alen = 'auto'.size
|
26
|
+
args[1..1] = ['auto', first[alen..-1]] if
|
27
|
+
first.start_with?('auto') && first.size > alen
|
28
|
+
end
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
21
32
|
end
|
22
33
|
|
23
34
|
if __FILE__ == $0
|
@@ -0,0 +1 @@
|
|
1
|
+
/*~
|
@@ -3,17 +3,22 @@
|
|
3
3
|
require_relative '../base/subcmd'
|
4
4
|
|
5
5
|
class Trepan::Subcommand::ShowAlias < Trepan::Subcommand
|
6
|
+
Trepanning::Subcommand.set_name_prefix(__FILE__, self)
|
6
7
|
unless defined?(HELP)
|
7
|
-
|
8
|
-
|
8
|
+
HELP = <<-EOH
|
9
|
+
#{CMD} [NAME1 NAME2 ...]
|
9
10
|
|
10
11
|
If aliases names are given, show their definition. If left blank, show
|
11
|
-
all alias names
|
12
|
-
|
12
|
+
all alias names
|
13
|
+
EOH
|
13
14
|
MIN_ABBREV = 'al'.size
|
14
15
|
SHORT_HELP = "Show defined aliases"
|
15
16
|
end
|
16
17
|
|
18
|
+
def complete(prefix)
|
19
|
+
Trepan::Complete.complete_token(@proc.aliases.keys, prefix)
|
20
|
+
end
|
21
|
+
|
17
22
|
def run(args)
|
18
23
|
if args.size > 2
|
19
24
|
args[2..-1].each do |alias_name|
|
@@ -35,15 +40,6 @@ end
|
|
35
40
|
if __FILE__ == $0
|
36
41
|
# Demo it.
|
37
42
|
require_relative '../../mock'
|
38
|
-
|
39
|
-
|
40
|
-
# FIXME: DRY the below code
|
41
|
-
dbgr, cmd = MockDebugger::setup('show')
|
42
|
-
subcommand = Trepan::Subcommand::ShowAlias.new(cmd)
|
43
|
-
|
44
|
-
name = File.basename(__FILE__, '.rb')
|
45
|
-
subcommand.summary_help(name)
|
46
|
-
puts
|
47
|
-
subcommand.run(%W(show #{name}))
|
48
|
-
subcommand.run(%w(show #{name} u foo))
|
43
|
+
cmd = MockDebugger::sub_setup(Trepan::Subcommand::ShowAlias)
|
44
|
+
cmd.run(cmd.prefix + %w(u foo))
|
49
45
|
end
|