trepanning 0.1.3 → 0.1.4
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 +465 -0
- data/NEWS +26 -1
- data/README.textile +1 -1
- data/app/cmd_parse.kpeg +2 -1
- data/app/cmd_parser.rb +30 -3
- data/app/core.rb +1 -1
- data/app/display.rb +39 -1
- data/app/frame.rb +1 -1
- data/app/irb.rb +42 -40
- data/app/options.rb +3 -2
- data/app/run.rb +21 -7
- data/app/util.rb +12 -2
- data/app/yarv.rb +0 -2
- data/bin/trepan +2 -3
- data/data/perldb.bindings +17 -0
- data/interface/script.rb +1 -1
- data/interface/server.rb +1 -1
- data/interface/user.rb +3 -1
- data/{interface/base_intf.rb → interface.rb} +1 -1
- data/io/input.rb +1 -3
- data/io/null_output.rb +1 -1
- data/io/string_array.rb +1 -2
- data/io/tcpclient.rb +1 -1
- data/io/tcpserver.rb +1 -1
- data/{io/base_io.rb → io.rb} +0 -0
- data/lib/trepanning.rb +2 -1
- data/processor/command/alias.rb +15 -4
- data/processor/command/backtrace.rb +2 -2
- data/processor/command/base/subcmd.rb +1 -5
- data/processor/command/base/submgr.rb +1 -1
- data/processor/command/base/subsubcmd.rb +1 -1
- data/processor/command/base/subsubmgr.rb +4 -4
- data/processor/command/break.rb +1 -1
- data/processor/command/complete.rb +1 -1
- data/processor/command/condition.rb +2 -2
- data/processor/command/continue.rb +1 -1
- data/processor/command/debug.rb +1 -1
- data/processor/command/delete.rb +10 -7
- data/processor/command/directory.rb +1 -1
- data/processor/command/disable.rb +25 -19
- data/processor/command/disassemble.rb +1 -1
- data/processor/command/display.rb +35 -28
- data/processor/command/down.rb +8 -8
- data/processor/command/edit.rb +1 -1
- data/processor/command/enable.rb +10 -12
- data/processor/command/eval.rb +1 -1
- data/processor/command/exit.rb +1 -1
- data/processor/command/finish.rb +1 -1
- data/processor/command/frame.rb +2 -2
- data/processor/command/help.rb +6 -8
- data/processor/command/info.rb +2 -0
- data/processor/command/info_subcmd/files.rb +17 -11
- data/processor/command/info_subcmd/frame.rb +0 -1
- data/processor/command/info_subcmd/locals.rb +6 -73
- data/processor/command/info_subcmd/source.rb +10 -4
- data/processor/command/info_subcmd/variables.rb +34 -0
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +1 -0
- data/processor/command/info_subcmd/variables_subcmd/class.rb +40 -0
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +41 -0
- data/processor/command/info_subcmd/{globals.rb → variables_subcmd/globals.rb} +21 -16
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +41 -0
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +99 -0
- data/processor/command/kill.rb +9 -8
- data/processor/command/list.rb +9 -107
- data/processor/command/macro.rb +27 -9
- data/processor/command/next.rb +1 -1
- data/processor/command/nocache.rb +2 -2
- data/processor/command/parsetree.rb +1 -1
- data/processor/command/pp.rb +1 -1
- data/processor/command/pr.rb +1 -1
- data/processor/command/ps.rb +1 -1
- data/processor/command/quit.rb +18 -7
- data/processor/command/raise.rb +1 -1
- data/processor/command/reload.rb +10 -10
- data/processor/command/restart.rb +1 -1
- data/processor/command/save.rb +1 -1
- data/processor/command/server.rb +1 -1
- data/processor/command/set_subcmd/auto.rb +7 -1
- data/processor/command/set_subcmd/different.rb +5 -4
- data/processor/command/set_subcmd/substitute_subcmd/eval.rb +2 -2
- data/processor/command/set_subcmd/trace.rb +5 -4
- data/processor/command/set_subcmd/trace_subcmd/print.rb +4 -3
- data/processor/command/shell.rb +5 -3
- data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +2 -7
- data/processor/command/show_subcmd/trace_subcmd/print.rb +3 -3
- data/processor/command/show_subcmd/version.rb +24 -0
- data/processor/command/source.rb +1 -1
- data/processor/command/step.rb +1 -1
- data/processor/command/tbreak.rb +1 -1
- data/processor/command/unalias.rb +11 -6
- data/processor/command/undisplay.rb +14 -10
- data/processor/command/up.rb +12 -13
- data/processor/command/watchg.rb +1 -1
- data/processor/{command/base/cmd.rb → command.rb} +3 -2
- data/processor/display.rb +34 -0
- data/processor/frame.rb +2 -2
- data/processor/help.rb +6 -4
- data/processor/hook.rb +95 -96
- data/processor/list.rb +146 -0
- data/processor/location.rb +26 -0
- data/processor/mock.rb +4 -7
- data/processor/msg.rb +54 -42
- data/processor/running.rb +6 -3
- data/processor/subcmd.rb +16 -41
- data/processor/validate.rb +6 -9
- data/{processor/main.rb → processor.rb} +11 -40
- data/sample/rocky-trepan-colors.rb +0 -1
- data/test/data/enable.cmd +1 -1
- data/test/data/trace.cmd +6 -0
- data/test/data/trace.right +39 -0
- data/test/example/gcd.rb +0 -1
- data/test/functional/test-next.rb +1 -1
- data/test/integration/helper.rb +4 -0
- data/test/integration/test-trace.rb +18 -0
- data/test/unit/cmd-helper.rb +4 -4
- data/test/unit/test-app-cmd_parse.rb +1 -1
- data/test/unit/test-app-display.rb +22 -0
- data/test/unit/test-app-options.rb +14 -10
- data/test/unit/test-app-run.rb +7 -1
- data/test/unit/test-base-subcmd.rb +1 -1
- data/test/unit/test-cmd-kill.rb +11 -4
- data/test/unit/test-cmd-parse_list_cmd.rb +1 -1
- data/test/unit/{test-base-cmd.rb → test-command.rb} +1 -1
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-frame.rb +1 -2
- data/test/unit/test-proc-list.rb +52 -0
- data/test/unit/test-proc-load_cmds.rb +1 -1
- data/test/unit/test-proc-location.rb +11 -4
- data/test/unit/test-proc-main.rb +1 -1
- data/test/unit/test-proc-validate.rb +1 -2
- data/test/unit/test-subcmd-help.rb +1 -1
- data/trepanning.gemspec +1 -1
- metadata +26 -12
data/app/frame.rb
CHANGED
data/app/irb.rb
CHANGED
@@ -6,53 +6,55 @@ module IRB # :nodoc:
|
|
6
6
|
# FIXME: should we read these out of a directory to
|
7
7
|
# make this more user-customizable?
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
$trepan_irb_statements
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
unless defined? Continue
|
10
|
+
# A base command class that resume execution
|
11
|
+
class DebuggerResumeCommand
|
12
|
+
def self.execute(conf, *opts)
|
13
|
+
name =
|
14
|
+
if self.name =~ /IRB::ExtendCommand::(\S+)/
|
15
|
+
$1.downcase
|
16
|
+
else
|
17
|
+
'unknown'
|
18
|
+
end
|
19
|
+
$trepan_args = opts
|
20
|
+
$trepan_command =
|
21
|
+
if $trepan_irb_statements
|
22
|
+
$trepan_irb_statements
|
23
|
+
else
|
24
|
+
([name] + opts).join(' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
throw :IRB_EXIT, name.to_sym
|
28
|
+
end
|
27
29
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
30
|
+
|
31
|
+
class Continue < DebuggerResumeCommand ; end
|
32
|
+
class Finish < DebuggerResumeCommand ; end
|
33
|
+
class Next < DebuggerResumeCommand ; end
|
34
|
+
class Quit < DebuggerResumeCommand ; end
|
35
|
+
class Step < DebuggerResumeCommand ; end
|
36
|
+
|
37
|
+
# Issues a comamnd to the debugger without continuing
|
38
|
+
# execution.
|
39
|
+
class Dbgr
|
40
|
+
def self.execute(conf, *opts)
|
41
|
+
$trepan_command =
|
42
|
+
if opts.size == 1 && opts[0].is_a?(String)
|
43
|
+
$trepan_args = opts[0]
|
44
|
+
else
|
45
|
+
opts.join(' ')
|
46
|
+
end
|
47
|
+
# dbg_cmdproc = conf.workspace.instance_variable_get('@dbg_cmdproc')
|
48
|
+
if $trepan_cmdproc
|
49
|
+
$trepan_cmdproc.run_command($trepan_command)
|
43
50
|
else
|
44
|
-
|
51
|
+
puts "Something's wrong with debugger setup of irb"
|
45
52
|
end
|
46
|
-
dbg_cmdproc = conf.workspace.instance_variable_get('@dbg_cmdproc')
|
47
|
-
if dbg_cmdproc
|
48
|
-
dbg_cmdproc.run_command($trepan_command)
|
49
|
-
else
|
50
|
-
puts "Something's wrong with debugger setup of irb"
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
54
|
-
|
55
56
|
end
|
57
|
+
|
56
58
|
if defined?(ExtendCommandBundle)
|
57
59
|
# New irb Commands which are the same name as their debugger
|
58
60
|
# counterpart
|
data/app/options.rb
CHANGED
@@ -8,7 +8,7 @@ require 'optparse'
|
|
8
8
|
class Trepan
|
9
9
|
require_relative 'default'
|
10
10
|
|
11
|
-
VERSION = '0.1.
|
11
|
+
VERSION = '0.1.4'
|
12
12
|
PROGRAM = 'trepan'
|
13
13
|
|
14
14
|
def self.show_version
|
@@ -110,7 +110,8 @@ EOB
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
opts.on('-x', '--trace', 'Turn on line tracing') do
|
113
|
-
options[:
|
113
|
+
options[:traceprint] = true
|
114
|
+
options[:nx] = true
|
114
115
|
end
|
115
116
|
opts.separator ''
|
116
117
|
opts.on_tail('-?', '--help', 'Show this message') do
|
data/app/run.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 'rbconfig'
|
4
4
|
module Trepanning
|
5
5
|
|
@@ -9,17 +9,16 @@ module Trepanning
|
|
9
9
|
# The caller must ensure that ARGV is set up to remove any debugger
|
10
10
|
# arguments or things that the debugged program isn't supposed to
|
11
11
|
# see. FIXME: Should we make ARGV an explicit parameter?
|
12
|
-
def debug_program(dbgr,
|
12
|
+
def debug_program(dbgr, program_to_debug)
|
13
13
|
|
14
14
|
# Make sure Ruby script syntax checks okay.
|
15
15
|
# Otherwise we get a load message that looks like trepanning has
|
16
16
|
# a problem.
|
17
|
-
output =
|
18
|
-
if
|
17
|
+
output = ruby_syntax_errors(program_to_debug)
|
18
|
+
if output
|
19
19
|
puts output
|
20
20
|
exit $?.exitstatus
|
21
21
|
end
|
22
|
-
# print "\032\032starting\n" if Trepan.annotate and Trepan.annotate > 2
|
23
22
|
|
24
23
|
dbgr.trace_filter << self.method(:debug_program)
|
25
24
|
dbgr.trace_filter << Kernel.method(:load)
|
@@ -52,8 +51,9 @@ module Trepanning
|
|
52
51
|
# Do a shell-like path lookup for prog_script and return the results.
|
53
52
|
# If we can't find anything return prog_script.
|
54
53
|
def whence_file(prog_script)
|
55
|
-
if prog_script.
|
56
|
-
# Don't search since this name has path
|
54
|
+
if prog_script.start_with?(File::SEPARATOR) || prog_script.start_with?('.')
|
55
|
+
# Don't search since this name has path is explicitly absolute or
|
56
|
+
# relative.
|
57
57
|
return prog_script
|
58
58
|
end
|
59
59
|
for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do
|
@@ -63,6 +63,14 @@ module Trepanning
|
|
63
63
|
# Failure
|
64
64
|
return prog_script
|
65
65
|
end
|
66
|
+
|
67
|
+
def ruby_syntax_errors(prog_script)
|
68
|
+
output = `#{RbConfig.ruby} -c #{prog_script.inspect} 2>&1`
|
69
|
+
if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/
|
70
|
+
return output
|
71
|
+
end
|
72
|
+
return nil
|
73
|
+
end
|
66
74
|
end
|
67
75
|
|
68
76
|
if __FILE__ == $0
|
@@ -70,4 +78,10 @@ if __FILE__ == $0
|
|
70
78
|
include Trepanning
|
71
79
|
puts whence_file('irb')
|
72
80
|
puts whence_file('probably-does-not-exist')
|
81
|
+
puts RbConfig.ruby
|
82
|
+
puts "#{__FILE__} is syntactically correct" unless
|
83
|
+
ruby_syntax_errors(__FILE__)
|
84
|
+
readme = File.join(File.dirname(__FILE__), '..', 'README.textile')
|
85
|
+
puts "#{readme} is not syntactically correct" if
|
86
|
+
ruby_syntax_errors(readme)
|
73
87
|
end
|
data/app/util.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
|
3
3
|
class Trepan
|
4
4
|
module Util
|
5
5
|
|
6
6
|
module_function
|
7
7
|
def safe_repr(str, max, elipsis='... ')
|
8
|
-
if str.is_a?(String) && str.size > max && !str.index("\n")
|
8
|
+
if str.is_a?(String) && max > 0 && str.size > max && !str.index("\n")
|
9
9
|
"%s%s%s" % [ str[0...max/2], elipsis, str[str.size-max/2..str.size]]
|
10
10
|
else
|
11
11
|
str
|
@@ -45,6 +45,16 @@ class Trepan
|
|
45
45
|
end
|
46
46
|
return text
|
47
47
|
end
|
48
|
+
|
49
|
+
# Suppress warnings. The main one we encounter is "already initialized
|
50
|
+
# constant" because perhaps another version readline has done that already.
|
51
|
+
def suppress_warnings
|
52
|
+
original_verbosity = $VERBOSE
|
53
|
+
$VERBOSE = nil
|
54
|
+
result = yield
|
55
|
+
$VERBOSE = original_verbosity
|
56
|
+
return result
|
57
|
+
end
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
data/app/yarv.rb
CHANGED
data/bin/trepan
CHANGED
@@ -54,14 +54,13 @@ if File.basename(__FILE__) == File.basename($0)
|
|
54
54
|
Trepan::PROG_SCRIPT = program_to_debug
|
55
55
|
|
56
56
|
opts = {}
|
57
|
-
%w(cmdfiles highlight initial_dir host nx port readline server
|
57
|
+
%w(cmdfiles highlight initial_dir host nx port readline server traceprint
|
58
58
|
).each do |opt|
|
59
59
|
opts[opt.to_sym] = options[opt.to_sym]
|
60
60
|
end
|
61
61
|
|
62
62
|
# Set global so others may use this debugger.
|
63
63
|
$trepan = Trepan.new(opts)
|
64
|
-
debug_program($trepan,
|
65
|
-
File.expand_path(program_to_debug))
|
64
|
+
debug_program($trepan, File.expand_path(program_to_debug))
|
66
65
|
end
|
67
66
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Aliases to simulate some of the Perl debugger command set
|
2
|
+
alias = alias
|
3
|
+
alias R restart
|
4
|
+
alias b break
|
5
|
+
alias c continue
|
6
|
+
alias f list
|
7
|
+
alias n next
|
8
|
+
alias p pr
|
9
|
+
alias q quit
|
10
|
+
alias s step
|
11
|
+
alias v list
|
12
|
+
macro - Proc.new{|*args| "list -"}
|
13
|
+
macro E Proc.new{|*args| "info thread"}
|
14
|
+
macro L Proc.new{|*args| "info break"}
|
15
|
+
macro T Proc.new{|*args| "info stack"}
|
16
|
+
macro l Proc.new{|*args| "list>"}
|
17
|
+
macro r Proc.new{|*args| %w(finish step)}
|
data/interface/script.rb
CHANGED
data/interface/server.rb
CHANGED
data/interface/user.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Interface when communicating with the user.
|
5
5
|
|
6
6
|
# Our local modules
|
7
|
-
require_relative '
|
7
|
+
require_relative '../interface'
|
8
8
|
require_relative '../io/input'
|
9
9
|
|
10
10
|
# Interface when communicating with the user.
|
@@ -151,4 +151,6 @@ if __FILE__ == $0
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
puts "User interface closed?: #{intf.closed?}"
|
154
|
+
intf.close
|
155
|
+
STDERR.puts "User interface closed?: #{intf.closed?}"
|
154
156
|
end
|
data/io/input.rb
CHANGED
data/io/null_output.rb
CHANGED
data/io/string_array.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
# Simulate I/O using lists of strings.
|
5
5
|
|
6
|
-
require_relative '
|
6
|
+
require_relative '../io'
|
7
7
|
|
8
8
|
# Simulate I/O using an array of strings. Sort of like StringIO, but
|
9
9
|
# even simplier.
|
@@ -152,4 +152,3 @@ if __FILE__ == $0
|
|
152
152
|
inp.close
|
153
153
|
puts "Input is closed? #{inp.closed?}"
|
154
154
|
end
|
155
|
-
|
data/io/tcpclient.rb
CHANGED
data/io/tcpserver.rb
CHANGED
data/{io/base_io.rb → io.rb}
RENAMED
File without changes
|
data/lib/trepanning.rb
CHANGED
@@ -66,7 +66,7 @@ class Trepan
|
|
66
66
|
opts[:host] = @settings[:host] if @settings[:host]
|
67
67
|
opts[:complete] = @completion_proc
|
68
68
|
opts[:readline] ||= @settings[:readline]
|
69
|
-
[Trepan::ClientInterface.new(nil, nil, nil,
|
69
|
+
[Trepan::ClientInterface.new(nil, nil, nil, {}, opts)]
|
70
70
|
else
|
71
71
|
opts = {:complete => @completion_proc,
|
72
72
|
:readline => @settings[:readline]}
|
@@ -78,6 +78,7 @@ class Trepan
|
|
78
78
|
# FIXME: The below option settings is a big crock.
|
79
79
|
@settings[:core_opts][:cmdproc_opts] ||= {}
|
80
80
|
@settings[:core_opts][:cmdproc_opts][:highlight] ||= settings[:highlight]
|
81
|
+
@settings[:core_opts][:cmdproc_opts][:traceprint] = settings[:traceprint]
|
81
82
|
|
82
83
|
@core = Core.new(self, @settings[:core_opts])
|
83
84
|
|
data/processor/command/alias.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
-
require_relative '
|
2
|
+
require_relative '../command'
|
3
3
|
|
4
4
|
class Trepan::Command::AliasCommand < Trepan::Command
|
5
5
|
|
@@ -8,7 +8,18 @@ class Trepan::Command::AliasCommand < Trepan::Command
|
|
8
8
|
HELP = <<-HELP
|
9
9
|
#{NAME} ALIAS COMMAND
|
10
10
|
|
11
|
-
Add
|
11
|
+
Add alias ALIAS for a debugger command COMMAND.
|
12
|
+
|
13
|
+
Add an alias when you want to use a command abbreviation for a command
|
14
|
+
that would otherwise be ambigous. For example, by default we make 's'
|
15
|
+
be an alias of 'step' to force it to be used. Without the alias, "s"
|
16
|
+
might be "step", "show", or "set" among others
|
17
|
+
|
18
|
+
Example:
|
19
|
+
|
20
|
+
alias cat list # "cat rubyfile.rb" is the same as "list rubyfile.rb"
|
21
|
+
alias s step # "s" is now an alias for "step".
|
22
|
+
# The above examples done by default.
|
12
23
|
|
13
24
|
See also 'unalias' and 'show #{NAME}'.
|
14
25
|
HELP
|
@@ -22,9 +33,9 @@ See also 'unalias' and 'show #{NAME}'.
|
|
22
33
|
# Run command.
|
23
34
|
def run(args)
|
24
35
|
if args.size == 1
|
25
|
-
@proc.commands['show'].run(%
|
36
|
+
@proc.commands['show'].run(%W(show #{NAME}))
|
26
37
|
elsif args.size == 2
|
27
|
-
@proc.commands['show'].run(
|
38
|
+
@proc.commands['show'].run(%W(show #{NAME} #{args[1]}))
|
28
39
|
else
|
29
40
|
junk, al, command = args
|
30
41
|
old_command = @proc.aliases[al]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
-
require_relative '
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../command'
|
4
4
|
class Trepan::Command::BacktraceCommand < Trepan::Command
|
5
5
|
|
6
6
|
unless defined?(HELP)
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# Base Class for Trepan subcommands. We pull in some helper
|
10
10
|
# functions for command from module cmdfns.
|
11
11
|
|
12
|
-
require_relative '
|
12
|
+
require_relative '../../command'
|
13
13
|
|
14
14
|
class Trepan
|
15
15
|
|
@@ -130,10 +130,6 @@ class Trepan
|
|
130
130
|
["#{subcmd_prefix_string} #{settings[subcmd_setting_key]}"]
|
131
131
|
end
|
132
132
|
|
133
|
-
def settings
|
134
|
-
@proc.settings
|
135
|
-
end
|
136
|
-
|
137
133
|
def subcmd_prefix_string
|
138
134
|
self.class.const_get(:PREFIX).join(' ')
|
139
135
|
end
|
@@ -159,19 +159,19 @@ class Trepan::SubSubcommandMgr < Trepan::Subcommand
|
|
159
159
|
|
160
160
|
def run(args)
|
161
161
|
args = @parent.last_args if args.size == 0
|
162
|
-
if args.size < 3 || args.size == 3 && args[
|
162
|
+
if args.size < 3 || args.size == 3 && args[2] == '*'
|
163
163
|
summary_list(obj_const(self, :NAME), @subcmds)
|
164
164
|
return false
|
165
165
|
end
|
166
166
|
|
167
|
-
subcmd_prefix =
|
167
|
+
subcmd_prefix = obj_const(self, :PREFIX).join('')
|
168
168
|
# We were given: cmd subcmd ...
|
169
169
|
# Run that.
|
170
|
-
subcmd = @subcmds.lookup(subcmd_prefix)
|
170
|
+
subcmd = @subcmds.lookup(subcmd_prefix + args[2])
|
171
171
|
if subcmd
|
172
172
|
subcmd.run(args[2..-1])
|
173
173
|
else
|
174
|
-
undefined_subcmd(obj_const(self, :PREFIX).join(' '), args[
|
174
|
+
undefined_subcmd(obj_const(self, :PREFIX).join(' '), args[2])
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
data/processor/command/break.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
-
require_relative '
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../command'
|
4
4
|
require_relative '../breakpoint'
|
5
5
|
require_relative '../../app/breakpoint'
|
6
6
|
require_relative '../../app/condition'
|
data/processor/command/debug.rb
CHANGED
data/processor/command/delete.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
-
require_relative '
|
2
|
+
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
|
+
require_relative '../command'
|
4
4
|
require_relative '../breakpoint'
|
5
5
|
require_relative '../../app/breakpoint'
|
6
6
|
class Trepan::Command::DeleteCommand < Trepan::Command
|
@@ -33,9 +33,12 @@ number.
|
|
33
33
|
end
|
34
34
|
first = args.shift
|
35
35
|
args.each do |num_str|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
opts = {:msg_on_error => '%s must be a number' % num_str}
|
37
|
+
i = @proc.get_an_int(num_str, opts)
|
38
|
+
if i
|
39
|
+
success = @proc.delete_breakpoint_by_number(num_str.to_i, false) if i
|
40
|
+
msg('Deleted breakpoint %d.' % i) if success
|
41
|
+
end
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
@@ -47,8 +50,8 @@ if __FILE__ == $0
|
|
47
50
|
cmd.run([cmd.name, '1'])
|
48
51
|
cmdproc = dbgr.core.processor
|
49
52
|
cmds = dbgr.core.processor.commands
|
50
|
-
break_cmd = cmds[
|
51
|
-
break_cmd.run([
|
53
|
+
break_cmd = cmds[cmd.name]
|
54
|
+
break_cmd.run([cmd.name, cmdproc.frame.source_location[0].to_s])
|
52
55
|
# require_relative '../../lib/trepanning'
|
53
56
|
# Trepan.debug
|
54
57
|
cmd.run([cmd.name, '1'])
|