1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
package Devel::ebug::Plugin::ActionPoints;
use strict;
use warnings;
use base qw(Exporter);
our @EXPORT = qw(break_point break_point_delete break_point_subroutine break_points break_points_with_condition all_break_points_with_condition watch_point);
# set a break point (by default in the current file)
sub break_point {
my $self = shift;
my($filename, $line, $condition);
if ($_[0] =~ /^\d+$/) {
$filename = $self->filename;
} else {
$filename = shift;
}
($line, $condition) = @_;
my $response = $self->talk({
command => "break_point",
filename => $filename,
line => $line,
condition => $condition,
});
return $response->{line};
}
# delete a break point (by default in the current file)
sub break_point_delete {
my $self = shift;
my($filename, $line);
my $first = shift;
if ($first =~ /^\d+$/) {
$line = $first;
$filename = $self->filename;
} else {
$filename = $first;
$line = shift;
}
my $response = $self->talk({
command => "break_point_delete",
filename => $filename,
line => $line,
});
}
# set a break point
sub break_point_subroutine {
my($self, $subroutine) = @_;
my $response = $self->talk({
command => "break_point_subroutine",
subroutine => $subroutine,
});
return $response->{line};
}
# list break points
sub break_points {
my($self, $filename) = @_;
my $response = $self->talk({
command => "break_points",
filename => $filename,
});
return @{$response->{break_points}};
}
# list break points with condition
sub break_points_with_condition {
my($self, $filename) = @_;
my $response = $self->talk({
command => "break_points_with_condition",
filename => $filename,
});
return @{$response->{break_points}};
}
# list break points with condition for the whole program
sub all_break_points_with_condition {
my($self, $filename) = @_;
my $response = $self->talk({
command => "all_break_points_with_condition",
filename => $filename,
});
return @{$response->{break_points}};
}
# set a watch point
sub watch_point {
my($self, $watch_point) = @_;
my $response = $self->talk({
command => "watch_point",
watch_point => $watch_point,
});
}
1;
|