line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
12
|
|
100
|
use warnings; no warnings 'redefine'; |
|
12
|
|
|
12
|
|
31
|
|
|
12
|
|
|
1
|
|
416
|
|
|
12
|
|
|
1
|
|
72
|
|
|
12
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
617
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
48
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
77
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Handle; |
19
|
12
|
|
|
12
|
|
81
|
use English qw( -no_match_vars ); |
|
12
|
|
|
1
|
|
30
|
|
|
12
|
|
|
|
|
95
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
15
|
|
20
|
12
|
|
|
12
|
|
4827
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
12
|
|
|
1
|
|
38
|
|
|
12
|
|
|
|
|
90
|
|
|
1
|
|
|
|
|
597
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
10
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
unless (@ISA) { |
23
|
12
|
|
|
12
|
|
81
|
eval <<"EOE"; |
|
12
|
|
|
12
|
|
31
|
|
|
12
|
|
|
12
|
|
652
|
|
|
12
|
|
|
12
|
|
82
|
|
|
12
|
|
|
12
|
|
35
|
|
|
12
|
|
|
|
|
660
|
|
|
12
|
|
|
|
|
82
|
|
|
12
|
|
|
|
|
35
|
|
|
12
|
|
|
|
|
535
|
|
|
12
|
|
|
|
|
72
|
|
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
484
|
|
|
12
|
|
|
|
|
76
|
|
|
12
|
|
|
|
|
36
|
|
|
12
|
|
|
|
|
431
|
|
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
|
|
|
12
|
|
1966
|
use strict; use vars qw(@ISA); @ISA = @CMD_ISA; |
|
12
|
|
|
12
|
|
44
|
|
|
12
|
|
|
1
|
|
309
|
|
|
12
|
|
|
1
|
|
64
|
|
|
12
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
632
|
|
|
1
|
|
|
|
|
87
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
34
|
12
|
|
|
12
|
|
66
|
use vars @CMD_VARS; # Value inherited from parent |
|
12
|
|
|
1
|
|
42
|
|
|
12
|
|
|
|
|
3578
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
255
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
our $NAME = set_name(); |
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 Synopsis: |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub run($$) { |
95
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
0
|
|
|
0
|
0
|
|
|
96
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $sigmgr = $self->{dbgr}{sigmgr}; |
|
0
|
|
|
|
|
|
|
99
|
0
|
0
|
0
|
|
|
|
if ($sigmgr->action($proc->{cmd_argstr}) && |
|
0
|
0
|
0
|
|
|
|
|
100
|
0
|
|
|
|
|
|
scalar(@{$args}) > 2) { |
|
0
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# Show results of recent change |
102
|
0
|
|
|
|
|
|
$sigmgr->info_signal([$args->[1]]); |
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
unless(caller) { |
107
|
|
|
|
|
|
|
require Devel::Trepan::DB; |
108
|
|
|
|
|
|
|
require Devel::Trepan::Core; |
109
|
|
|
|
|
|
|
my $db = Devel::Trepan::Core->new; |
110
|
|
|
|
|
|
|
my $intf = Devel::Trepan::Interface::User->new(undef, undef, {readline => 0}); |
111
|
|
|
|
|
|
|
my $proc = Devel::Trepan::CmdProcessor->new([$intf], $db); |
112
|
|
|
|
|
|
|
my $cmd = __PACKAGE__->new($proc); |
113
|
|
|
|
|
|
|
$cmd->run([$NAME]); |
114
|
|
|
|
|
|
|
} |