trepanning 0.1.6 → 1.93.32
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +57 -0
- data/ChangeLog +585 -736
- data/NEWS +26 -12
- data/README.md +62 -0
- data/Rakefile +15 -9
- data/app/breakpoint.rb +11 -12
- data/app/complete.rb +14 -14
- data/app/core.rb +34 -30
- data/app/default.rb +8 -7
- data/app/markdown.rb +191 -0
- data/app/options.rb +104 -99
- data/app/run.rb +9 -1
- data/app/util.rb +7 -7
- data/bin/trepan +7 -7
- data/interface.rb +0 -4
- data/interface/user.rb +11 -11
- data/io/input.rb +13 -13
- data/lib/trepanning.rb +30 -29
- data/processor.rb +40 -40
- data/processor/command.rb +13 -9
- data/processor/command/alias.rb +21 -15
- data/processor/command/backtrace.rb +27 -19
- data/processor/command/break.rb +24 -21
- data/processor/command/complete.rb +5 -2
- data/processor/command/condition.rb +14 -9
- data/processor/command/debug.rb +8 -8
- data/processor/command/down.rb +6 -6
- data/processor/command/edit.rb +4 -0
- data/processor/command/eval.rb +2 -2
- data/processor/command/exit.rb +12 -9
- data/processor/command/finish.rb +25 -23
- data/processor/command/frame.rb +30 -26
- data/processor/command/help.rb +203 -185
- data/processor/command/help/{command.txt → command.md} +21 -18
- data/processor/command/help/examples.md +20 -0
- data/processor/command/help/filename.md +46 -0
- data/processor/command/help/location.md +34 -0
- data/processor/command/help/suffixes.md +19 -0
- data/processor/command/info.rb +6 -4
- data/processor/command/info_subcmd/breakpoints.rb +13 -13
- data/processor/command/info_subcmd/files.rb +35 -31
- data/processor/command/info_subcmd/frame.rb +82 -33
- data/processor/command/info_subcmd/macro.rb +1 -1
- data/processor/command/info_subcmd/program.rb +8 -5
- data/processor/command/info_subcmd/registers.rb +15 -13
- data/processor/command/kill.rb +23 -17
- data/processor/command/list.rb +63 -56
- data/processor/command/macro.rb +45 -28
- data/processor/command/next.rb +29 -23
- data/processor/command/pp.rb +11 -9
- data/processor/command/pr.rb +10 -8
- data/processor/command/ps.rb +5 -5
- data/processor/command/quit.rb +24 -17
- data/processor/command/raise.rb +6 -6
- data/processor/command/reload.rb +9 -2
- data/processor/command/reload_subcmd/command.rb +4 -4
- data/processor/command/restart.rb +9 -4
- data/processor/command/save.rb +9 -9
- data/processor/command/server.rb +18 -17
- data/processor/command/set.rb +8 -6
- data/processor/command/set_subcmd/confirm.rb +15 -2
- data/processor/command/set_subcmd/different.rb +7 -5
- data/processor/command/set_subcmd/highlight.rb +14 -3
- data/processor/command/set_subcmd/pc.rb +62 -0
- data/processor/command/set_subcmd/sp.rb +8 -2
- data/processor/command/shell.rb +25 -23
- data/processor/command/show.rb +9 -7
- data/processor/command/show_subcmd/confirm.rb +12 -1
- data/processor/command/show_subcmd/highlight.rb +13 -3
- data/processor/command/source.rb +27 -26
- data/processor/command/step.rb +52 -43
- data/processor/command/tbreak.rb +9 -4
- data/processor/command/unalias.rb +9 -7
- data/processor/command/undisplay.rb +11 -7
- data/processor/command/up.rb +18 -13
- data/processor/command/watchg.rb +20 -17
- data/processor/complete.rb +120 -0
- data/processor/default.rb +47 -43
- data/processor/list.rb +23 -6
- data/processor/load_cmds.rb +25 -105
- data/processor/location.rb +104 -96
- data/processor/mock.rb +12 -12
- data/processor/msg.rb +61 -52
- data/processor/validate.rb +36 -27
- data/test/data/fname-with-blank.right +0 -1
- data/test/data/trace-mingw.right +28 -0
- data/test/data/trace.right +0 -2
- data/test/functional/test-raise.rb +3 -0
- data/test/integration/helper.rb +16 -16
- data/test/integration/test-debugger-stop.rb +8 -2
- data/test/integration/test-quit.rb +16 -15
- data/test/integration/test-trace.rb +19 -10
- data/test/unit/cmd-helper.rb +4 -1
- data/test/unit/test-app-complete.rb +3 -1
- data/test/unit/test-app-options.rb +7 -1
- data/test/unit/test-app-run.rb +9 -1
- data/test/unit/test-cmd-alias.rb +1 -1
- data/test/unit/test-cmd-edit.rb +2 -0
- data/test/unit/test-cmd-help.rb +10 -5
- data/test/unit/test-cmd-parse_list_cmd.rb +3 -3
- data/test/unit/test-completion.rb +2 -2
- data/test/unit/test-proc-default.rb +34 -0
- data/trepanning.gemspec +15 -14
- metadata +70 -44
- data/README.textile +0 -50
- data/processor/command/help/examples.txt +0 -16
- data/processor/command/help/filename.txt +0 -40
- data/processor/command/help/location.txt +0 -37
- data/processor/command/help/suffixes.txt +0 -17
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +0 -28
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +0 -47
- data/processor/command/nocache.rb +0 -32
- data/processor/command/parsetree.rb +0 -56
data/processor.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
# Copyright (C) 2010,
|
2
|
-
# The main "driver" class for a command processor. Other parts of the
|
1
|
+
# Copyright (C) 2010-2011, 2013, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# The main "driver" class for a command processor. Other parts of the
|
3
3
|
# command class and debugger command objects are pulled in from here.
|
4
4
|
|
5
|
-
%w(default breakpoint display eventbuf eval load_cmds location
|
6
|
-
|
5
|
+
%w(default breakpoint complete display eventbuf eval load_cmds location
|
6
|
+
frame hook msg running validate).each do
|
7
7
|
|mod_str|
|
8
8
|
require_relative "processor/#{mod_str}"
|
9
9
|
end
|
10
10
|
require_relative 'app/brkptmgr'
|
11
11
|
|
12
12
|
class Trepan
|
13
|
-
|
13
|
+
class CmdProcessor < VirtualCmdProcessor
|
14
14
|
|
15
|
-
|
15
|
+
# SEE ALSO attr's in require_relative's of loop above.
|
16
16
|
|
17
17
|
attr_reader :cmd_argstr # Current command args, a String.
|
18
18
|
# This is current_command with the command
|
@@ -25,7 +25,7 @@ class Trepan
|
|
25
25
|
# Trepan::Core instance)
|
26
26
|
attr_accessor :debug_nest # Number of nested debugs. Used in showing
|
27
27
|
# prompt.
|
28
|
-
attr_accessor :different_pos # Same type as settings[:different]
|
28
|
+
attr_accessor :different_pos # Same type as settings[:different]
|
29
29
|
# this is the temporary value for the
|
30
30
|
# next stop while settings is the default
|
31
31
|
# value to use.
|
@@ -34,8 +34,8 @@ class Trepan
|
|
34
34
|
# Trepan::Core instance)
|
35
35
|
attr_reader :interfaces # Array of all interfaces
|
36
36
|
attr_accessor :leave_cmd_loop # Commands set this to signal to leave
|
37
|
-
# the command loop (which often continues to
|
38
|
-
# run the debugged program).
|
37
|
+
# the command loop (which often continues to
|
38
|
+
# run the debugged program).
|
39
39
|
attr_accessor :line_no # Last line shown in "list" command
|
40
40
|
attr_accessor :next_level # Fixnum. frame.stack_size has to
|
41
41
|
# be <= than this. If next'ing,
|
@@ -43,17 +43,17 @@ class Trepan
|
|
43
43
|
attr_accessor :next_thread # Thread. If non-nil then in
|
44
44
|
# stepping the thread has to be
|
45
45
|
# this thread.
|
46
|
-
attr_accessor :pass_exception # Pass an exception back
|
46
|
+
attr_accessor :pass_exception # Pass an exception back
|
47
47
|
attr_accessor :prompt # String print before requesting input
|
48
48
|
attr_reader :settings # Hash[:symbol] of command
|
49
49
|
# processor settings
|
50
|
-
|
50
|
+
|
51
51
|
attr_accessor :traced_vars # list of traced global variables
|
52
52
|
|
53
53
|
# The following are used in to force stopping at a different line
|
54
54
|
# number. FIXME: could generalize to a position object.
|
55
55
|
attr_accessor :last_pos # Last position. 6-Tuple: of
|
56
|
-
# [location, container, stack_size,
|
56
|
+
# [location, container, stack_size,
|
57
57
|
# current_thread, pc_offset]
|
58
58
|
|
59
59
|
|
@@ -78,18 +78,18 @@ class Trepan
|
|
78
78
|
|
79
79
|
# FIXME: Rework using a general "set substitute file" command and
|
80
80
|
# a global default profile which gets read.
|
81
|
-
file = File.expand_path(File.join(File.dirname(__FILE__),
|
81
|
+
file = File.expand_path(File.join(File.dirname(__FILE__),
|
82
82
|
%w(data prelude.rb)))
|
83
83
|
LineCache::cache(file)
|
84
84
|
LineCache::remap_file('<internal:prelude>', file)
|
85
|
-
file = File.expand_path(File.join(File.dirname(__FILE__),
|
85
|
+
file = File.expand_path(File.join(File.dirname(__FILE__),
|
86
86
|
%w(data custom_require.rb)))
|
87
87
|
LineCache::cache(file)
|
88
|
-
LineCache::remap_file('<internal:lib/rubygems/custom_require>',
|
88
|
+
LineCache::remap_file('<internal:lib/rubygems/custom_require>',
|
89
89
|
file)
|
90
90
|
|
91
91
|
# Start with empty thread and frame info.
|
92
|
-
frame_teardown
|
92
|
+
frame_teardown
|
93
93
|
|
94
94
|
# Run initialization routines for each of the "submodule"s.
|
95
95
|
# load_cmds has to come first.
|
@@ -98,14 +98,12 @@ class Trepan
|
|
98
98
|
self.send("#{submod}_initialize")
|
99
99
|
end
|
100
100
|
hook_initialize(commands)
|
101
|
-
unconditional_prehooks.insert_if_new(-1, *trace_hook) if
|
101
|
+
unconditional_prehooks.insert_if_new(-1, *trace_hook) if
|
102
102
|
@settings[:traceprint]
|
103
|
-
|
104
|
-
# FIXME: run start file and start commands.
|
105
103
|
end
|
106
104
|
|
107
105
|
def compute_prompt
|
108
|
-
thread_str =
|
106
|
+
thread_str =
|
109
107
|
if 1 == Thread.list.size
|
110
108
|
''
|
111
109
|
elsif Thread.current == Thread.main
|
@@ -113,13 +111,15 @@ class Trepan
|
|
113
111
|
else
|
114
112
|
"@#{Thread.current.object_id}"
|
115
113
|
end
|
116
|
-
"%s#{settings[:prompt]}%s%s: " %
|
114
|
+
"%s#{settings[:prompt]}%s%s: " %
|
117
115
|
['(' * @debug_nest, thread_str, ')' * @debug_nest]
|
118
|
-
|
116
|
+
|
119
117
|
end
|
120
118
|
|
121
119
|
def finalize
|
122
120
|
breakpoint_finalize
|
121
|
+
msg "%sThat's all, folks..." %
|
122
|
+
(defined?(Trepan::PROGRAM) ? "#{Trepan::PROGRAM}: " : '')
|
123
123
|
end
|
124
124
|
|
125
125
|
# Check that we meed the criteria that cmd specifies it needs
|
@@ -128,13 +128,13 @@ class Trepan
|
|
128
128
|
# Check we have frame is not null
|
129
129
|
min_args = cmd.class.const_get(:MIN_ARGS)
|
130
130
|
if nargs < min_args
|
131
|
-
errmsg(("Command '%s' needs at least %d argument(s); " +
|
131
|
+
errmsg(("Command '%s' needs at least %d argument(s); " +
|
132
132
|
"got %d.") % [name, min_args, nargs])
|
133
133
|
return false
|
134
134
|
end
|
135
135
|
max_args = cmd.class.const_get(:MAX_ARGS)
|
136
136
|
if max_args and nargs > max_args
|
137
|
-
errmsg(("Command '%s' needs at most %d argument(s); " +
|
137
|
+
errmsg(("Command '%s' needs at most %d argument(s); " +
|
138
138
|
"got %d.") % [name, max_args, nargs])
|
139
139
|
return false
|
140
140
|
end
|
@@ -158,14 +158,14 @@ class Trepan
|
|
158
158
|
return true if @intf.input_eof? && intf_size == 1
|
159
159
|
while intf_size > 1 || !@intf.input_eof?
|
160
160
|
begin
|
161
|
-
@current_command =
|
161
|
+
@current_command =
|
162
162
|
if @cmd_queue.empty?
|
163
163
|
# Leave trailing blanks on for the "complete" command
|
164
|
-
read_command.chomp
|
164
|
+
read_command.chomp
|
165
165
|
else
|
166
166
|
@cmd_queue.shift
|
167
167
|
end
|
168
|
-
if @current_command.empty?
|
168
|
+
if @current_command.empty?
|
169
169
|
next unless @last_command && intf.interactive?;
|
170
170
|
end
|
171
171
|
next if @current_command[0..0] == '#' # Skip comment lines
|
@@ -197,8 +197,8 @@ class Trepan
|
|
197
197
|
frame_setup(frame)
|
198
198
|
|
199
199
|
@unconditional_prehooks.run
|
200
|
-
|
201
|
-
if 'trace-var' == @event
|
200
|
+
|
201
|
+
if 'trace-var' == @event
|
202
202
|
variable_name, value = @core.hook_arg
|
203
203
|
action = @traced_vars[variable_name]
|
204
204
|
msg "trace: #{variable_name} = #{value}"
|
@@ -217,7 +217,7 @@ class Trepan
|
|
217
217
|
|
218
218
|
if breakpoint?
|
219
219
|
@last_pos = [@frame.source_container, frame_line,
|
220
|
-
@stack_size, @current_thread, @event,
|
220
|
+
@stack_size, @current_thread, @event,
|
221
221
|
@frame.pc_offset]
|
222
222
|
elsif @event != 'post-mortem'
|
223
223
|
return if stepping_skip? || @stack_size <= @hide_level
|
@@ -232,7 +232,7 @@ class Trepan
|
|
232
232
|
|
233
233
|
print_location unless @settings[:traceprint]
|
234
234
|
@eventbuf.add_mark if @settings[:tracebuffer]
|
235
|
-
|
235
|
+
|
236
236
|
@cmdloop_prehooks.run
|
237
237
|
while not @leave_cmd_loop do
|
238
238
|
begin
|
@@ -256,7 +256,7 @@ class Trepan
|
|
256
256
|
# Run current_command, a String. @last_command is set after the
|
257
257
|
# command is run if it is a command.
|
258
258
|
def run_command(current_command)
|
259
|
-
eval_command =
|
259
|
+
eval_command =
|
260
260
|
if current_command[0..0] == '!'
|
261
261
|
current_command[0] = ''
|
262
262
|
else
|
@@ -277,7 +277,7 @@ class Trepan
|
|
277
277
|
break unless @macros.member?(macro_cmd_name)
|
278
278
|
current_command = @macros[macro_cmd_name][0].call(*args[1..-1])
|
279
279
|
msg current_command.inspect if settings[:debugmacro]
|
280
|
-
if current_command.is_a?(Array) &&
|
280
|
+
if current_command.is_a?(Array) &&
|
281
281
|
current_command.all? {|val| val.is_a?(String)}
|
282
282
|
args = (first=current_command.shift).split
|
283
283
|
@cmd_queue += current_command
|
@@ -292,21 +292,21 @@ class Trepan
|
|
292
292
|
end
|
293
293
|
|
294
294
|
@cmd_name = args[0]
|
295
|
-
run_cmd_name =
|
295
|
+
run_cmd_name =
|
296
296
|
if @aliases.member?(@cmd_name)
|
297
|
-
@aliases[@cmd_name]
|
297
|
+
@aliases[@cmd_name]
|
298
298
|
else
|
299
299
|
@cmd_name
|
300
300
|
end
|
301
|
-
|
301
|
+
|
302
302
|
run_cmd_name = uniq_abbrev(@commands.keys, run_cmd_name) if
|
303
303
|
!@commands.member?(run_cmd_name) && @settings[:abbrev]
|
304
|
-
|
304
|
+
|
305
305
|
if @commands.member?(run_cmd_name)
|
306
306
|
cmd = @commands[run_cmd_name]
|
307
307
|
if ok_for_running(cmd, run_cmd_name, args.size-1)
|
308
308
|
@cmd_argstr = current_command[@cmd_name.size..-1].lstrip
|
309
|
-
cmd.run(args)
|
309
|
+
cmd.run(args)
|
310
310
|
@last_command = current_command
|
311
311
|
end
|
312
312
|
return false
|
@@ -329,7 +329,7 @@ class Trepan
|
|
329
329
|
|
330
330
|
# Error message when a command doesn't exist
|
331
331
|
def undefined_command(cmd_name)
|
332
|
-
begin
|
332
|
+
begin
|
333
333
|
errmsg('Undefined command: "%s". Try "help".' % cmd_name)
|
334
334
|
rescue
|
335
335
|
$stderr.puts 'Undefined command: "%s". Try "help".' % cmd_name
|
@@ -381,7 +381,7 @@ if __FILE__ == $0
|
|
381
381
|
end
|
382
382
|
$input = ['1+2']
|
383
383
|
dbg.core.processor.process_command_and_quit?
|
384
|
-
$input = ['!s = 5'] # ! means eval line
|
384
|
+
$input = ['!s = 5'] # ! means eval line
|
385
385
|
dbg.core.processor.process_command_and_quit?
|
386
386
|
end
|
387
387
|
end
|
data/processor/command.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
# Base class of all commands. Code common to all commands is here.
|
4
4
|
# Note: don't end classname with Command (capital C) since main
|
5
|
-
# will think this a command name like QuitCommand
|
5
|
+
# will think this a command name like QuitCommand
|
6
6
|
require 'columnize'
|
7
7
|
require_relative '../app/complete'
|
8
8
|
|
@@ -30,7 +30,7 @@ class Trepan
|
|
30
30
|
# List commands arranged in an aligned columns
|
31
31
|
def columnize_commands(commands)
|
32
32
|
width = settings[:maxwidth]
|
33
|
-
Columnize::columnize(commands, width, ' ' * 4,
|
33
|
+
Columnize::columnize(commands, width, ' ' * 4,
|
34
34
|
true, true, ' ' * 2).chomp
|
35
35
|
end
|
36
36
|
|
@@ -52,7 +52,7 @@ class Trepan
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def obj_const(obj, name)
|
55
|
-
obj.class.const_get(name)
|
55
|
+
obj.class.const_get(name)
|
56
56
|
end
|
57
57
|
|
58
58
|
# Convenience short-hand for @proc.msg
|
@@ -92,23 +92,27 @@ class Trepan
|
|
92
92
|
@proc.section(message, opts)
|
93
93
|
end
|
94
94
|
|
95
|
+
def markdown(message, opts={})
|
96
|
+
@proc.markdown(message, opts)
|
97
|
+
end
|
98
|
+
|
95
99
|
def settings
|
96
100
|
@proc.settings
|
97
101
|
end
|
98
102
|
|
99
103
|
def short_help
|
100
|
-
help_constant_sym = if self.class.constants.member?(:SHORT_HELP)
|
101
|
-
:SHORT_HELP
|
104
|
+
help_constant_sym = if self.class.constants.member?(:SHORT_HELP)
|
105
|
+
:SHORT_HELP
|
102
106
|
else :HELP
|
103
107
|
end
|
104
108
|
my_const(help_constant_sym)
|
105
109
|
end
|
106
110
|
|
107
111
|
# Define a method called 'complete' on the singleton class.
|
108
|
-
def self.completion(ary)
|
109
|
-
self.send(:define_method,
|
110
|
-
:complete,
|
111
|
-
Proc.new {|prefix|
|
112
|
+
def self.completion(ary)
|
113
|
+
self.send(:define_method,
|
114
|
+
:complete,
|
115
|
+
Proc.new {|prefix|
|
112
116
|
Trepan::Complete.complete_token(ary, prefix) })
|
113
117
|
end
|
114
118
|
end
|
data/processor/command/alias.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2013, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../command'
|
3
3
|
|
4
4
|
class Trepan::Command::AliasCommand < Trepan::Command
|
@@ -6,31 +6,37 @@ class Trepan::Command::AliasCommand < Trepan::Command
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
NAME = File.basename(__FILE__, '.rb')
|
8
8
|
HELP = <<-HELP
|
9
|
-
|
9
|
+
**#{NAME}** *alias* *command*
|
10
10
|
|
11
|
-
Add alias
|
11
|
+
Add alias *alias* for a debugger command *command*.
|
12
12
|
|
13
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
|
15
|
-
be an alias of
|
16
|
-
might be "step", "show", or "set" among others
|
14
|
+
that would otherwise be ambigous. For example, by default we make `s`
|
15
|
+
be an alias of `step` to allow it to unambigously refer to that command.
|
17
16
|
|
18
|
-
|
17
|
+
Without the alias, `s` might be mean `step`, `show`, or `set` among
|
18
|
+
others
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
# The above examples done by default.
|
20
|
+
Examples:
|
21
|
+
--------
|
23
22
|
|
24
|
-
|
23
|
+
alias cat list # "cat rubyfile.rb" is the same as "list rubyfile.rb"
|
24
|
+
alias s step # "s" is now an alias for "step".
|
25
|
+
# The above example is done by default.
|
26
|
+
|
27
|
+
See also:
|
28
|
+
---------
|
29
|
+
|
30
|
+
`unalias` and `show #{NAME}`.
|
25
31
|
HELP
|
26
32
|
|
27
33
|
CATEGORY = 'support'
|
28
34
|
MAX_ARGS = 2 # Need at most this many
|
29
|
-
NEED_STACK =
|
35
|
+
NEED_STACK = false
|
30
36
|
SHORT_HELP = 'Add an alias for a debugger command'
|
31
37
|
end
|
32
|
-
|
33
|
-
# Run command.
|
38
|
+
|
39
|
+
# Run command.
|
34
40
|
def run(args)
|
35
41
|
if args.size == 1
|
36
42
|
@proc.commands['show'].run(%W(show #{NAME}))
|
@@ -42,7 +48,7 @@ See also 'unalias' and 'show #{NAME}'.
|
|
42
48
|
if @proc.commands.member?(command)
|
43
49
|
@proc.aliases[al] = command
|
44
50
|
if old_command
|
45
|
-
msg("Alias '#{al}' for command '#{command}' replaced old " +
|
51
|
+
msg("Alias '#{al}' for command '#{command}' replaced old " +
|
46
52
|
"alias for '#{old_command}'.")
|
47
53
|
else
|
48
54
|
msg "New alias '#{al}' for command '#{command}' created."
|
@@ -1,26 +1,34 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010,
|
2
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative '../command'
|
4
4
|
class Trepan::Command::BacktraceCommand < Trepan::Command
|
5
5
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
NAME = File.basename(__FILE__, '.rb')
|
8
8
|
HELP = <<-HELP
|
9
|
-
|
9
|
+
**#{NAME}** [*count*]
|
10
10
|
|
11
11
|
Print a stack trace, with the most recent frame at the top. With a
|
12
12
|
positive number, print at most many entries. With a negative number
|
13
13
|
print the top entries minus that number.
|
14
14
|
|
15
|
-
|
16
|
-
the context used for many
|
17
|
-
evaluation or
|
15
|
+
In the listing produced, an arrow `-->` indicates the 'current
|
16
|
+
frame'. The current frame determines the context used for many
|
17
|
+
debugger commands such as in expression evaluation, `eval`, or in
|
18
|
+
source-line listing, `list`, or the `edit` command.
|
18
19
|
|
19
20
|
Examples:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
---------
|
22
|
+
|
23
|
+
#{NAME} # Print a full stack trace
|
24
|
+
#{NAME} 2 # Print only the top two entries
|
25
|
+
#{NAME} -1 # Print a stack trace except the initial (least recent) call."
|
26
|
+
|
27
|
+
See also:
|
28
|
+
---------
|
29
|
+
|
30
|
+
`up`, `down`, `frame`.
|
31
|
+
HELP
|
24
32
|
|
25
33
|
ALIASES = %w(bt where)
|
26
34
|
CATEGORY = 'stack'
|
@@ -35,17 +43,17 @@ Examples:
|
|
35
43
|
def complete(prefix)
|
36
44
|
@proc.frame_complete(prefix, nil)
|
37
45
|
end
|
38
|
-
|
46
|
+
|
39
47
|
# This method runs the command
|
40
48
|
def run(args)
|
41
49
|
unless @proc.frame
|
42
50
|
errmsg 'No frame.'
|
43
51
|
return false
|
44
52
|
end
|
45
|
-
hide_level =
|
46
|
-
if (!settings[:hidelevel] || settings[:hidelevel] < 0) &&
|
47
|
-
@proc.hidelevels[Thread.current]
|
48
|
-
@proc.hidelevels[Thread.current]
|
53
|
+
hide_level =
|
54
|
+
if (!settings[:hidelevel] || settings[:hidelevel] < 0) &&
|
55
|
+
@proc.hidelevels[Thread.current]
|
56
|
+
@proc.hidelevels[Thread.current]
|
49
57
|
else settings[:hidelevel]
|
50
58
|
end
|
51
59
|
stack_size = @proc.top_frame.stack_size - hide_level
|
@@ -56,19 +64,19 @@ Examples:
|
|
56
64
|
:maxwidth => settings[:maxwidth],
|
57
65
|
:show_pc => settings[:show_pc]
|
58
66
|
}
|
59
|
-
opts[:count] =
|
67
|
+
opts[:count] =
|
60
68
|
if args.size > 1
|
61
|
-
opts[:maxstack] = @proc.get_int(args[1],
|
69
|
+
opts[:maxstack] = @proc.get_int(args[1],
|
62
70
|
:cmdname => self.name,
|
63
71
|
:max_value => stack_size)
|
64
72
|
else
|
65
73
|
stack_size
|
66
74
|
end
|
67
75
|
return false unless opts[:count]
|
68
|
-
# FIXME: Fix Ruby so we don't need this workaround?
|
76
|
+
# FIXME: Fix Ruby so we don't need this workaround?
|
69
77
|
# See also location.rb
|
70
|
-
opts[:class] = @proc.core.hook_arg if
|
71
|
-
'CFUNC' == @proc.frame.type &&
|
78
|
+
opts[:class] = @proc.core.hook_arg if
|
79
|
+
'CFUNC' == @proc.frame.type &&
|
72
80
|
@proc.core.hook_arg && @proc.event != 'raise'
|
73
81
|
print_stack_trace(@proc.top_frame, opts)
|
74
82
|
end
|