rb8-trepanning 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/CHANGES +10 -0
  2. data/ChangeLog +276 -0
  3. data/Makefile +13 -0
  4. data/Rakefile +1 -2
  5. data/app/display.rb +41 -1
  6. data/app/irb.rb +55 -49
  7. data/app/options.rb +3 -2
  8. data/app/run.rb +25 -7
  9. data/app/util.rb +19 -1
  10. data/bin/trepan8 +0 -2
  11. data/data/perldb.bindings +17 -0
  12. data/interface/script.rb +1 -1
  13. data/interface/server.rb +1 -1
  14. data/interface/user.rb +3 -1
  15. data/{interface/base_intf.rb → interface.rb} +1 -1
  16. data/io/input.rb +1 -1
  17. data/io/null_output.rb +1 -1
  18. data/io/string_array.rb +2 -2
  19. data/io/tcpclient.rb +1 -1
  20. data/io/tcpserver.rb +1 -1
  21. data/{io/base_io.rb → io.rb} +0 -0
  22. data/lib/debugger.rb +0 -1
  23. data/lib/trepanning.rb +3 -1
  24. data/processor/command/alias.rb +13 -2
  25. data/processor/command/backtrace.rb +2 -1
  26. data/processor/command/base/subcmd.rb +1 -5
  27. data/processor/command/base/submgr.rb +1 -1
  28. data/processor/command/base/subsubcmd.rb +1 -1
  29. data/processor/command/base/subsubmgr.rb +4 -4
  30. data/processor/command/break.rb +19 -11
  31. data/processor/command/catch.rb +1 -1
  32. data/processor/command/complete.rb +1 -1
  33. data/processor/command/continue.rb +7 -1
  34. data/processor/command/directory.rb +2 -2
  35. data/processor/command/disable.rb +13 -14
  36. data/processor/command/display.rb +3 -1
  37. data/processor/command/down.rb +8 -8
  38. data/processor/command/edit.rb +1 -1
  39. data/processor/command/enable.rb +21 -22
  40. data/processor/command/eval.rb +1 -2
  41. data/processor/command/exit.rb +25 -8
  42. data/processor/command/finish.rb +7 -2
  43. data/processor/command/frame.rb +1 -1
  44. data/processor/command/help.rb +3 -4
  45. data/processor/command/info.rb +2 -0
  46. data/processor/command/info_subcmd/files.rb +2 -2
  47. data/processor/command/info_subcmd/locals.rb +6 -53
  48. data/processor/command/info_subcmd/source.rb +10 -4
  49. data/processor/command/info_subcmd/variables.rb +35 -0
  50. data/processor/command/info_subcmd/variables_subcmd/.gitignore +1 -0
  51. data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
  52. data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
  53. data/processor/command/info_subcmd/{globals.rb → variables_subcmd/globals.rb} +22 -17
  54. data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
  55. data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
  56. data/processor/command/kill.rb +8 -7
  57. data/processor/command/list.rb +2 -2
  58. data/processor/command/macro.rb +27 -9
  59. data/processor/command/next.rb +1 -1
  60. data/processor/command/parsetree.rb +1 -1
  61. data/processor/command/pp.rb +1 -1
  62. data/processor/command/pr.rb +1 -1
  63. data/processor/command/ps.rb +1 -1
  64. data/processor/command/restart.rb +1 -1
  65. data/processor/command/save.rb +1 -1
  66. data/processor/command/set_subcmd/auto.rb +7 -1
  67. data/processor/command/set_subcmd/different.rb +1 -1
  68. data/processor/command/set_subcmd/trace.rb +5 -4
  69. data/processor/command/set_subcmd/trace_subcmd/print.rb +4 -3
  70. data/processor/command/shell.rb +5 -4
  71. data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
  72. data/processor/command/source.rb +1 -1
  73. data/processor/command/step.rb +2 -5
  74. data/processor/command/tbreak.rb +1 -1
  75. data/processor/command/unalias.rb +13 -8
  76. data/processor/command/undisplay.rb +13 -9
  77. data/processor/command/up.rb +12 -14
  78. data/processor/command.rb +138 -230
  79. data/processor/display.rb +46 -10
  80. data/processor/help.rb +5 -3
  81. data/processor/hook.rb +2 -2
  82. data/processor/location.rb +25 -0
  83. data/processor/mock.rb +3 -2
  84. data/processor/msg.rb +55 -42
  85. data/processor/old-command.rb +270 -0
  86. data/processor/{processor.rb → old-processor.rb} +7 -8
  87. data/processor/running.rb +7 -12
  88. data/processor/subcmd.rb +15 -41
  89. data/processor/validate.rb +240 -238
  90. data/{processor/main.rb → processor.rb} +20 -42
  91. data/test/data/trace.cmd +6 -0
  92. data/test/data/trace.right +46 -0
  93. data/test/integration/helper.rb +2 -0
  94. data/test/integration/test-trace.rb +29 -0
  95. data/test/unit/cmd-helper.rb +2 -3
  96. data/test/unit/test-app-options.rb +13 -11
  97. data/test/unit/test-app-run.rb +7 -1
  98. data/test/unit/test-base-cmd.rb +1 -1
  99. data/test/unit/test-cmd-kill.rb +11 -4
  100. data/test/unit/test-io-tcpserver.rb +9 -4
  101. data/test/unit/test-proc-eval.rb +1 -2
  102. data/test/unit/test-proc-location.rb +26 -32
  103. data/test/unit/test-subcmd-help.rb +1 -1
  104. data/trepan8.gemspec +9 -1
  105. metadata +60 -17
  106. data/processor/command/base/cmd.rb +0 -177
