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.
Files changed (134) hide show
  1. data/ChangeLog +465 -0
  2. data/NEWS +26 -1
  3. data/README.textile +1 -1
  4. data/app/cmd_parse.kpeg +2 -1
  5. data/app/cmd_parser.rb +30 -3
  6. data/app/core.rb +1 -1
  7. data/app/display.rb +39 -1
  8. data/app/frame.rb +1 -1
  9. data/app/irb.rb +42 -40
  10. data/app/options.rb +3 -2
  11. data/app/run.rb +21 -7
  12. data/app/util.rb +12 -2
  13. data/app/yarv.rb +0 -2
  14. data/bin/trepan +2 -3
  15. data/data/perldb.bindings +17 -0
  16. data/interface/script.rb +1 -1
  17. data/interface/server.rb +1 -1
  18. data/interface/user.rb +3 -1
  19. data/{interface/base_intf.rb → interface.rb} +1 -1
  20. data/io/input.rb +1 -3
  21. data/io/null_output.rb +1 -1
  22. data/io/string_array.rb +1 -2
  23. data/io/tcpclient.rb +1 -1
  24. data/io/tcpserver.rb +1 -1
  25. data/{io/base_io.rb → io.rb} +0 -0
  26. data/lib/trepanning.rb +2 -1
  27. data/processor/command/alias.rb +15 -4
  28. data/processor/command/backtrace.rb +2 -2
  29. data/processor/command/base/subcmd.rb +1 -5
  30. data/processor/command/base/submgr.rb +1 -1
  31. data/processor/command/base/subsubcmd.rb +1 -1
  32. data/processor/command/base/subsubmgr.rb +4 -4
  33. data/processor/command/break.rb +1 -1
  34. data/processor/command/complete.rb +1 -1
  35. data/processor/command/condition.rb +2 -2
  36. data/processor/command/continue.rb +1 -1
  37. data/processor/command/debug.rb +1 -1
  38. data/processor/command/delete.rb +10 -7
  39. data/processor/command/directory.rb +1 -1
  40. data/processor/command/disable.rb +25 -19
  41. data/processor/command/disassemble.rb +1 -1
  42. data/processor/command/display.rb +35 -28
  43. data/processor/command/down.rb +8 -8
  44. data/processor/command/edit.rb +1 -1
  45. data/processor/command/enable.rb +10 -12
  46. data/processor/command/eval.rb +1 -1
  47. data/processor/command/exit.rb +1 -1
  48. data/processor/command/finish.rb +1 -1
  49. data/processor/command/frame.rb +2 -2
  50. data/processor/command/help.rb +6 -8
  51. data/processor/command/info.rb +2 -0
  52. data/processor/command/info_subcmd/files.rb +17 -11
  53. data/processor/command/info_subcmd/frame.rb +0 -1
  54. data/processor/command/info_subcmd/locals.rb +6 -73
  55. data/processor/command/info_subcmd/source.rb +10 -4
  56. data/processor/command/info_subcmd/variables.rb +34 -0
  57. data/processor/command/info_subcmd/variables_subcmd/.gitignore +1 -0
  58. data/processor/command/info_subcmd/variables_subcmd/class.rb +40 -0
  59. data/processor/command/info_subcmd/variables_subcmd/constant.rb +41 -0
  60. data/processor/command/info_subcmd/{globals.rb → variables_subcmd/globals.rb} +21 -16
  61. data/processor/command/info_subcmd/variables_subcmd/instance.rb +41 -0
  62. data/processor/command/info_subcmd/variables_subcmd/locals.rb +99 -0
  63. data/processor/command/kill.rb +9 -8
  64. data/processor/command/list.rb +9 -107
  65. data/processor/command/macro.rb +27 -9
  66. data/processor/command/next.rb +1 -1
  67. data/processor/command/nocache.rb +2 -2
  68. data/processor/command/parsetree.rb +1 -1
  69. data/processor/command/pp.rb +1 -1
  70. data/processor/command/pr.rb +1 -1
  71. data/processor/command/ps.rb +1 -1
  72. data/processor/command/quit.rb +18 -7
  73. data/processor/command/raise.rb +1 -1
  74. data/processor/command/reload.rb +10 -10
  75. data/processor/command/restart.rb +1 -1
  76. data/processor/command/save.rb +1 -1
  77. data/processor/command/server.rb +1 -1
  78. data/processor/command/set_subcmd/auto.rb +7 -1
  79. data/processor/command/set_subcmd/different.rb +5 -4
  80. data/processor/command/set_subcmd/substitute_subcmd/eval.rb +2 -2
  81. data/processor/command/set_subcmd/trace.rb +5 -4
  82. data/processor/command/set_subcmd/trace_subcmd/print.rb +4 -3
  83. data/processor/command/shell.rb +5 -3
  84. data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
  85. data/processor/command/show_subcmd/auto_subcmd/eval.rb +2 -7
  86. data/processor/command/show_subcmd/trace_subcmd/print.rb +3 -3
  87. data/processor/command/show_subcmd/version.rb +24 -0
  88. data/processor/command/source.rb +1 -1
  89. data/processor/command/step.rb +1 -1
  90. data/processor/command/tbreak.rb +1 -1
  91. data/processor/command/unalias.rb +11 -6
  92. data/processor/command/undisplay.rb +14 -10
  93. data/processor/command/up.rb +12 -13
  94. data/processor/command/watchg.rb +1 -1
  95. data/processor/{command/base/cmd.rb → command.rb} +3 -2
  96. data/processor/display.rb +34 -0
  97. data/processor/frame.rb +2 -2
  98. data/processor/help.rb +6 -4
  99. data/processor/hook.rb +95 -96
  100. data/processor/list.rb +146 -0
  101. data/processor/location.rb +26 -0
  102. data/processor/mock.rb +4 -7
  103. data/processor/msg.rb +54 -42
  104. data/processor/running.rb +6 -3
  105. data/processor/subcmd.rb +16 -41
  106. data/processor/validate.rb +6 -9
  107. data/{processor/main.rb → processor.rb} +11 -40
  108. data/sample/rocky-trepan-colors.rb +0 -1
  109. data/test/data/enable.cmd +1 -1
  110. data/test/data/trace.cmd +6 -0
  111. data/test/data/trace.right +39 -0
  112. data/test/example/gcd.rb +0 -1
  113. data/test/functional/test-next.rb +1 -1
  114. data/test/integration/helper.rb +4 -0
  115. data/test/integration/test-trace.rb +18 -0
  116. data/test/unit/cmd-helper.rb +4 -4
  117. data/test/unit/test-app-cmd_parse.rb +1 -1
  118. data/test/unit/test-app-display.rb +22 -0
  119. data/test/unit/test-app-options.rb +14 -10
  120. data/test/unit/test-app-run.rb +7 -1
  121. data/test/unit/test-base-subcmd.rb +1 -1
  122. data/test/unit/test-cmd-kill.rb +11 -4
  123. data/test/unit/test-cmd-parse_list_cmd.rb +1 -1
  124. data/test/unit/{test-base-cmd.rb → test-command.rb} +1 -1
  125. data/test/unit/test-proc-eval.rb +1 -2
  126. data/test/unit/test-proc-frame.rb +1 -2
  127. data/test/unit/test-proc-list.rb +52 -0
  128. data/test/unit/test-proc-load_cmds.rb +1 -1
  129. data/test/unit/test-proc-location.rb +11 -4
  130. data/test/unit/test-proc-main.rb +1 -1
  131. data/test/unit/test-proc-validate.rb +1 -2
  132. data/test/unit/test-subcmd-help.rb +1 -1
  133. data/trepanning.gemspec +1 -1
  134. metadata +26 -12
data/app/frame.rb CHANGED
@@ -79,7 +79,7 @@ class Trepan
79
79
  end
80
80
 
81
81
  def file
82
- source_container[1]
82
+ iseq.source_container[1]
83
83
  end
84
84
 
85
85
  def format_stack_call(frame, opts)
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
- # A base command class that resume execution
10
- class DebuggerResumeCommand
11
- def self.execute(conf, *opts)
12
- name =
13
- if self.name =~ /IRB::ExtendCommand::(\S+)/
14
- $1.downcase
15
- else
16
- 'unknown'
17
- end
18
- $trepan_args = opts
19
- $trepan_command =
20
- if $trepan_irb_statements
21
- $trepan_irb_statements
22
- else
23
- ([name] + opts).join(' ')
24
- end
25
-
26
- throw :IRB_EXIT, name.to_sym
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
- end
29
-
30
- class Continue < DebuggerResumeCommand ; end
31
- class Finish < DebuggerResumeCommand ; end
32
- class Next < DebuggerResumeCommand ; end
33
- class Quit < DebuggerResumeCommand ; end
34
- class Step < DebuggerResumeCommand ; end
35
-
36
- # Issues a comamnd to the debugger without continuing
37
- # execution.
38
- class Dbgr
39
- def self.execute(conf, *opts)
40
- $trepan_command =
41
- if opts.size == 1 && opts[0].is_a?(String)
42
- $trepan_args = opts[0]
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
- opts.join(' ')
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.3'
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[:tracing] = true
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, ruby_path, program_to_debug, start_opts={})
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 = `#{RbConfig.ruby} -c #{program_to_debug.inspect} 2>&1`
18
- if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/
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.index(File::SEPARATOR)
56
- # Don't search since this name has path separator components
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
@@ -8,8 +8,6 @@ module CodeRay
8
8
 
