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   11600 use strict;
  19         35  
  19         558  
4 19     19   99 use warnings;
  19         32  
  19         523  
5 19     19   84 use base qw(Exporter);
  19         38  
  19         13938  
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.64'; # VERSION
9              
10             # set a break point (by default in the current file)
11             sub break_point {
12 21     21 0 3791 my $self = shift;
13 21         100 my($filename, $line, $condition);
14 21 100       224 if ($_[0] =~ /^\d+$/) {
15 17         91 $filename = $self->filename;
16             } else {
17 4         34 $filename = shift;
18             }
19 21         236 ($line, $condition) = @_;
20 21         269 my $response = $self->talk({
21             command => "break_point",
22             filename => $filename,
23             line => $line,
24             condition => $condition,
25             });
26 21         165 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 43 my $self = shift;
32 2         7 my($filename, $line);
33 2         5 my $first = shift;
34 2 100       18 if ($first =~ /^\d+$/) {
35 1         3 $line = $first;
36 1         5 $filename = $self->filename;
37             } else {
38 1         3 $filename = $first;
39 1         3 $line = shift;
40             }
41              
42 2         34 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 1714 my($self, $subroutine) = @_;
52 7         94 my $response = $self->talk({
53             command => "break_point_subroutine",
54             subroutine => $subroutine,
55             });
56 7         100 return $response->{line};
57             }
58              
59             # list break points
60             sub break_points {
61 5     5 0 133 my($self, $filename) = @_;
62 5         72 my $response = $self->talk({
63             command => "break_points",
64             filename => $filename,
65             });
66 5         18 return @{$response->{break_points}};
  5         109  
67             }
68              
69             # list break points with condition
70             sub break_points_with_condition {
71 2     2 0 28 my($self, $filename) = @_;
72 2         24 my $response = $self->talk({
73             command => "break_points_with_condition",
74             filename => $filename,
75             });
76 2         8 return @{$response->{break_points}};
  2         35  
77             }
78              
79             # list break points with condition for the whole program
80             sub all_break_points_with_condition {
81 1     1 0 4 my($self, $filename) = @_;
82 1         15 my $response = $self->talk({
83             command => "all_break_points_with_condition",
84             filename => $filename,
85             });
86 1         4 return @{$response->{break_points}};
  1         24  
87             }
88              
89              
90             # set a watch point
91             sub watch_point {
92 4     4 0 129 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 147 my $self = shift;
103 2         8 my($filename) = @_;
104              
105 2         16 my $response = $self->talk({
106             command => "break_on_load",
107             filename => $filename,
108             });
109 2         15 return $response->{line};
110             }
111              
112             1;
113              
114             __END__