| 1 | # -*- coding: utf-8 -*- | ||||||||||||||
| 2 | # Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org> | ||||||||||||||
| 3 | 12 | ▶ | use warnings; no warnings 'redefine'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 12 | ▶ | use rlib '../../../..'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | package Devel::Trepan::CmdProcessor::Command::Delete; | ||||||||||||||
| 7 | 12 | ▶ | use English qw( -no_match_vars ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | 12 | ▶ | use if !@ISA, Devel::Trepan::CmdProcessor::Command ; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | |||||||||||||||
| 11 | 1 | ▶ | unless (@ISA) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 12 | 0 | ▶ | eval <<"EOE"; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | use constant ALIASES => qw(d); | ||||||||||||||
| 14 | use constant CATEGORY => 'breakpoints'; | ||||||||||||||
| 15 | use constant SHORT_HELP => 'Delete some breakpoints'; | ||||||||||||||
| 16 | use constant MIN_ARGS => 0; # Need at least this many | ||||||||||||||
| 17 | use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited. | ||||||||||||||
| 18 | use constant NEED_STACK => 0; | ||||||||||||||
| 19 | EOE | ||||||||||||||
| 20 | } | ||||||||||||||
| 21 | |||||||||||||||
| 22 | 12 | ▶ | use strict; use vars qw(@ISA); @ISA = @CMD_ISA; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 23 | 12 | ▶ | use vars @CMD_VARS; # Value inherited from parent | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 24 | |||||||||||||||
| 25 | 1 | our $NAME = set_name(); | |||||||||||||
| 26 | =pod | ||||||||||||||
| 27 | |||||||||||||||
| 28 | =head2 Synopsis: | ||||||||||||||
| 29 | |||||||||||||||
| 30 | =cut | ||||||||||||||
| 31 | 1 | our $HELP = <<'HELP'; | |||||||||||||
| 32 | =pod | ||||||||||||||
| 33 | |||||||||||||||
| 34 | B<delete> [I<bp-number> [I<bp-number>...]] | ||||||||||||||
| 35 | |||||||||||||||
| 36 | Delete some breakpoints. | ||||||||||||||
| 37 | |||||||||||||||
| 38 | Arguments are breakpoint numbers with spaces in between. To delete | ||||||||||||||
| 39 | all breakpoints, give no arguments. | ||||||||||||||
| 40 | |||||||||||||||
| 41 | See also the C<clear> command which clears breakpoints by line number | ||||||||||||||
| 42 | and C<info break> to get a list of breakpoint numbers. | ||||||||||||||
| 43 | |||||||||||||||
| 44 | =head2 Examples: | ||||||||||||||
| 45 | |||||||||||||||
| 46 | delete 1 # delete breakpoint number 1 | ||||||||||||||
| 47 | |||||||||||||||
| 48 | =head2 See also: | ||||||||||||||
| 49 | |||||||||||||||
| 50 | L<C<break>|Devel::Trepan::CmdProcessor::Command::Break>, | ||||||||||||||
| 51 | L<C<enable>|Devel::Trepan::CmdProcessor::Command::Enable>, and | ||||||||||||||
| 52 | L<C<disable>|Devel::Trepan::CmdProcessor::Command::Disable>. | ||||||||||||||
| 53 | |||||||||||||||
| 54 | =cut | ||||||||||||||
| 55 | HELP | ||||||||||||||
| 56 | |||||||||||||||
| 57 | # This method runs the command | ||||||||||||||
| 58 | 0 | ▶ | sub run($$) { | ||||||||||||
|
Subroutine
run: not called CC=6 SCAR=31.2
Subroutine
run: not called CC=6 SCAR=31.2
Pod
undocumented
Pod
undocumented
| |||||||||||||||
| 59 | 0 | my ($self, $args) = @_; | |||||||||||||
| 60 | 0 | my $proc = $self->{proc}; | |||||||||||||
| 61 | 0 | my @args = @$args; | |||||||||||||
| 62 | |||||||||||||||
| 63 | 0 | ▶ | if (scalar @args == 1) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 64 | 0 | ▶ | if ($proc->confirm('Delete all breakpoints?', 0)) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 65 | 0 | $proc->{brkpts}->reset; | |||||||||||||
| 66 | 0 | return; | |||||||||||||
| 67 | } | ||||||||||||||
| 68 | } | ||||||||||||||
| 69 | 0 | shift @args; | |||||||||||||
| 70 | 0 | for my $num_str (@args) { | |||||||||||||
| 71 | 0 | my $bp_num = $proc->get_an_int($num_str); | |||||||||||||
| 72 | 0 | ▶ | my $success = $proc->{brkpts}->delete($bp_num) if $bp_num; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 73 | 0 | ▶ | $proc->msg("Deleted breakpoint $bp_num") if $success; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 74 | } | ||||||||||||||
| 75 | } | ||||||||||||||
| 76 | |||||||||||||||
| 77 | 1 | ▶ | unless (caller) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 78 | 0 | require Devel::Trepan::CmdProcessor::Mock; | |||||||||||||
| 79 | 0 | my $proc = Devel::Trepan::CmdProcessor::Mock::setup(); | |||||||||||||
| 80 | # my $cmd = __PACKAGE__->new($proc); | ||||||||||||||
| 81 | # $cmd->run([$NAME]); | ||||||||||||||
| 82 | } | ||||||||||||||
| 83 | |||||||||||||||
| 84 | 1 | 1; | |||||||||||||