lib/Devel/Trepan/CmdProcessor/Command/Handle.pm

filter: Statementstmt 82.9% 68 / 82 Branchbran 37.5% 3 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 90.4% 19 / 21 Podpod 0.0% 0 / 2 totaltotal 73.1% 90 / 123 CC 7 SCAR 9.4
CC
7
Cov
74%
run
5.9
run
5.9
run
5.9
CRAP 2.6
« blib/lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Variables_Subcmd/Our.pm ↑ Summary lib/Devel/Trepan/Processor.pm »
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2012, 2014 Rocky Bernstein
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 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
17  
18 package Devel::Trepan::CmdProcessor::Command::Handle;
19 12 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
20 12 ▶use if !@ISA, Devel::Trepan::CmdProcessor::Command ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶unless (@ISA) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@ISA) 0 12 12
23 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
24 use constant CATEGORY => 'running';
25 use constant NEED_STACK => 0;
26 use constant SHORT_HELP =>
27 'Specify a how to handle a signal';
28 use constant MIN_ARGS => 1; # Need at least this many
29 use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited.
30 EOE
31 }
32  
33 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
34 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
35  
36 1 our $NAME = set_name();
37 =pod
38  
39 =head2 Synopsis:
40  
41 =cut
42 1 our $HELP = <<'HELP';
43 =pod
44  
45 B<handle> [I<sig> [I<action1> I<action2> ...]]
46  
47 Specify how to handle a signal SIG. SIG can be a signal name like
48 SIGINT or a signal number like 2. The absolute value is used for
49 numbers so -9 is the same as 9 (SIGKILL). When signal names are used,
50 you can drop off the leading "SIG" if you want. Also letter case is
51 not important either.
52  
53 Arguments are signals and actions to apply to those signals.
54 recognized actions include "stop", "nostop", "print", "noprint",
55 "pass", "nopass", "ignore", or "noignore".
56  
57 =over
58  
59 =item *
60  
61 C<stop> means reenter debugger if this signal happens (implies
62 C<print> and C<nopass>).
63  
64 =item *
65 C<Print> means print a message if this signal happens.
66  
67 =item *
68 C<Pass> means let program see this signal; otherwise the program see
69 it.
70  
71 =item *
72 C<Ignore> is a synonym for C<nopass>; C<noignore> is a synonym for
73 C<pass>.
74  
75 =back
76  
77 Without any action names the current settings are shown.
78  
79 =head2 Examples:
80  
81 handle INT # Show current settings of SIGINT
82 handle SIGINT # same as above
83 handle int # same as above
84 handle 2 # Probably the same as above
85 handle -2 # the same as above
86 handle INT nostop # Don't stop in the debugger on SIGINT
87  
88 =head2 See also:
89  
90 L<C<info signals>|Devel::Trepan::CmdProcessor::Command::Info::Signals>
91 =cut
92 HELP
93  
94 0 ▶sub run($$) {
Subroutine run: not called CC=3 SCAR=17.7
Subroutine run: not called CC=3 SCAR=17.7
Pod undocumented
Pod undocumented
95 0 my ($self, $args) = @_;
96 0 my $proc = $self->{proc};
97  
98 0 my $sigmgr = $self->{dbgr}{sigmgr};
99 0 ▶ if ($sigmgr->action($proc->{cmd_argstr}) &&
Branch: 2 branches
BranchTrueFalseTotal
if ($sigmgr->action($proc->{"cmd_argstr"}) and scalar @{$args;} > 2) 0 0 0
if ($sigmgr->action($proc->{"cmd_argstr"}) and scalar @{$args;} > 2) 11 0 11
Condition0%0/6
$sigmgr->action($proc->{"cmd_argstr"}) and scalar @{$args;} > 2
!ll&&!rl&&r
000
$sigmgr->action($proc->{"cmd_argstr"}) and scalar @{$args;} > 2
!ll&&!rl&&r
000
MC/DC0%0/2
$sigmgr->action($proc->{"cmd_argstr"}) and scalar @{$args;} > 2
$sigmgr->action($proc->{"cmd_argstr"}) scalar @{$args;} > 2
MC/DC0%0/2
$sigmgr->action($proc->{"cmd_argstr"}) and scalar @{$args;} > 2
$sigmgr->action($proc->{"cmd_argstr"}) scalar @{$args;} > 2
Truth table0%0/3
A and B
A= $sigmgr->action($proc->{"cmd_argstr"})B= scalar @{$args;} > 2
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $sigmgr->action($proc->{"cmd_argstr"})B= scalar @{$args;} > 2
ABresult
0X0
100
111
100 0 scalar(@{$args}) > 2) {
101 # Show results of recent change
102 0 $sigmgr->info_signal([$args->[1]]);
103 }
104 }
105  
106 1 ▶unless(caller) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 1 1
107 0 require Devel::Trepan::DB;
108 0 require Devel::Trepan::Core;
109 0 my $db = Devel::Trepan::Core->new;
110 0 my $intf = Devel::Trepan::Interface::User->new(undef, undef, {readline => 0});
111 0 my $proc = Devel::Trepan::CmdProcessor->new([$intf], $db);
112 0 my $cmd = __PACKAGE__->new($proc);
113 0 $cmd->run([$NAME]);
114 }
« blib/lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Variables_Subcmd/Our.pm ↑ Summary lib/Devel/Trepan/Processor.pm »