data/processor/command.rb CHANGED
@@ -1,270 +1,178 @@
1
- require 'rubygems'
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
3
+ # Base class of all commands. Code common to all commands is here.
4
+ # Note: don't end classname with Command (capital C) since main
5
+ # will think this a command name like QuitCommand
6
+ require 'rubygems'; require 'require_relative'
2
7
  require 'columnize'
3
- require 'require_relative'
4
- require_relative './helper'
8
+ require_relative '../app/complete'
9
+ require_relative '../app/util'
10
+ ## require 'rubygems'; require 'ruby-debug'; Debugger.start
5
11
 
6
12
  module Trepan
7
- RUBY_DEBUG_DIR = File.expand_path(File.dirname(__FILE__)) unless
8
- defined?(RUBY_DEBUG_DIR)
13
+ class Command
14
+ attr_accessor :core, :proc
15
+
16
+ unless defined?(MIN_ARGS)
17
+ MIN_ARGS = 0 # run()'s args array must be at least this many
18
+ MAX_ARGS = nil # run()'s args array must be at least this many
19
+ NEED_STACK = false # We'll say that commands which need a stack
20
+ # to run have to declare that and those that
21
+ # don't don't have to mention it.
22
+ end
9
23
 
10
- # A Trepan::Command object is is the base class for commands that
11
- # implement a single debugger command. Individual debugger commands
12
- # will be a subclass of this. The singleton class object is the
13
- # command manager for all commands.
14
- #
15
- # Each debugger command is expected to implement the following methods:
16
- # _regexp_:: A regular expression which input strings are matched
17
- # against. If we have a match, run this command.
18
- # It is the ruby-debug programmer's responsibility
19
- # to make sure that these regular expressions match disjoint
20
- # sets of strings. Otherwise one is arbitrarily used.
21
- # _execute_:: Ruby code that implements the command.
22
- # _help_:: Should return a String containing descriptive help for
23
- # the commmand. Used by the 'help' command Trepan::HelpCommand
24
- # _help_command_:: The name of the command listed via help.
25
- #
26
- # _help_ and _help_command_ methods are singleton methods, not
27
- # instance methods like _regexp_ and _execute_.
28
- class OldCommand
29
- SubcmdStruct=Struct.new(:name, :min, :short_help, :long_help) unless
30
- defined?(SubcmdStruct)
24
+ def initialize(proc)
25
+ @name = my_const(:NAME)
26
+ @proc = proc
27
+ end
31
28
 
32
- include Columnize
29
+ def category
30
+ my_const(:CATEGORY)
31
+ end
33
32
 
34
- # Find _param_ in _subcmds_. The _param_ id downcased and can be
35
- # abbreviated to the minimum length listed in the subcommands
36
- def find(subcmds, param)
37
- param.downcase!
38
- for try_subcmd in subcmds do
39
- if (param.size >= try_subcmd.min) and
40
- (try_subcmd.name[0..param.size-1] == param)
41
- return try_subcmd
42
- end
43
- end
44
- return nil
33
+ # List commands arranged in an aligned columns
34
+ def columnize_commands(commands)
35
+ width = settings[:maxwidth]
36
+ Columnize::columnize(commands, width, ' ' * 4,
37
+ true, true, ' ' * 2).chomp
45
38
  end
46
39
 
47
- class << self
48
- # An Array containing Trepan::Command classes that implment each
49
- # of the debugger commands.
50
- def commands
51
- @commands ||= []
52
- end
53
-
54
- DEF_OPTIONS = {
55
- :allow_in_control => false,
56
- :allow_in_post_mortem => true,
57
- :event => true,
58
- :always_run => 0,
59
- :unknown => false,
60
- :need_context => false,
61
- } unless defined?(DEF_OPTIONS)
62
-
63
- def inherited(klass)
64
- DEF_OPTIONS.each do |o, v|
65
- klass.options[o] = v if klass.options[o].nil?
66
- end
67
- commands << klass
68
- end
40
+ def columnize_numbers(commands)
41
+ width = settings[:maxwidth]
42
+ Columnize::columnize(commands, width, ', ',
43
+ false, false, ' ' * 2).chomp
44
+ end
69
45
 
70
- # Read in and "include" all the subclasses of the
71
- # Trepan::Command class. For example
72
- # Trepan::QuitCommand is one of them. The list of Ruby
73
- # files to read are all the files that end .rb in directory
74
- # Trepan::RUBY_DEBUG_DIR
75
- def load_commands
76
- Dir[File.join(%W(#{Trepan.const_get(:RUBY_DEBUG_DIR)}
77
- command-ruby-debug *))].each do
78
- |file|
79
- require file if file =~ /\.rb$/
80
- end
81
- Trepan.constants.grep(/Functions$/).map { |name| Trepan.const_get(name) }.each do |mod|
82
- include mod
83
- end
84
- end
85
-
86
- def method_missing(meth, *args, &block)
87
- if meth.to_s =~ /^(.+?)=$/
88
- @options[$1.intern] = args.first
89
- else
90
- if @options.has_key?(meth)
91
- @options[meth]
92
- else
93
- super
94
- end
95
- end
96
- end
97
-
98
- def options
99
- @options ||= {}
100
- end
46
+ # FIXME: probably there is a way to do the delegation to proc methods
47
+ # without having type it all out.
101
48
 
102
- def settings_map
103
- @@settings_map ||= {}
104
- end
105
- private :settings_map
49
+ def confirm(message, default)
50
+ @proc.confirm(message, default)
51
+ end
106
52
 
107
- # Returns a Hash of Debugger settings, @settings. If doesn't exist
108
- # we create a @settings hash with [] setter and getter and return that.
109
- def settings
110
- unless true and defined? @settings and @settings
111
- @settings = Object.new
112
- map = settings_map
113
- c = class << @settings; self end
114
- if c.respond_to?(:funcall)
115
- c.funcall(:define_method, :[]) do |name|
116
- raise "No such setting #{name}" unless map.has_key?(name)
117
- map[name][:getter].call
118
- end
119
- else
120
- c.send(:define_method, :[]) do |name|
121
- raise "No such setting #{name}" unless map.has_key?(name)
122
- map[name][:getter].call
123
- end
124
- end
125
- c = class << @settings; self end
126
- if c.respond_to?(:funcall)
127
- c.funcall(:define_method, :[]=) do |name, value|
128
- raise "No such setting #{name}" unless map.has_key?(name)
129
- map[name][:setter].call(value)
130
- end
131
- else
132
- c.send(:define_method, :[]=) do |name, value|
133
- raise "No such setting #{name}" unless map.has_key?(name)
134
- map[name][:setter].call(value)
135
- end
136
- end
137
- end
138
- @settings
139
- end
53
+ def errmsg(message, opts={})
54
+ @proc.errmsg(message, opts)
55
+ end
140
56
 
141
- def register_setting_var(name, default)
142
- var_name = "@@#{name}"
143
- class_variable_set(var_name, default)
144
- register_setting_get(name) { class_variable_get(var_name) }
145
- register_setting_set(name) { |value| class_variable_set(var_name, value) }
146
- end
57
+ def obj_const(obj, name)
58
+ obj.class.const_get(name)
59
+ end
147
60
 
148
- def register_setting_get(name, &block)
149
- settings_map[name] ||= {}
150
- settings_map[name][:getter] = block
151
- end
61
+ def msg(message, opts={})
62
+ @proc.msg(message, opts)
63
+ end
152
64
 
153
- def register_setting_set(name, &block)
154
- settings_map[name] ||= {}
155
- settings_map[name][:setter] = block
156
- end
65
+ # Convenience short-hand for @dbgr.intf[-1].msg_nocr
66
+ def msg_nocr(msg, opts={})
67
+ @proc.msg_nocr(msg, opts)
157
68
  end
158
69
 
159
- register_setting_var(:basename, false) # use basename in showing files?
160
- register_setting_var(:callstyle, :last)
161
- register_setting_var(:debuggertesting, false)
162
- register_setting_var(:force_stepping, false)
163
- register_setting_var(:full_path, true)
164
- register_setting_var(:listsize, 10) # number of lines in list command
165
- register_setting_var(:stack_trace_on_error, false)
166
- register_setting_var(:tracing_plus, false) # different linetrace lines?
167
-
168
- # width of line output. Use COLUMNS value if it exists and is
169
- # not too rediculously large.
170
- width = ENV['COLUMNS'].to_i
171
- width = 80 unless width > 10
172
- register_setting_var(:width, width)
70
+ def my_const(name)
71
+ # Set class constant SHORT_HELP to be the first line of HELP
72
+ # unless it has been defined in the class already.
73
+ # The below was the simplest way I could find to do this since
74
+ # we are the super class but want to set the subclass's constant.
75
+ # defined? didn't seem to work here.
76
+ c = self.class.constants
77
+ if (c.member?('HELP') || c.member?(:HELP)) and
78
+ !(c.member?('SHORT_HELP') || c.member?(:SHORT_HELP))
79
+ help = self.class.const_get(:HELP) || self.class.const_get('HELP')
80
+ short_help = help.split("\n")[0].chomp('.')
81
+ self.class.const_set(:SHORT_HELP, short_help)
82
+ end
83
+ self.class.const_get(name)
84
+ end
173
85
 
174
- if not defined? Trepan::ARGV
175
- Trepan::ARGV = ARGV.clone
86
+ def name
87
+ self.class.const_get(:NAME)
176
88
  end
177
- register_setting_var(:argv, Trepan::ARGV)
178
-
179
- def initialize(state)
180
- @state = state
89
+
90
+ # The method that implements the debugger command.
91
+ def run(*args)
92
+ raise RuntimeError, 'You need to define this method elsewhere'
181
93
  end
182
94
 
183
- def match(input)
184
- @match = regexp.match(input)
95
+ def section(message, opts={})
96
+ ## debugger
97
+ @proc.section(message, opts)
185
98
  end
186
99
 
187
- protected
100
+ def settings
101
+ @proc.settings
102
+ end
188
103
 
189
- # FIXME: use delegate?
190
- def errmsg(*args)
191
- @state.errmsg(*args)
104
+ def short_help
105
+ help_constant_sym = if self.class.constants.member?('SHORT_HELP')
106
+ :SHORT_HELP
107
+ else :HELP
108
+ end
109
+ my_const(help_constant_sym)
192
110
  end
193
111
 
194
- def print(*args)
195
- @state.print(*args)
112
+ # Define a method called 'complete' on the singleton class.
113
+ def self.completion(ary)
114
+ self.send(:define_method,
115
+ :complete,
116
+ Proc.new {|prefix|
117
+ Trepan::Complete.complete_token(ary, prefix) })
196
118
  end
197
119
 
198
- # Called when we are about to do a dangerous operation. _msg_
199
- # contains a prompt message. Return _true_ if confirmed or _false_
200
- # if not confirmed.
201
- def confirm(msg)
202
- @state.confirm(msg) == 'y'
120
+ # From reference debugger
121
+ def run_code(str)
122
+ @proc.dbgr.current_frame.run(str)
203
123
  end
204
124
 
205
- # debug_eval like Kernel.eval or Object.instance_eval but using
206
- # the bindings for the debugged program. If there is a
207
- # syntax-error like exception in running eval, print an
208
- # appropriate message and throw :debug_error
209
- def debug_eval(str, b = get_binding)
210
- begin
211
- val = eval(str, b)
212
- rescue StandardError, ScriptError => e
213
- if OldCommand.settings[:stack_trace_on_error]
214
- at = eval("caller(1)", b)
215
- print "%s:%s\n", at.shift, e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '')
216
- for i in at
217
- print "\tfrom %s\n", i
218
- end
219
- else
220
- print "#{e.class} Exception: #{e.message}\n"
221
- end
222
- throw :debug_error
223
- end
125
+ def current_method
126
+ @proc.frame.method
224
127
  end
225
128
 
226
- # debug_eval like Kernel.eval or Object.instance_eval but using
227
- # the bindings for the debugged program. If there is a syntax
228
- # error kind of exception in running eval, no warning is given and
229
- # nil is returned.
230
- def debug_silent_eval(str)
231
- begin
232
- eval(str, get_binding)
233
- rescue StandardError, ScriptError
234
- nil
235
- end
129
+ def current_frame
130
+ @proc.frame
236
131
  end
237
132
 
238
- # Return a binding object for the debugged program.
239
- def get_binding
240
- @state.context.frame_binding(@state.frame_pos)
133
+ def variables
134
+ @proc.variables
241
135
  end
242
136
 
243
- def line_at(file, line)
244
- Debugger.line_at(file, line)
137
+ def listen(step=false)
138
+ @proc.listen(step)
245
139
  end
246
140
 
247
- def get_context(thnum)
248
- Debugger.contexts.find{|c| c.thnum == thnum}
249
- end
250
141
  end
