line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
|
|
|
# Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org> |
3
|
12
|
|
|
12
|
|
101
|
use warnings; use utf8; |
|
12
|
|
|
12
|
|
35
|
|
|
12
|
|
|
1
|
|
392
|
|
|
12
|
|
|
1
|
|
73
|
|
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
115
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
12
|
|
|
12
|
|
326
|
use rlib '../../../..'; |
|
12
|
|
|
1
|
|
31
|
|
|
12
|
|
|
|
|
83
|
|
|
1
|
|
|
|
|
25
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# rlib '../running' |
8
|
|
|
|
|
|
|
# rlib '../../app/breakpoint' # FIXME: possibly temporary |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Finish; |
11
|
|
|
|
|
|
|
|
12
|
12
|
|
|
12
|
|
4484
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
12
|
|
|
1
|
|
31
|
|
|
12
|
|
|
|
|
72
|
|
|
1
|
|
|
|
|
386
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
13
|
12
|
|
|
12
|
|
1796
|
use vars qw(@ISA); |
|
12
|
|
|
1
|
|
33
|
|
|
12
|
|
|
|
|
772
|
|
|
1
|
|
|
|
|
34
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
14
|
|
|
|
|
|
|
unless (@ISA) { |
15
|
12
|
|
|
12
|
|
85
|
eval <<'EOE'; |
|
12
|
|
|
12
|
|
30
|
|
|
12
|
|
|
12
|
|
716
|
|
|
12
|
|
|
12
|
|
96
|
|
|
12
|
|
|
12
|
|
31
|
|
|
12
|
|
|
12
|
|
579
|
|
|
12
|
|
|
|
|
78
|
|
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
555
|
|
|
12
|
|
|
|
|
75
|
|
|
12
|
|
|
|
|
37
|
|
|
12
|
|
|
|
|
543
|
|
|
12
|
|
|
|
|
81
|
|
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
547
|
|
|
12
|
|
|
|
|
80
|
|
|
12
|
|
|
|
|
37
|
|
|
12
|
|
|
|
|
490
|
|
16
|
|
|
|
|
|
|
use constant ALIASES => qw(fin); |
17
|
|
|
|
|
|
|
use constant CATEGORY => 'running'; |
18
|
|
|
|
|
|
|
use constant SHORT_HELP => 'Step to end of current method (step out)'; |
19
|
|
|
|
|
|
|
use constant MIN_ARGS => 0; # Need at least this many |
20
|
|
|
|
|
|
|
use constant MAX_ARGS => 1; # Need at most this many |
21
|
|
|
|
|
|
|
use constant NEED_STACK => 1; |
22
|
|
|
|
|
|
|
EOE |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
12
|
|
|
12
|
|
77
|
use strict; |
|
12
|
|
|
1
|
|
31
|
|
|
12
|
|
|
|
|
498
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
26
|
|
|
|
|
|
|
@ISA = @CMD_ISA; |
27
|
12
|
|
|
12
|
|
78
|
use vars @CMD_VARS; # Value inherited from parent |
|
12
|
|
|
1
|
|
35
|
|
|
12
|
|
|
|
|
1378
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
118
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $NAME = set_name(); |
30
|
|
|
|
|
|
|
=pod |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 Synopsis: |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
our $HELP = <<'HELP'; |
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
B<finish> [I<levels>] |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Continue execution until the program is about to leave the current |
41
|
|
|
|
|
|
|
function. Sometimes this is called "step out". |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
When integer I<levels> is specified, that many frame levels need to be |
44
|
|
|
|
|
|
|
popped. The default is 1. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 See also: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
L<C<break>|Devel::Trepan::CmdProcessor::Command::Break>, |
49
|
|
|
|
|
|
|
L<C<continue>|Devel::Trepan::CmdProcessor::Command::Continue>, |
50
|
|
|
|
|
|
|
L<C<next> (step over)|Devel::Trepan::CmdProcessor::Command::Next>, and |
51
|
|
|
|
|
|
|
L<C<step> (step into)|Devel::Trepan::CmdProcessor::Command::Step>. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
HELP |
55
|
|
|
|
|
|
|
|
56
|
12
|
|
|
12
|
|
76
|
no warnings 'redefine'; |
|
12
|
|
|
1
|
|
39
|
|
|
12
|
|
|
|
|
3136
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
236
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# This method runs the command |
59
|
|
|
|
|
|
|
sub run($$) { |
60
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
0
|
|
|
0
|
0
|
|
|
61
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $event = $proc->{event}; |
|
0
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
if ($event eq 'return') { |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$proc->errmsg("Can't run ${NAME} while inside a return. Step and try again."); |
|
0
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return; |
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} elsif ($event eq 'call') { |
67
|
0
|
|
|
|
|
|
$proc->errmsg("Can't run ${NAME} while inside a call. Step and try again."); |
|
0
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return; |
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my ($opts, $level_count) = ({}, 1); |
|
0
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if (scalar @$args != 1) { |
|
0
|
0
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Form is not "finish" which means "finish 1" |
74
|
0
|
|
|
|
|
|
my $count_str = $args->[1]; |
|
0
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
$opts = { |
|
0
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
msg_on_error => |
77
|
|
|
|
|
|
|
"The '${NAME}' command argument must eval to an integer. Got: ${count_str}", |
78
|
|
|
|
|
|
|
min_value => 1 |
79
|
|
|
|
|
|
|
}; |
80
|
0
|
|
|
|
|
|
my $count = $proc->get_an_int($count_str, $opts); |
|
0
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
return unless defined $count; |
|
0
|
0
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$level_count = $count; |
|
0
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
84
|
0
|
|
|
|
|
|
$proc->finish($level_count); |
|
0
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
unless (caller) { |
88
|
|
|
|
|
|
|
# require_relative '../mock' |
89
|
|
|
|
|
|
|
# dbgr, cmd = MockDebugger::setup |
90
|
|
|
|
|
|
|
# p cmd.run([cmd.name]) |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |