line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
|
|
|
# Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org> |
3
|
12
|
|
|
12
|
|
158
|
use warnings; no warnings 'redefine'; |
|
12
|
|
|
12
|
|
35
|
|
|
12
|
|
|
1
|
|
484
|
|
|
12
|
|
|
1
|
|
72
|
|
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
466
|
|
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
47
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
54
|
|
4
|
|
|
|
|
|
|
|
5
|
12
|
|
|
12
|
|
72
|
use rlib '../../../..'; |
|
12
|
|
|
1
|
|
29
|
|
|
12
|
|
|
|
|
81
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# require_relative '../../app/condition' |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Step; |
10
|
|
|
|
|
|
|
|
11
|
12
|
|
|
12
|
|
4436
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
12
|
|
|
1
|
|
36
|
|
|
12
|
|
|
|
|
83
|
|
|
1
|
|
|
|
|
565
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
9
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
unless (@ISA) { |
14
|
12
|
|
|
12
|
|
82
|
eval <<'EOE'; |
|
12
|
|
|
12
|
|
36
|
|
|
12
|
|
|
12
|
|
827
|
|
|
12
|
|
|
12
|
|
80
|
|
|
12
|
|
|
12
|
|
41
|
|
|
12
|
|
|
12
|
|
583
|
|
|
12
|
|
|
|
|
79
|
|
|
12
|
|
|
|
|
32
|
|
|
12
|
|
|
|
|
543
|
|
|
12
|
|
|
|
|
74
|
|
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
522
|
|
|
12
|
|
|
|
|
85
|
|
|
12
|
|
|
|
|
35
|
|
|
12
|
|
|
|
|
558
|
|
|
12
|
|
|
|
|
80
|
|
|
12
|
|
|
|
|
37
|
|
|
12
|
|
|
|
|
536
|
|
15
|
|
|
|
|
|
|
use constant ALIASES => qw(s step+ step- s+ s-); |
16
|
|
|
|
|
|
|
use constant CATEGORY => 'running'; |
17
|
|
|
|
|
|
|
use constant SHORT_HELP => 'Step program (possibly entering called functions)'; |
18
|
|
|
|
|
|
|
use constant MIN_ARGS => 0; # Need at least this many |
19
|
|
|
|
|
|
|
use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited. |
20
|
|
|
|
|
|
|
use constant NEED_STACK => 1; |
21
|
|
|
|
|
|
|
EOE |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
12
|
|
|
12
|
|
2149
|
use strict; |
|
12
|
|
|
1
|
|
39
|
|
|
12
|
|
|
|
|
307
|
|
|
1
|
|
|
|
|
101
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
42
|
|
25
|
12
|
|
|
12
|
|
70
|
use vars qw(@ISA); @ISA = @CMD_ISA; |
|
12
|
|
|
1
|
|
36
|
|
|
12
|
|
|
|
|
652
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
85
|
|
26
|
12
|
|
|
12
|
|
77
|
use vars @CMD_VARS; # Value inherited from parent |
|
12
|
|
|
1
|
|
38
|
|
|
12
|
|
|
|
|
3996
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
547
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$NAME = set_name(); |
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 Synopsis: |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
$HELP = <<'HELP'; |
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
B<step>[B<+>|B<->] [B<into>] [I<count>] |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
B<step over> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
B<step out> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Execute the current line, stopping at the next event. Sometimes this |
44
|
|
|
|
|
|
|
is called "step into". |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
With an integer argument, step that many times. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
A suffix of C<+> in a command or an alias forces a move to another |
49
|
|
|
|
|
|
|
position, while a suffix of C<-> disables this requirement. A suffix |
50
|
|
|
|
|
|
|
of C<E<gt>> will continue until the next call. (C<finish> will run until |
51
|
|
|
|
|
|
|
the return for that call.) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
If no suffix is given, the debugger setting C<different> determines |
54
|
|
|
|
|
|
|
this behavior. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 Examples: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
step # step 1 event, any event obeying 'set different' setting |
59
|
|
|
|
|
|
|
step 1 # same as above |
60
|
|
|
|
|
|
|
step+ # same but force stopping on a new line |
61
|
|
|
|
|
|
|
step- # same but force stopping on a new line a new frame added |
62
|
|
|
|
|
|
|
step over # same as 'next' |
63
|
|
|
|
|
|
|
step out # same as 'finish' |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 See also: |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
L<C<next> (step over)|Devel::Trepan::CmdProcessor::Command::Step>, |
68
|
|
|
|
|
|
|
L<C<finish> (step out)|Devel::Trepan::CmdProcessor::Command::Finish>, |
69
|
|
|
|
|
|
|
L<C<continue>|Devel::Trepan::CmdProcessor::Command::Continue>, and |
70
|
|
|
|
|
|
|
L<C<set different>|Devel::Trepan::CmdProcessor::Command::Set::Different>. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
HELP |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $Keyword_to_related_cmd = { |
76
|
|
|
|
|
|
|
'out' => 'finish', |
77
|
|
|
|
|
|
|
'over' => 'next', |
78
|
|
|
|
|
|
|
'into' => 'step', |
79
|
|
|
|
|
|
|
}; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# include Trepan::Condition |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# This method runs the command |
84
|
|
|
|
|
|
|
sub run($$) { |
85
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
0
|
|
|
0
|
0
|
|
|
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $opts = $proc->parse_next_step_suffix($args->[0]); |
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# condition = nil |
90
|
0
|
0
|
|
|
|
|
if (0 == $#$args) { |
|
0
|
0
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Form is: "step" which means "step 1" |
92
|
0
|
|
|
|
|
|
$proc->{skip_count} = 0; |
|
0
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
|
my $replace_cmd = $Keyword_to_related_cmd->{$args->[1]}; |
|
0
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
if (defined($replace_cmd)) { |
|
0
|
0
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my $cmd = $proc->{commands}{$replace_cmd}; |
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return $cmd->run( [$replace_cmd, splice(@$args, 2)] ); |
|
0
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# } elsif ('until' eq $args->[1]) { |
99
|
|
|
|
|
|
|
# my $try_condition = join(@$args[2..-1], ' '); |
100
|
|
|
|
|
|
|
# if (valid_condition?(try_condition)) { |
101
|
|
|
|
|
|
|
# $condition = $try_condition; |
102
|
|
|
|
|
|
|
# $opts-{different_pos} = 0; |
103
|
|
|
|
|
|
|
# $proc->{skip_count} = 0; |
104
|
|
|
|
|
|
|
# } |
105
|
|
|
|
|
|
|
# elsif('to' eq $args[1]) { |
106
|
|
|
|
|
|
|
# if args.size != 3; |
107
|
|
|
|
|
|
|
# $self->errmsg('Expecting a method name after "to"'); |
108
|
|
|
|
|
|
|
# return; |
109
|
|
|
|
|
|
|
# elsif (!@proc.method?(args[2])) { |
110
|
|
|
|
|
|
|
# $self->errmsg("${args[2]} doesn't seem to be a method name"); |
111
|
|
|
|
|
|
|
# return; |
112
|
|
|
|
|
|
|
# } else { |
113
|
|
|
|
|
|
|
# $opts->{to_method{ = $args->[2]; |
114
|
|
|
|
|
|
|
# $opts->{different_pos} = 0; |
115
|
|
|
|
|
|
|
# skip_count = 0 |
116
|
|
|
|
|
|
|
# } |
117
|
|
|
|
|
|
|
# } elsif ('thread' eq $args->[1]) { |
118
|
|
|
|
|
|
|
# $condition = "Thread.current.object_id == ${Thread.current.object_id}" |
119
|
|
|
|
|
|
|
# $opts[:different_pos] = 0; |
120
|
|
|
|
|
|
|
# $proc->{skip_count] = 0; |
121
|
|
|
|
|
|
|
} else { |
122
|
0
|
|
|
|
|
|
my $count_str = $args->[1]; |
|
0
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
my $int_opts = { |
|
0
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
msg_on_error => |
125
|
|
|
|
|
|
|
"The 'step' command argument must eval to an integer. Got: ${count_str}", |
126
|
|
|
|
|
|
|
min_value => 1 |
127
|
|
|
|
|
|
|
}; |
128
|
|
|
|
|
|
|
# }.merge(opts) |
129
|
0
|
|
|
|
|
|
my $count = $proc->get_an_int($count_str, $int_opts); |
|
0
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
return unless defined($count); |
|
0
|
0
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# step 1 is $proc->{skip_count} = 0 or "stop next event" |
132
|
0
|
|
|
|
|
|
$proc->{skip_count} = $count - 1 ; |
|
0
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
} |
135
|
0
|
|
|
|
|
|
$proc->step($opts) |
|
0
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
unless (caller) { |
139
|
|
|
|
|
|
|
# require_relative '../mock' |
140
|
|
|
|
|
|
|
# dbgr, cmd = MockDebugger::setup |
141
|
|
|
|
|
|
|
# p cmd.run([cmd.name]) |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
1; |