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.
- data/CHANGES +10 -0
- data/ChangeLog +276 -0
- data/Makefile +13 -0
- data/Rakefile +1 -2
- data/app/display.rb +41 -1
- data/app/irb.rb +55 -49
- data/app/options.rb +3 -2
- data/app/run.rb +25 -7
- data/app/util.rb +19 -1
- data/bin/trepan8 +0 -2
- 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 -1
- data/io/null_output.rb +1 -1
- data/io/string_array.rb +2 -2
- data/io/tcpclient.rb +1 -1
- data/io/tcpserver.rb +1 -1
- data/{io/base_io.rb → io.rb} +0 -0
- data/lib/debugger.rb +0 -1
- data/lib/trepanning.rb +3 -1
- data/processor/command/alias.rb +13 -2
- data/processor/command/backtrace.rb +2 -1
- 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 +19 -11
- data/processor/command/catch.rb +1 -1
- data/processor/command/complete.rb +1 -1
- data/processor/command/continue.rb +7 -1
- data/processor/command/directory.rb +2 -2
- data/processor/command/disable.rb +13 -14
- data/processor/command/display.rb +3 -1
- data/processor/command/down.rb +8 -8
- data/processor/command/edit.rb +1 -1
- data/processor/command/enable.rb +21 -22
- data/processor/command/eval.rb +1 -2
- data/processor/command/exit.rb +25 -8
- data/processor/command/finish.rb +7 -2
- data/processor/command/frame.rb +1 -1
- data/processor/command/help.rb +3 -4
- data/processor/command/info.rb +2 -0
- data/processor/command/info_subcmd/files.rb +2 -2
- data/processor/command/info_subcmd/locals.rb +6 -53
- data/processor/command/info_subcmd/source.rb +10 -4
- data/processor/command/info_subcmd/variables.rb +35 -0
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +1 -0
- data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
- data/processor/command/info_subcmd/{globals.rb → variables_subcmd/globals.rb} +22 -17
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
- data/processor/command/kill.rb +8 -7
- data/processor/command/list.rb +2 -2
- data/processor/command/macro.rb +27 -9
- data/processor/command/next.rb +1 -1
- 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/restart.rb +1 -1
- data/processor/command/save.rb +1 -1
- data/processor/command/set_subcmd/auto.rb +7 -1
- data/processor/command/set_subcmd/different.rb +1 -1
- 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 -4
- data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
- data/processor/command/source.rb +1 -1
- data/processor/command/step.rb +2 -5
- data/processor/command/tbreak.rb +1 -1
- data/processor/command/unalias.rb +13 -8
- data/processor/command/undisplay.rb +13 -9
- data/processor/command/up.rb +12 -14
- data/processor/command.rb +138 -230
- data/processor/display.rb +46 -10
- data/processor/help.rb +5 -3
- data/processor/hook.rb +2 -2
- data/processor/location.rb +25 -0
- data/processor/mock.rb +3 -2
- data/processor/msg.rb +55 -42
- data/processor/old-command.rb +270 -0
- data/processor/{processor.rb → old-processor.rb} +7 -8
- data/processor/running.rb +7 -12
- data/processor/subcmd.rb +15 -41
- data/processor/validate.rb +240 -238
- data/{processor/main.rb → processor.rb} +20 -42
- data/test/data/trace.cmd +6 -0
- data/test/data/trace.right +46 -0
- data/test/integration/helper.rb +2 -0
- data/test/integration/test-trace.rb +29 -0
- data/test/unit/cmd-helper.rb +2 -3
- data/test/unit/test-app-options.rb +13 -11
- data/test/unit/test-app-run.rb +7 -1
- data/test/unit/test-base-cmd.rb +1 -1
- data/test/unit/test-cmd-kill.rb +11 -4
- data/test/unit/test-io-tcpserver.rb +9 -4
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-location.rb +26 -32
- data/test/unit/test-subcmd-help.rb +1 -1
- data/trepan8.gemspec +9 -1
- metadata +60 -17
- data/processor/command/base/cmd.rb +0 -177
data/processor/command.rb
CHANGED
@@ -1,270 +1,178 @@
|
|
1
|
-
|
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
|
-
|
4
|
-
require_relative '
|
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
|
-
|
8
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
29
|
+
def category
|
30
|
+
my_const(:CATEGORY)
|
31
|
+
end
|
33
32
|
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
-
|
71
|
-
|
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
|
-
|
103
|
-
|
104
|
-
|
105
|
-
private :settings_map
|
49
|
+
def confirm(message, default)
|
50
|
+
@proc.confirm(message, default)
|
51
|
+
end
|
106
52
|
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
-
|
142
|
-
|
143
|
-
|
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
|
-
|
149
|
-
|
150
|
-
|
151
|
-
end
|
61
|
+
def msg(message, opts={})
|
62
|
+
@proc.msg(message, opts)
|
63
|
+
end
|
152
64
|
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
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
|
-
|
175
|
-
|
86
|
+
def name
|
87
|
+
self.class.const_get(:NAME)
|
176
88
|
end
|
177
|
-
|
178
|
-
|
179
|
-
def
|
180
|
-
|
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
|
184
|
-
|
95
|
+
def section(message, opts={})
|
96
|
+
## debugger
|
97
|
+
@proc.section(message, opts)
|
185
98
|
end
|
186
99
|
|
187
|
-
|
100
|
+
def settings
|
101
|
+
@proc.settings
|
102
|
+
end
|
188
103
|
|
189
|
-
|
190
|
-
|
191
|
-
|
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
|
-
|
195
|
-
|
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
|
-
#
|
199
|
-
|
200
|
-
|
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
|
-
|
206
|
-
|
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
|
-
|
227
|
-
|
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
|
-
|
239
|
-
|
240
|
-
@state.context.frame_binding(@state.frame_pos)
|
133
|
+
def variables
|
134
|
+
@proc.variables
|
241
135
|
end
|
242
136
|
|
243
|
-
def
|
244
|
-
|
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
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
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
|
-
|
63
|
-
|
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['
|
69
|
+
irb_cmd = commands['shell']
|
70
70
|
@autoirb_hook = ['autoirb',
|
71
|
-
Proc.new{|*args| irb_cmd.run(['
|
71
|
+
Proc.new{|*args| irb_cmd.run(['shell']) if irb_cmd}]
|
72
72
|
|
73
73
|
@debug_dbgr_hook = ['dbgdbgr',
|
74
74
|
Proc.new{|*args|
|
data/processor/location.rb
CHANGED
@@ -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
|
-
|
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
|