251
-
252
- OldCommand.load_commands
253
-
254
- # Returns setting object.
255
- # Use Debugger.settings[] and Debugger.settings[]= methods to query and set
256
- # debugger settings. These settings are available:
257
- #
258
- # - :autolist - automatically calls 'list' command on breakpoint
259
- # - :autoeval - evaluates input in the current binding if it's not recognized as a debugger command
260
- # - :autoirb - automatically calls 'irb' command on breakpoint
261
- # - :stack_trace_on_error - shows full stack trace if eval command results with an exception
262
- # - :frame_full_path - displays full paths when showing frame stack
263
- # - :frame_class_names - displays method's class name when showing frame stack
264
- # - :reload_source_on_change - makes 'list' command to always display up-to-date source code
265
- # - :force_stepping - stepping command asways move to the new line
266
- #
267
- def self.settings
268
- OldCommand.settings
142
+ end
143
+ if __FILE__ == $0
144
+ module Trepan
145
+ class CmdProcessor
146
+ def initialize(dbgr)
147
+ end
148
+ def confirm(message, default)
149
+ p ['confirm: ', message, default]
150
+ end
151
+ def errmsg(message, opts)
152
+ p ['err:', message, opts]
153
+ end
154
+ def msg(message, opts)
155
+ p [message, opts]
156
+ end
157
+ def msg_nocr(message, opts)
158
+ p ['nocr: ', message, opts]
159
+ end
160
+ def section(message, opts)
161
+ p ['section: ', message, opts]
162
+ end
163
+ end
164
+ class Command::Test < Trepan::Command
165
+ NAME = 'test'
166
+ CATEGORY = 'testcategory'
167
+ completion %w(a aa ab ba aac)
168
+ end
169
+ end
170
+ proc = Trepan::CmdProcessor.new(nil)
171
+ cmd = Trepan::Command::Test.new(proc)
172
+ %w(confirm errmsg msg msg_nocr section).each do |meth|
173
+ cmd.send(meth, 'test', nil)
269
174
  end
175
+ p cmd.complete('aa')
176
+ cmd.instance_variable_set('@completions', %w(aardvark apple))
177
+ p cmd.complete('aa')
270
178
  end
data/processor/display.rb CHANGED
@@ -2,16 +2,52 @@
2
2
  require 'rubygems'; require 'require_relative'
3
3
  require_relative '../app/display'
4
4
  require_relative 'virtual'
5
- class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
6
- attr_reader :displays
7
-
8
- def display_initialize
9
- @displays = DisplayMgr.new
10
- end
11
-
12
- def run_eval_display(args={})
13
- for line in @displays.display(@frame) do
14
- msg(line)
5
+ module Trepan
6
+ class CmdProcessor < VirtualCmdProcessor
7
+ attr_reader :displays
8
+
9
+ def display_initialize
10
+ @displays = DisplayMgr.new
11
+ end
12
+
13
+ def display_find(num, show_errmsg = true)
14
+ if 0 == @displays.size
15
+ errmsg('No display expressions set.') if show_errmsg
16
+ return nil
17
+ elsif num > @displays.max || num < 1
18
+ errmsg('Display number %d is out of range 1..%d' %
19
+ [num, @displays.max]) if show_errmsg
20
+ return nil
21
+ end
22
+ disp = @displays[num]
23
+ if disp
24
+ return disp
25
+ else
26
+ errmsg('Display number %d previously deleted.' %
27
+ num) if show_errmsg
28
+ return nil
29
+ end
30
+ end
31
+
32
+ # Enable or disable a breakpoint given its breakpoint number.
33
+ def en_disable_display_by_number(num, do_enable=true)
34
+ disp = display_find(num)
35
+ return false unless disp
36
+
37
+ enable_disable = do_enable ? 'en' : 'dis'
38
+ if disp.enabled? == do_enable
39
+ errmsg('Display %d previously %sabled.' %
40
+ [num, enable_disable])
41
+ return false
42
+ end
43
+ disp.enabled = do_enable
44
+ return true
45
+ end
46
+
47
+ def run_eval_display(args={})
48
+ for line in @displays.display(@frame) do
49
+ msg(line)
50
+ end
15
51
  end
16
52
  end
17
53
  end
data/processor/help.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+
2
3
  module Trepan
3
4
  # class SubHelp
4
5
  # def initialize(name, dir)
@@ -48,7 +49,7 @@ module Trepan
48
49
  # like "show", "info" or "set". Generally this means list
49
50
  # all of the subcommands.
50
51
  def summary_list(name, subcmds)
51
- msg "List of #{name} commands (with minimum abbreviation in parenthesis):"
52
+ section "List of #{name} commands (with minimum abbreviation in parenthesis):"
52
53
  subcmds.list.each do |subcmd_name|
53
54
  # Some commands have lots of output.
54
55
  # they are excluded here because 'in_list' is false.
@@ -59,8 +60,9 @@ module Trepan
59
60
 
60
61
  # Error message when subcommand asked for but doesn't exist
61
62
  def undefined_subcmd(cmd, subcmd)
62
- errmsg(('Undefined "%s" subcommand: "%s". ' +
63
- "Try \"help %s *.\"") % [cmd, subcmd, cmd])
63
+ ambig = settings[:abbrev] ? 'or ambiguous ' : ''
64
+ errmsg(['Undefined %s"%s" subcommand: "%s". ' % [ambig, cmd, subcmd],
65
+ 'Try "help %s *".' % cmd])
64
66
  end
65
67
 
66
68
  end
data/processor/hook.rb CHANGED
@@ -66,9 +66,9 @@ class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
66
66
  @cmdloop_prehooks = Hook.new
67
67
  @unconditional_prehooks = Hook.new
68
68
 
69
- irb_cmd = commands['irb']
69
+ irb_cmd = commands['shell']
70
70
  @autoirb_hook = ['autoirb',
71
- Proc.new{|*args| irb_cmd.run(['irb']) if irb_cmd}]
71
+ Proc.new{|*args| irb_cmd.run(['shell']) if irb_cmd}]
72
72
 
73
73
  @debug_dbgr_hook = ['dbgdbgr',
74
74
  Proc.new{|*args|
@@ -13,6 +13,31 @@ require_relative 'msg'
13
13
  require_relative 'virtual'
14
14
  class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
15
15
 
16
+ unless defined?(EVENT2ICON)
17
+ # Event icons used in printing locations.
18
+ EVENT2ICON = {
19
+ 'brkpt' => 'xx',
20
+ 'tbrkpt' => 'x1',
21
+ 'c-call' => 'C>',
22
+ 'c-return' => '<C',
23
+ 'step-call' => '->',
24
+ 'call' => '->',
25
+ 'class' => '::',
26
+ 'coverage' => '[]',
27
+ 'debugger-call' => ':o',
28
+ 'end' => '-|',
29
+ 'line' => '--',
30
+ 'raise' => '!!',
31
+ 'return' => '<-',
32
+ 'start' => '>>',
33
+ 'switch' => 'sw',
34
+ 'trace-var' => '$V',
35
+ 'unknown' => '?!',
36
+ 'vm' => 'VM',
37
+ 'vm-insn' => '..',
38
+ }
39
+ end
40
+
16
41
  def canonic_file(filename, resolve=true)
17
42
  # For now we want resolved filenames
18
43
  if @settings[:basename]
data/processor/mock.rb CHANGED
@@ -8,7 +8,8 @@ require_relative '../app/default'
8
8
  require_relative '../interface/user' # user interface (includes I/O)
9
9
 
10
10
  require 'ruby-debug-base'; Debugger.start(:init => true)
11
- require_relative 'processor'
11
+ require_relative '../processor'
12
+ require_relative 'old-processor'
12
13
 
13
14
  module MockDebugger
14
15
  class MockDebugger
@@ -105,7 +106,7 @@ module MockDebugger
105
106
 
106
107
  def subsub_setup(sub_class, subsub_class, run=true)
107
108
  subsub_name = subsub_class.const_get('PREFIX')
108
- dbgr, cmd = setup(subsub_name[0], false)
109
+ cmd = sub_setup(sub_class, false)
109
110
  sub_cmd = sub_class.new(dbgr.processor, cmd)
110
111
  subsub_cmd = subsub_class.new(cmd.proc, sub_cmd, subsub_name.join(''))
111
112
  subsub_cmd.run([subsub_cmd.name]) if run