9
9
  class YARV < Scanner
10
10
 
11
- include Streamable
12
-
13
11
  register_for :yarv
14
12
  file_extension 'yarv'
15
13
 
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, RbConfig.ruby,
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
@@ -4,7 +4,7 @@
4
4
  # Module for reading debugger scripts
5
5
 
6
6
  # Our local modules
7
- require_relative 'base_intf'
7
+ require_relative '../interface'
8
8
  require_relative '../io/input'
9
9
  require_relative '../io/string_array'
10
10
 
data/interface/server.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
3
3
 
4
4
  # Our local modules
5
- require_relative 'base_intf'
5
+ require_relative '../interface'
6
6
  require_relative 'comcodes'
7
7
  require_relative '../io/input'
8
8
  require_relative '../io/tcpserver'
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 'base_intf'
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
@@ -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
 
4
4
  # A base class for a debugger interface.
5
5
 
data/io/input.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # input or GNU Readline.
6
6
  #
7
7
 
8
- require_relative 'base_io'
8
+ require_relative '../io'
9
9
 
10
10
  class Trepan
11
11
 
@@ -132,5 +132,3 @@ if __FILE__ == $0
132
132
  end
133
133
  end
134
134
  end
135
-
136
-
data/io/null_output.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # to see output.
6
6
  #
7
7
 
8
- require_relative 'base_io'
8
+ require_relative '../io'
9
9
 
10
10
  class Trepan
11
11
  class OutputNull < Trepan::OutputBase
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 'base_io'
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
@@ -3,7 +3,7 @@
3
3
  # Debugger Socket Input/Output Interface.
4
4
 
5
5
  require 'socket'
6
- require_relative 'base_io'
6
+ require_relative '../io'
7
7
  require_relative 'tcpfns'
8
8
 
9
9
  class Trepan
data/io/tcpserver.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'socket'
6
6
  require_relative '../app/default' # For host and port
7
- require_relative 'base_io'
7
+ require_relative '../io'
8
8
  require_relative 'tcpfns'
9
9
 
10
10
  class Trepan
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, nil, opts)]
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
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
- require_relative 'base/cmd'
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 an alias for a COMMAND
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(%w(show alias))
36
+ @proc.commands['show'].run(%W(show #{NAME}))
26
37
  elsif args.size == 2
27
- @proc.commands['show'].run(['show', 'alias', args[1]])
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 'base/cmd'
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 'cmd'
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
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
3
- require_relative 'cmd'
3
+ require_relative '../../command'
4
4
  require_relative '../../subcmd'
5
5
  require_relative '../../help'
6
6
  require_relative '../../../app/complete'
@@ -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 'cmd'
12
+ require_relative '../../command'
13
13
  require_relative 'subcmd'
14
14
 
15
15
  class Trepan
@@ -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[-1] == '*'
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 = args[0..2].join('')
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[-1])
174
+ undefined_subcmd(obj_const(self, :PREFIX).join(' '), args[2])
175
175
  end
176
176
  end
177
177
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
- require_relative 'base/cmd'
2
+ require_relative '../command'
3
3
  require_relative '../breakpoint'
4
4
  require_relative '../../app/breakpoint'
5
5
  class Trepan::Command::BreakCommand < Trepan::Command
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
- require_relative 'base/cmd'
2
+ require_relative '../command'
3
3
  require_relative '../load_cmds'
4
4
  class Trepan::Command::CompleteCommand < Trepan::Command
5
5
 
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
- require_relative 'base/cmd'
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'
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
- require_relative 'base/cmd'
2
+ require_relative '../command'
3
3
  require_relative '../running'
4
4
  require_relative '../../app/breakpoint' # FIXME: possibly temporary
5
5
 
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require 'thread_frame'
4
- require_relative 'base/cmd'
4
+ require_relative '../command'
5
5
 
6
6
  class Trepan::Command::DebugCommand < Trepan::Command
7
7
  unless defined?(HELP)
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
3
- require_relative 'base/cmd'
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
- i = @proc.get_an_int(num_str)
37
- success = @proc.delete_breakpoint_by_number(num_str.to_i, false) if i
38
- msg('Deleted breakpoint %d.' % i) if success
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['break']
51
- break_cmd.run(['break', cmdproc.frame.source_location[0].to_s])
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'])
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
2
- require_relative 'base/cmd'
2
+ require_relative '../command'
3
3
  class Trepan::Command::DirectoryCommand < Trepan::Command
4
4
 
5
5
  unless defined?(HELP)