File Coverage

lib/Devel/ebug/Plugin/ActionPoints.pm
Criterion Covered Total %
statement 47 47 100.0
branch 4 4 100.0
condition n/a
subroutine 11 11 100.0
pod 0 8 0.0
total 62 70 88.5


line stmt bran cond sub pod time code
1             package Devel::ebug::Plugin::ActionPoints;
2              
3 19     19   11371 use strict;
  19         37  
  19         555  
4 19     19   108 use warnings;
  19         34  
  19         509  
5 19     19   89 use base qw(Exporter);
  19         33  
  19         13329  
6             our @EXPORT = qw(break_point break_point_delete break_point_subroutine break_points break_points_with_condition all_break_points_with_condition watch_point break_on_load);
7              
8             our $VERSION = '0.63'; # VERSION
9              
10             # set a break point (by default in the current file)
11             sub break_point {
12 21     21 0 3595 my $self = shift;
13 21         95 my($filename, $line, $condition);
14 21 100       195 if ($_[0] =~ /^\d+$/) {
15 17         81 $filename = $self->filename;
16             } else {
17 4         46 $filename = shift;
18             }
19 21         188 ($line, $condition) = @_;
20 21         244 my $response = $self->talk({
21             command => "break_point",
22             filename => $filename,
23             line => $line,
24             condition => $condition,
25             });
26 21         160 return $response->{line};
27             }
28              
29             # delete a break point (by default in the current file)
30             sub break_point_delete {
31 2     2 0 32 my $self = shift;
32 2         6 my($filename, $line);
33 2         4 my $first = shift;
34 2 100       13 if ($first =~ /^\d+$/) {
35 1         2 $line = $first;
36 1         8 $filename = $self->filename;
37             } else {
38 1         3 $filename = $first;
39 1         3 $line = shift;
40             }
41              
42 2         21 my $response = $self->talk({
43             command => "break_point_delete",
44             filename => $filename,
45             line => $line,
46             });
47             }
48              
49             # set a break point
50             sub break_point_subroutine {
51 7     7 0 1690 my($self, $subroutine) = @_;
52 7         88 my $response = $self->talk({
53             command => "break_point_subroutine",
54             subroutine => $subroutine,
55             });
56 7         74 return $response->{line};
57             }
58              
59             # list break points
60             sub break_points {
61 5     5 0 129 my($self, $filename) = @_;
62 5         41 my $response = $self->talk({
63             command => "break_points",
64             filename => $filename,
65             });
66 5         18 return @{$response->{break_points}};
  5         89  
67             }
68              
69             # list break points with condition
70             sub break_points_with_condition {
71 2     2 0 33 my($self, $filename) = @_;
72 2         19 my $response = $self->talk({
73             command => "break_points_with_condition",
74             filename => $filename,
75             });
76 2         12 return @{$response->{break_points}};
  2         73  
77             }
78              
79             # list break points with condition for the whole program
80             sub all_break_points_with_condition {
81 1     1 0 3 my($self, $filename) = @_;
82 1         19 my $response = $self->talk({
83             command => "all_break_points_with_condition",
84             filename => $filename,
85             });
86 1         4 return @{$response->{break_points}};
  1         55  
87             }
88              
89              
90             # set a watch point
91             sub watch_point {
92 4     4 0 158 my($self, $watch_point) = @_;
93 4         27 my $response = $self->talk({
94             command => "watch_point",
95             watch_point => $watch_point,
96             });
97             }
98              
99              
100             # set a break point on file loading
101             sub break_on_load {
102 2     2 0 104 my $self = shift;
103 2         7 my($filename) = @_;
104              
105 2         12 my $response = $self->talk({
106             command => "break_on_load",
107             filename => $filename,
108             });
109 2         12 return $response->{line};
110             }
111              
112             1;
113              
114             __END__