| 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
|
|
185
|
use warnings; no warnings 'redefine'; |
|
|
12
|
|
|
12
|
|
40
|
|
|
|
12
|
|
|
1
|
|
925
|
|
|
|
12
|
|
|
1
|
|
435
|
|
|
|
12
|
|
|
|
|
27
|
|
|
|
12
|
|
|
|
|
931
|
|
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
26
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
46
|
|
|
4
|
12
|
|
|
12
|
|
74
|
use rlib '../../../..'; |
|
|
12
|
|
|
1
|
|
443
|
|
|
|
12
|
|
|
|
|
272
|
|
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Action; |
|
7
|
12
|
|
|
12
|
|
7087
|
use English qw( -no_match_vars ); |
|
|
12
|
|
|
1
|
|
38
|
|
|
|
12
|
|
|
|
|
240
|
|
|
|
1
|
|
|
|
|
370
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
35
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
14046
|
use if !@ISA, Devel::Trepan::Condition ; |
|
|
12
|
|
|
1
|
|
124
|
|
|
|
12
|
|
|
|
|
257
|
|
|
|
1
|
|
|
|
|
299
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
10
|
12
|
|
|
12
|
|
17149
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
|
12
|
|
|
1
|
|
24
|
|
|
|
12
|
|
|
|
|
66
|
|
|
|
1
|
|
|
|
|
36
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
3
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
unless (@ISA) { |
|
13
|
12
|
|
|
12
|
|
85
|
eval <<"EOE"; |
|
|
12
|
|
|
12
|
|
247
|
|
|
|
12
|
|
|
12
|
|
1373
|
|
|
|
12
|
|
|
12
|
|
76
|
|
|
|
12
|
|
|
12
|
|
32
|
|
|
|
12
|
|
|
12
|
|
691
|
|
|
|
12
|
|
|
|
|
83
|
|
|
|
12
|
|
|
|
|
27
|
|
|
|
12
|
|
|
|
|
1089
|
|
|
|
12
|
|
|
|
|
89
|
|
|
|
12
|
|
|
|
|
39
|
|
|
|
12
|
|
|
|
|
796
|
|
|
|
12
|
|
|
|
|
88
|
|
|
|
12
|
|
|
|
|
33
|
|
|
|
12
|
|
|
|
|
1000
|
|
|
|
12
|
|
|
|
|
71
|
|
|
|
12
|
|
|
|
|
54
|
|
|
|
12
|
|
|
|
|
523
|
|
|
14
|
|
|
|
|
|
|
use constant ALIASES => qw(a); |
|
15
|
|
|
|
|
|
|
use constant CATEGORY => 'breakpoints'; |
|
16
|
|
|
|
|
|
|
use constant NEED_STACK => 0; |
|
17
|
|
|
|
|
|
|
use constant MIN_ARGS => 2; # Need at least this many |
|
18
|
|
|
|
|
|
|
use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited. |
|
19
|
|
|
|
|
|
|
use constant SHORT_HELP => |
|
20
|
|
|
|
|
|
|
'Set an action to be done before the line is executed.'; |
|
21
|
|
|
|
|
|
|
EOE |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
12
|
|
|
12
|
|
84880
|
use strict; use vars qw(@ISA); @ISA = @CMD_ISA; |
|
|
12
|
|
|
12
|
|
30
|
|
|
|
12
|
|
|
1
|
|
256
|
|
|
|
12
|
|
|
1
|
|
55
|
|
|
|
12
|
|
|
|
|
30
|
|
|
|
12
|
|
|
|
|
553
|
|
|
|
1
|
|
|
|
|
65
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
56
|
|
|
25
|
12
|
|
|
12
|
|
66
|
use vars @CMD_VARS; # Value inherited from parent |
|
|
12
|
|
|
1
|
|
27
|
|
|
|
12
|
|
|
|
|
5573
|
|
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
363
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $NAME = set_name(); |
|
28
|
|
|
|
|
|
|
=pod |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 Synopsis: |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
|
33
|
|
|
|
|
|
|
our $HELP = <<'HELP'; |
|
34
|
|
|
|
|
|
|
=pod |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
B<action> I<position> I<Perl-statement> |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Set an action to be done before the line is executed. If line is |
|
39
|
|
|
|
|
|
|
C<.>, set an action on the line about to be executed. The sequence |
|
40
|
|
|
|
|
|
|
of steps taken by the debugger is: |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item 1. |
|
45
|
|
|
|
|
|
|
check for a breakpoint at this line |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item 2. |
|
48
|
|
|
|
|
|
|
print the line if necessary (tracing) |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item 3. |
|
51
|
|
|
|
|
|
|
do any actions associated with that line |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item 4. |
|
54
|
|
|
|
|
|
|
prompt user if at a breakpoint or in single-step |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item 5. |
|
57
|
|
|
|
|
|
|
evaluate line |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=back |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
For example, this will print out the value of C<$foo> every time line |
|
62
|
|
|
|
|
|
|
53 is passed: |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 Examples: |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
action 53 print "DB FOUND $foo\n" |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 See also: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
C<help breakpoints> |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
HELP |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# This method runs the command |
|
76
|
|
|
|
|
|
|
sub run($$) { |
|
77
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
|
0
|
|
|
0
|
0
|
|
|
|
78
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
|
0
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $frame = $proc->{frame}; |
|
|
0
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my @args = @$args; |
|
|
0
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
shift @args; |
|
|
0
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my ($filename, $lineno, $fn, $gobble_count, $rest) = |
|
|
0
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$proc->parse_position(\@args, 0); # should be: , 1); |
|
85
|
0
|
0
|
|
|
|
|
shift @args if $gobble_count-- > 0; |
|
|
0
|
0
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
shift @args if $gobble_count-- > 0; |
|
|
0
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# error should have been shown previously |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my $action_expression = join(' ', @args); |
|
|
0
|
|
|
|
|
|
|
|
90
|
0
|
0
|
|
|
|
|
unless (is_valid_condition($action_expression)) { |
|
|
0
|
0
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$proc->errmsg("Invalid action: $action_expression"); |
|
|
0
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
return |
|
93
|
0
|
|
|
|
|
|
} |
|
|
0
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $action = $self->{dbgr}->set_action($lineno, $filename, |
|
|
0
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
$action_expression); |
|
96
|
0
|
0
|
|
|
|
|
if ($action) { |
|
|
0
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $id = $action->id; |
|
|
0
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $filename = $proc->canonic_file($action->filename); |
|
|
0
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $line_num = $action->line_num; |
|
|
0
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
$proc->{actions}->add($action); |
|
|
0
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
$proc->msg("Action $id set in $filename at line $line_num"); |
|
|
0
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
unless (caller) { |
|
107
|
|
|
|
|
|
|
require Devel::Trepan::CmdProcessor::Mock; |
|
108
|
|
|
|
|
|
|
my $proc = Devel::Trepan::CmdProcessor::Mock::setup(); |
|
109
|
|
|
|
|
|
|
# my $cmd = __PACKAGE__->new($proc); |
|
110
|
|
|
|
|
|
|
# $cmd->run([$NAME]); |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |