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/command/break.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../command'
|
3
3
|
require_relative '../breakpoint'
|
4
4
|
require_relative '../../app/breakpoint'
|
@@ -7,24 +7,27 @@ class Trepan::Command::BreakCommand < Trepan::Command
|
|
7
7
|
unless defined?(HELP)
|
8
8
|
NAME = File.basename(__FILE__, '.rb')
|
9
9
|
HELP = <<-HELP
|
10
|
-
|
11
|
-
|
10
|
+
**#{NAME}**
|
11
|
+
**#{NAME}** *location* [ {if|unless} *condition* ]
|
12
12
|
|
13
|
-
Set a breakpoint. In the second form where
|
13
|
+
Set a breakpoint. In the second form where *condition* is given, the
|
14
14
|
condition is evaluated in the context of the position. We stop only If
|
15
|
-
|
15
|
+
*condition* evalutes to non-false/nil and the "if" form used, or it is
|
16
16
|
false and the "unless" form used.\
|
17
17
|
|
18
18
|
Examples:
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
---------
|
20
|
+
#{NAME}
|
21
|
+
#{NAME} 10 # set breakpoint on line 10
|
22
|
+
#{NAME} 10 if 1 == a # like above but only if a is equal to 1
|
23
|
+
#{NAME} 10 unless 1 == a # like above but only if a is equal to 1
|
24
|
+
#{NAME} me.rb:10
|
25
|
+
#{NAME} @20 # set breakpoint VM Instruction Sequence offset 20
|
26
|
+
#{NAME} Kernel.pp # Set a breakpoint at the beginning of Kernel.pp
|
26
27
|
|
27
|
-
See also
|
28
|
+
See also:
|
29
|
+
---------
|
30
|
+
`condition`, `continue`, `help syntax location`, and `tbreak`
|
28
31
|
HELP
|
29
32
|
|
30
33
|
ALIASES = %w(b)
|
@@ -39,10 +42,10 @@ See also condition, continue and "help location".
|
|
39
42
|
if args.size == 1
|
40
43
|
# usage is "break" which means break right here
|
41
44
|
# FIXME: should handle condition
|
42
|
-
bp = @proc.breakpoint_offset(@proc.frame.pc_offset,
|
43
|
-
@proc.frame.iseq, 'true', false)
|
45
|
+
bp = @proc.breakpoint_offset(@proc.frame.pc_offset,
|
46
|
+
@proc.frame.iseq, 'true', false)
|
44
47
|
else
|
45
|
-
iseq, line_number, vm_offset, condition, negate =
|
48
|
+
iseq, line_number, vm_offset, condition, negate =
|
46
49
|
@proc.breakpoint_position(@proc.cmd_argstr, true)
|
47
50
|
return false unless iseq && vm_offset
|
48
51
|
bp = @proc.breakpoint_offset(vm_offset, iseq, condition, negate, temp)
|
@@ -56,13 +59,13 @@ See also condition, continue and "help location".
|
|
56
59
|
mess = "Breakpoint %d set at " % bp.id
|
57
60
|
end
|
58
61
|
|
59
|
-
line_loc = "line %s in %s" %
|
62
|
+
line_loc = "line %s in %s" %
|
60
63
|
[bp.source_location.join(', '),
|
61
64
|
@proc.canonic_container(bp.iseq.source_container).join(' ')]
|
62
65
|
|
63
|
-
vm_loc = "VM offset %d of instruction sequence \"%s\"" %
|
66
|
+
vm_loc = "VM offset %d of instruction sequence \"%s\"" %
|
64
67
|
[bp.offset, bp.iseq.name]
|
65
|
-
|
68
|
+
|
66
69
|
loc, other_loc =
|
67
70
|
if 'line' == bp.type
|
68
71
|
[line_loc, vm_loc]
|
@@ -78,7 +81,7 @@ if __FILE__ == $0
|
|
78
81
|
require_relative '../mock'
|
79
82
|
dbgr, cmd = MockDebugger::setup
|
80
83
|
# require_relative '../../lib/trepanning'
|
81
|
-
def run_cmd(cmd, args)
|
84
|
+
def run_cmd(cmd, args)
|
82
85
|
cmd.proc.instance_variable_set('@cmd_argstr', args[1..-1].join(' '))
|
83
86
|
cmd.run(args)
|
84
87
|
end
|
@@ -90,7 +93,7 @@ if __FILE__ == $0
|
|
90
93
|
pc_offset = tf.pc_offset
|
91
94
|
run_cmd(cmd, [cmd.name, "@#{pc_offset}"])
|
92
95
|
def foo
|
93
|
-
5
|
96
|
+
5
|
94
97
|
end
|
95
98
|
run_cmd(cmd, [cmd.name, 'foo', (__LINE__-2).to_s])
|
96
99
|
run_cmd(cmd, [cmd.name, 'foo'])
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
1
|
+
# Copyright (C) 2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../command'
|
3
3
|
require_relative '../load_cmds'
|
4
4
|
class Trepan::Command::CompleteCommand < Trepan::Command
|
@@ -6,9 +6,12 @@ class Trepan::Command::CompleteCommand < Trepan::Command
|
|
6
6
|
unless defined?(HELP)
|
7
7
|
NAME = File.basename(__FILE__, '.rb')
|
8
8
|
HELP = <<-HELP
|
9
|
-
|
9
|
+
**#{NAME}** *command-prefix*
|
10
10
|
|
11
11
|
List the completions for the rest of the line as a command.
|
12
|
+
|
13
|
+
This is a gdb command. One use is an a front-end which supports
|
14
|
+
completion. GNU Emacs for example has been known to use this.
|
12
15
|
HELP
|
13
16
|
CATEGORY = 'support'
|
14
17
|
NEED_STACK = false
|
@@ -1,5 +1,5 @@
|
|
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
|
require_relative '../breakpoint'
|
5
5
|
require_relative '../../app/breakpoint'
|
@@ -10,18 +10,23 @@ class Trepan::Command::ConditionCommand < Trepan::Command
|
|
10
10
|
unless defined?(HELP)
|
11
11
|
NAME = File.basename(__FILE__, '.rb')
|
12
12
|
HELP = <<-HELP
|
13
|
-
|
13
|
+
**#{NAME}** *bp-number* *condition*
|
14
14
|
|
15
|
-
|
16
|
-
must evaluate
|
15
|
+
*bp-number* is a breakpoint number. *condition* is an expression which
|
16
|
+
must evaluate true before the breakpoint is honored. If *condition*
|
17
17
|
is absent, any existing condition is removed; i.e., the breakpoint is
|
18
18
|
made unconditional.
|
19
19
|
|
20
20
|
Examples:
|
21
|
-
|
22
|
-
#{NAME} 5 # Remove above condition
|
21
|
+
---------
|
23
22
|
|
24
|
-
|
23
|
+
#{NAME} 5 x > 10 # Breakpoint 5 now has condition x > 10
|
24
|
+
#{NAME} 5 # Remove above condition
|
25
|
+
|
26
|
+
See also:
|
27
|
+
--------
|
28
|
+
|
29
|
+
`break`, `enable` and `disable`.
|
25
30
|
HELP
|
26
31
|
|
27
32
|
ALIASES = %w(cond)
|
@@ -37,7 +42,7 @@ See also "break", "enable" and "disable".
|
|
37
42
|
bpnum = @proc.get_an_int(args[1])
|
38
43
|
bp = @proc.breakpoint_find(bpnum)
|
39
44
|
return unless bp
|
40
|
-
|
45
|
+
|
41
46
|
if args.size > 2
|
42
47
|
condition = args[2..-1].join(' ')
|
43
48
|
return unless valid_condition?(condition)
|
@@ -54,7 +59,7 @@ if __FILE__ == $0
|
|
54
59
|
require_relative '../mock'
|
55
60
|
dbgr, cmd = MockDebugger::setup
|
56
61
|
cmd.proc.frame_setup(RubyVM::Frame::current)
|
57
|
-
|
62
|
+
|
58
63
|
cmd.run([cmd.name, '1'])
|
59
64
|
cmdproc = dbgr.core.processor
|
60
65
|
cmds = cmdproc.commands
|
data/processor/command/debug.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010, 2012 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2012, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require 'thread_frame'
|
4
4
|
require_relative '../command'
|
5
5
|
|
@@ -7,9 +7,9 @@ class Trepan::Command::DebugCommand < Trepan::Command
|
|
7
7
|
unless defined?(HELP)
|
8
8
|
NAME = File.basename(__FILE__, '.rb')
|
9
9
|
HELP = <<-HELP
|
10
|
-
|
10
|
+
**#{NAME}** *ruby-code*
|
11
11
|
|
12
|
-
Enter the debugger recursively on
|
12
|
+
Enter the debugger recursively on *ruby-code*.
|
13
13
|
HELP
|
14
14
|
|
15
15
|
CATEGORY = 'data'
|
@@ -27,12 +27,12 @@ Enter the debugger recursively on RUBY-CODE.
|
|
27
27
|
arg_str = args[1..-1].join(' ')
|
28
28
|
hidelevels = @proc.hidelevels[th]
|
29
29
|
|
30
|
-
stack_diff = RubyVM::Frame.current.stack_size - frame.stack_size
|
30
|
+
stack_diff = RubyVM::Frame.current.stack_size - frame.stack_size
|
31
31
|
|
32
32
|
# Ignore tracing in support routines:
|
33
33
|
# FIXME remvoe 1.9.3 hack
|
34
34
|
if '1.9.3' != RUBY_VERSION
|
35
|
-
tf = @proc.dbgr.trace_filter
|
35
|
+
tf = @proc.dbgr.trace_filter
|
36
36
|
[self.method(:run), @proc.method(:debug_eval),
|
37
37
|
@proc.method(:debug_eval_with_exception),
|
38
38
|
@proc.method(:get_binding_and_filename),
|
@@ -44,9 +44,9 @@ Enter the debugger recursively on RUBY-CODE.
|
|
44
44
|
@proc.hidelevels[th] += stack_diff + EXTRA_DEBUG_SETUP_CALLS
|
45
45
|
|
46
46
|
# Values we need to save before munging them
|
47
|
-
old_tracing = th.tracing
|
47
|
+
old_tracing = th.tracing?
|
48
48
|
old_exec_event_tracing = th.exec_event_tracing?
|
49
|
-
old_mutex = @proc.core.mutex
|
49
|
+
old_mutex = @proc.core.mutex
|
50
50
|
old_next_level = @proc.next_level
|
51
51
|
old_step_count = @proc.core.step_count
|
52
52
|
|
@@ -61,7 +61,7 @@ Enter the debugger recursively on RUBY-CODE.
|
|
61
61
|
|
62
62
|
RubyVM::Frame.current.trace_off = false
|
63
63
|
@proc.core.step_count = 0
|
64
|
-
retval = @proc.debug_eval(arg_str, 15,
|
64
|
+
retval = @proc.debug_eval(arg_str, 15,
|
65
65
|
RUBY_VERSION == '1.9.3') # FIXME
|
66
66
|
|
67
67
|
# Restore munged values
|
data/processor/command/down.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010, 2011, 2013 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative 'up'
|
4
4
|
|
5
|
-
# Debugger "down" command. Is the same as the "up" command with the
|
5
|
+
# Debugger "down" command. Is the same as the "up" command with the
|
6
6
|
# direction (set by DIRECTION) reversed.
|
7
7
|
class Trepan::Command::DownCommand < Trepan::Command::UpCommand
|
8
8
|
|
9
9
|
Trepan::Util.suppress_warnings {
|
10
|
-
old_verbose = $VERBOSE
|
10
|
+
old_verbose = $VERBOSE
|
11
11
|
$VERBOSE = nil
|
12
12
|
HELP = <<-HELP
|
13
13
|
#{NAME} [count]
|
14
14
|
|
15
15
|
Move the current frame down in the stack trace (to a newer frame). 0
|
16
|
-
is the most
|
16
|
+
is the most-recent frame. If no count is given, move down 1.
|
17
17
|
|
18
18
|
See also 'up' and 'frame'.
|
19
19
|
HELP
|
@@ -37,10 +37,10 @@ if __FILE__ == $0
|
|
37
37
|
|
38
38
|
def sep ; puts '=' * 40 end
|
39
39
|
cmd.run [cmd.name]
|
40
|
-
%w(-1 0 1 -2).each do |count|
|
40
|
+
%w(-1 0 1 -2).each do |count|
|
41
41
|
puts "#{cmd.name} #{count}"
|
42
42
|
cmd.run([cmd.name, count])
|
43
|
-
sep
|
43
|
+
sep
|
44
44
|
end
|
45
45
|
def foo(cmd, name)
|
46
46
|
cmd.proc.frame_setup(RubyVM::Frame::current)
|
data/processor/command/edit.rb
CHANGED
@@ -51,6 +51,10 @@ Examples:
|
|
51
51
|
errmsg "edit needs at most 2 args."
|
52
52
|
end
|
53
53
|
editor = ENV['EDITOR'] || '/bin/ex'
|
54
|
+
unless File.executable?(editor)
|
55
|
+
errmsg "Editor #{editor} is not executable. Trying anyway..."
|
56
|
+
end
|
57
|
+
|
54
58
|
if File.readable?(file)
|
55
59
|
file = File.basename(file) if settings[:basename]
|
56
60
|
edit_cmd = "#{editor} +#{line} \"#{file}\""
|
data/processor/command/eval.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2011, 2012 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative './../command'
|
4
4
|
require_relative '../../app/util'
|
5
5
|
|
@@ -19,7 +19,7 @@ next to the inspect output of the value.
|
|
19
19
|
|
20
20
|
If no string is given, we run the string from the current source code
|
21
21
|
about to be run. If the command ends ? (via an alias) and no string is
|
22
|
-
given
|
22
|
+
given, the following translations occur:
|
23
23
|
|
24
24
|
{if|elsif|unless} expr [then] => expr
|
25
25
|
{until|while} expr [do] => expr
|
data/processor/command/exit.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../command'
|
3
3
|
class Trepan::Command::ExitCommand < Trepan::Command
|
4
4
|
|
5
5
|
unless defined?(HELP)
|
6
6
|
NAME = File.basename(__FILE__, '.rb')
|
7
7
|
HELP = <<-HELP
|
8
|
-
|
8
|
+
**#{NAME}** [*exitcode*]
|
9
9
|
|
10
|
-
hard exit of the debugged program.
|
10
|
+
hard exit of the debugged program.
|
11
11
|
|
12
|
-
The program being debugged is exited via exit!() which does not run
|
13
|
-
the Kernel at_exit finalizers. If a return code is given, that is
|
14
|
-
return code passed to exit() - presumably the return code that
|
15
|
-
passed back to the OS. If no exit code is given, 0 is used.
|
12
|
+
The program being debugged is exited via *exit!()* which does not run
|
13
|
+
the Kernel *at_exit()* finalizers. If a return code is given, that is
|
14
|
+
the return code passed to exit() - presumably the return code that
|
15
|
+
will be passed back to the OS. If no exit code is given, 0 is used.
|
16
16
|
|
17
|
-
See also
|
17
|
+
See also:
|
18
|
+
---------
|
19
|
+
|
20
|
+
`quit` and `kill`.
|
18
21
|
HELP
|
19
22
|
|
20
23
|
CATEGORY = 'support'
|
@@ -27,7 +30,7 @@ See also the commands "quit" and "kill".
|
|
27
30
|
|
28
31
|
# This method runs the command
|
29
32
|
def run(args)
|
30
|
-
unconditional =
|
33
|
+
unconditional =
|
31
34
|
if args.size > 1 && args[1] == 'unconditionally'
|
32
35
|
args.shift
|
33
36
|
true
|
data/processor/command/finish.rb
CHANGED
@@ -1,42 +1,44 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# Copyright (C) 2010-2012 Rocky Bernstein <rockyb@rubyforge.net>
|
2
|
+
# Copyright (C) 2010-2012, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
3
3
|
require_relative '../command'
|
4
4
|
|
5
5
|
class Trepan::Command::FinishCommand < Trepan::Command
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
unless defined?(HELP)
|
8
|
+
NAME = File.basename(__FILE__, '.rb')
|
9
|
+
HELP = <<-HELP
|
10
|
+
**#{NAME}** [*levels*]
|
11
11
|
|
12
12
|
Continue execution until the program is about to:
|
13
13
|
|
14
|
-
* leave the current function, or
|
15
|
-
* switch context via yielding back or finishing a block which was
|
16
|
-
yielded to.
|
14
|
+
* leave the current function, or
|
15
|
+
* switch context via yielding back or finishing a block which was yielded to.
|
17
16
|
|
18
|
-
Sometimes this is called
|
17
|
+
Sometimes this is called "step out".
|
19
18
|
|
20
|
-
When
|
21
|
-
popped. The default is 1. Note that
|
22
|
-
reduce the number of stack frames. Also, if a thread is
|
23
|
-
stop ignoring levels.
|
19
|
+
When *levels* is specified, that many frame levels need to be
|
20
|
+
popped. The default is 1. Note that running a *yield* or raing an
|
21
|
+
exception may reduce the number of stack frames. Also, if a thread is
|
22
|
+
switched, we stop ignoring levels.
|
24
23
|
|
25
|
-
|
24
|
+
`next>` is similar in that it stops at a return, but it doesn't
|
26
25
|
guarantee the stack level is the same as or less than the current
|
27
|
-
one.
|
26
|
+
one.
|
28
27
|
|
29
|
-
See
|
30
|
-
|
31
|
-
|
28
|
+
See also:
|
29
|
+
--------
|
30
|
+
|
31
|
+
The `break` command if you want to stop at a particular point in a
|
32
|
+
program. In general, `#{NAME}`, `step` and `next` may slow a program
|
33
|
+
down while `break` will have less overhead.
|
32
34
|
|
33
35
|
HELP
|
34
36
|
ALIASES = %w(fin)
|
35
37
|
CATEGORY = 'running'
|
36
38
|
# execution_set = ['Running']
|
37
39
|
|
38
|
-
# Need at most this many.
|
39
|
-
MAX_ARGS = 1
|
40
|
+
# Need at most this many.
|
41
|
+
MAX_ARGS = 1
|
40
42
|
NEED_STACK = true
|
41
43
|
SHORT_HELP = 'Step to end of current method (step out)'
|
42
44
|
end
|
@@ -50,15 +52,15 @@ while 'break' will have less overhead.
|
|
50
52
|
else
|
51
53
|
count_str = args[1]
|
52
54
|
opts = {
|
53
|
-
:msg_on_error =>
|
54
|
-
"The '#{NAME}' command argument must eval to an integer. Got: %s" %
|
55
|
+
:msg_on_error =>
|
56
|
+
"The '#{NAME}' command argument must eval to an integer. Got: %s" %
|
55
57
|
count_str,
|
56
58
|
:min_value => 1
|
57
59
|
}
|
58
60
|
count = @proc.get_an_int(count_str, opts)
|
59
61
|
return unless count
|
60
62
|
# step 1 is core.level_count = 0 or "stop next event"
|
61
|
-
level_count = count - 1
|
63
|
+
level_count = count - 1
|
62
64
|
end
|
63
65
|
if 0 == level_count and %w(return c-return yield leave).member?(@proc.event)
|
64
66
|
errmsg "You are already at the requested return event."
|
data/processor/command/frame.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2010,
|
1
|
+
# Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
|
2
2
|
require_relative '../command'
|
3
3
|
require_relative '../../app/frame'
|
4
4
|
|
@@ -7,10 +7,11 @@ class Trepan::Command::FrameCommand < Trepan::Command
|
|
7
7
|
include Trepan::Frame
|
8
8
|
|
9
9
|
unless defined?(HELP)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
NAME = File.basename(__FILE__, '.rb')
|
11
|
+
HELP = <<-HELP
|
12
|
+
**#{NAME}** [*thread-Name*] [*frame-number*]
|
13
|
+
|
14
|
+
Change the current frame to frame `*rame-number* if specified, or the
|
14
15
|
most-recent frame, 0, if no frame number specified.
|
15
16
|
|
16
17
|
If a thread name or thread number is given, change the current frame
|
@@ -18,56 +19,59 @@ to a frame in that thread. Dot (.) can be used to indicate the name of
|
|
18
19
|
the current frame the debugger is stopped in.
|
19
20
|
|
20
21
|
A negative number indicates the position from the other or
|
21
|
-
least-recently-entered end. So
|
22
|
+
least-recently-entered end. So `frame -1` moves to the oldest frame.
|
22
23
|
Any variable or expression that evaluates to a number can be used as a
|
23
24
|
position, however due to parsing limitations, the position expression
|
24
25
|
has to be seen as a single blank-delimited parameter. That is, the
|
25
26
|
expression '(5*3)-1' is okay while '( (5 * 3) - 1 )' isn't.
|
26
27
|
|
27
28
|
Examples:
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
---------
|
30
|
+
|
31
|
+
frame # Set current frame at the current stopping point
|
32
|
+
frame 0 # Same as above
|
33
|
+
frame 5-5 # Same as above. Note: no spaces allowed in expression 5-5
|
34
|
+
frame . # Same as above. 'current thread' is explicit.
|
35
|
+
frame . 0 # Same as above.
|
36
|
+
frame 1 # Move to frame 1. Same as: frame 0; up
|
37
|
+
frame -1 # The least-recent frame
|
38
|
+
frame MainThread 0 # Switch to frame 0 of thread MainThread
|
39
|
+
frame MainThread # Same as above
|
40
|
+
frame -2434343 0 # Use a thread number instead of name
|
41
|
+
|
42
|
+
See also:
|
43
|
+
---------
|
44
|
+
`up`, `down`, `where`, and `info thread`.
|
45
|
+
HELP
|
41
46
|
|
42
47
|
CATEGORY = 'stack'
|
43
48
|
MAX_ARGS = 2 # Need at most this many
|
44
|
-
NAME = File.basename(__FILE__, '.rb')
|
45
49
|
NEED_STACK = true
|
46
50
|
SHORT_HELP = 'Select and print a stack frame'
|
47
51
|
end
|
48
|
-
|
52
|
+
|
49
53
|
def complete(prefix)
|
50
54
|
@proc.frame_complete(prefix, nil)
|
51
55
|
end
|
52
|
-
|
56
|
+
|
53
57
|
# The simple case: thread frame switching has been done or is
|
54
58
|
# not needed and we have an explicit position number as a string
|
55
59
|
def one_arg_run(position_str)
|
56
60
|
low, high = @proc.frame_low_high(nil)
|
57
61
|
opts={
|
58
|
-
:msg_on_error =>
|
62
|
+
:msg_on_error =>
|
59
63
|
"The '#{NAME}' command requires a frame number. Got: #{position_str}",
|
60
64
|
:min_value => low, :max_value => high
|
61
65
|
}
|
62
66
|
frame_num = @proc.get_an_int(position_str, opts)
|
63
67
|
return false unless frame_num
|
64
|
-
|
68
|
+
|
65
69
|
# FIXME: move into @proc and test based on NEED_STACK.
|
66
70
|
if not @proc.top_frame
|
67
71
|
errmsg('No frames recorded.')
|
68
72
|
return false
|
69
73
|
end
|
70
|
-
|
74
|
+
|
71
75
|
@proc.adjust_frame(frame_num, true)
|
72
76
|
return true
|
73
77
|
end
|
@@ -82,7 +86,7 @@ See also 'up', 'down' 'where' and 'info thread'.
|
|
82
86
|
# Form is: "frame position"
|
83
87
|
position_str = args[1]
|
84
88
|
elsif args.size == 3
|
85
|
-
# Form is: frame <position> <thread>
|
89
|
+
# Form is: frame <position> <thread>
|
86
90
|
name_or_id = args[1]
|
87
91
|
thread_str = args[2]
|
88
92
|
th = @proc.get_thread_from_string(thread_str)
|