| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org> |
|
2
|
12
|
|
|
12
|
|
105
|
use warnings; no warnings 'redefine'; |
|
|
12
|
|
|
12
|
|
31
|
|
|
|
12
|
|
|
1
|
|
539
|
|
|
|
12
|
|
|
1
|
|
73
|
|
|
|
12
|
|
|
|
|
28
|
|
|
|
12
|
|
|
|
|
411
|
|
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
24
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
28
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
12
|
|
|
12
|
|
70
|
use rlib '../../../..'; |
|
|
12
|
|
|
1
|
|
29
|
|
|
|
12
|
|
|
|
|
71
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Quit; |
|
7
|
12
|
|
|
12
|
|
4307
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
|
12
|
|
|
1
|
|
27
|
|
|
|
12
|
|
|
|
|
76
|
|
|
|
1
|
|
|
|
|
311
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
unless (@ISA) { |
|
10
|
12
|
|
|
12
|
|
79
|
eval <<'EOE'; |
|
|
12
|
|
|
12
|
|
27
|
|
|
|
12
|
|
|
12
|
|
703
|
|
|
|
12
|
|
|
12
|
|
70
|
|
|
|
12
|
|
|
12
|
|
32
|
|
|
|
12
|
|
|
|
|
515
|
|
|
|
12
|
|
|
|
|
67
|
|
|
|
12
|
|
|
|
|
27
|
|
|
|
12
|
|
|
|
|
472
|
|
|
|
12
|
|
|
|
|
85
|
|
|
|
12
|
|
|
|
|
34
|
|
|
|
12
|
|
|
|
|
494
|
|
|
|
12
|
|
|
|
|
69
|
|
|
|
12
|
|
|
|
|
28
|
|
|
|
12
|
|
|
|
|
419
|
|
|
11
|
|
|
|
|
|
|
use constant ALIASES => ('quit!', 'q', 'q!'); |
|
12
|
|
|
|
|
|
|
use constant CATEGORY => 'running'; |
|
13
|
|
|
|
|
|
|
use constant SHORT_HELP => 'Gently exit debugged program'; |
|
14
|
|
|
|
|
|
|
use constant MIN_ARGS => 0; # Need at least this many |
|
15
|
|
|
|
|
|
|
use constant MAX_ARGS => 2; # Need at most this many - undef -> unlimited. |
|
16
|
|
|
|
|
|
|
EOE |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
12
|
|
|
12
|
|
1901
|
use strict; |
|
|
12
|
|
|
1
|
|
30
|
|
|
|
12
|
|
|
|
|
293
|
|
|
|
1
|
|
|
|
|
103
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
21
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
12
|
|
|
12
|
|
58
|
use vars qw(@ISA); @ISA = @CMD_ISA; |
|
|
12
|
|
|
1
|
|
25
|
|
|
|
12
|
|
|
|
|
580
|
|
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
49
|
|
|
22
|
12
|
|
|
12
|
|
74
|
use vars @CMD_VARS; # Value inherited from parent |
|
|
12
|
|
|
1
|
|
27
|
|
|
|
12
|
|
|
|
|
3445
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
258
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $NAME = set_name(); |
|
25
|
|
|
|
|
|
|
=head2 Synopsis: |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
our $HELP = <<'HELP'; |
|
29
|
|
|
|
|
|
|
=pod |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
B<quit>[B<!>] [B<unconditionally>] [I<exit-code>] |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Gently exit the debugger and debugged program. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The program being debugged is exited via I<exit()> which runs the |
|
36
|
|
|
|
|
|
|
Kernel I<at_exit()> finalizers. If a return code is given, that is the |
|
37
|
|
|
|
|
|
|
return code passed to I<exit()> E<mdash> presumably the return code that will |
|
38
|
|
|
|
|
|
|
be passed back to the OS. If no exit code is given, 0 is used. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 Examples: |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
quit # quit; prompt if we are interactive |
|
43
|
|
|
|
|
|
|
quit unconditionally # quit without prompting |
|
44
|
|
|
|
|
|
|
quit! # same as above |
|
45
|
|
|
|
|
|
|
quit 0 # same as "quit" |
|
46
|
|
|
|
|
|
|
quit! 1 # unconditional quit setting exit code 1 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 See also: |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L<C<set confirm>|Devel::Trepan::CmdProcssor::Command::Set::Confirm> and |
|
51
|
|
|
|
|
|
|
L<C<kill>|Devel::Trepan::CmdProcessor::Command::Kill>. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
|
54
|
|
|
|
|
|
|
HELP |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# This method runs the command |
|
57
|
|
|
|
|
|
|
sub run($$) |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
|
0
|
|
|
0
|
0
|
|
|
|
60
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
|
0
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my @args = @$args; |
|
|
0
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $unconditional = 0; |
|
|
0
|
|
|
|
|
|
|
|
63
|
0
|
0
|
0
|
|
|
|
if (scalar(@args) > 1 && $args->[-1] eq 'unconditionally') { |
|
|
0
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
pop @args; |
|
|
0
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$unconditional = 1; |
|
|
0
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} elsif (substr($args[0], -1) eq '!') { |
|
67
|
0
|
|
|
|
|
|
$unconditional = 1; |
|
|
0
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
|
69
|
0
|
0
|
0
|
|
|
|
unless ($unconditional || $proc->{terminated} || |
|
|
0
|
0
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$proc->confirm('Really quit?', 0)) { |
|
71
|
0
|
|
|
|
|
|
$self->msg('Quit not confirmed.'); |
|
|
0
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return; |
|
|
0
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $exitrc = 0; |
|
|
0
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
if (scalar(@args) > 1) { |
|
|
0
|
0
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
if ($args[1] =~ /\d+/) { |
|
|
0
|
0
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$exitrc = $args[1]; |
|
|
0
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} else { |
|
80
|
0
|
|
|
|
|
|
$self->errmsg("Bad an Integer return type \"$args[1]\""); |
|
|
0
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return; |
|
|
0
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
} |
|
84
|
12
|
|
|
12
|
|
86
|
no warnings 'once'; |
|
|
12
|
|
|
1
|
|
33
|
|
|
|
12
|
|
|
|
|
2160
|
|
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
193
|
|
|
85
|
0
|
|
|
|
|
|
$DB::single = 0; |
|
|
0
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$DB::fall_off_on_end = 1; |
|
|
0
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$proc->terminated(); |
|
|
0
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# No graceful way to stop threads... |
|
89
|
0
|
|
|
|
|
|
exit $exitrc; |
|
|
0
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
unless (caller) { |
|
93
|
|
|
|
|
|
|
require Devel::Trepan::CmdProcessor::Mock; |
|
94
|
|
|
|
|
|
|
my $proc = Devel::Trepan::CmdProcessor->new(undef, 'bogus'); |
|
95
|
|
|
|
|
|
|
my $cmd = __PACKAGE__->new($proc); |
|
96
|
|
|
|
|
|
|
my $child_pid = fork; |
|
97
|
|
|
|
|
|
|
if ($child_pid == 0) { |
|
98
|
|
|
|
|
|
|
$cmd->run([$NAME, 'unconditionally']); |
|
99
|
|
|
|
|
|
|
} else { |
|
100
|
|
|
|
|
|
|
wait; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
$cmd->run([$NAME, '5', 'unconditionally']); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |