| 1 | # -*- coding: utf-8 -*- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Top-level require that pulls in the rest of the debugger. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # It's also the thing that gets called from DB:: hooks | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use warnings; use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # FIXME: Can't use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | package Devel::Trepan::Core; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # Something in the require process munges $0 into 'trepan.pl'. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # To make matters more sensitive, Enbugger processes $0 special | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # to make it debuggable. Thereore... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # save and restore $0. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | my $dollar0_save; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | $dollar0_save = $0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use rlib '.'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use Devel::Trepan::DB; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use Devel::Trepan::DB::Use; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use Devel::Trepan::DB::LineCache; # for remap_e_string_to_file(); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | use Devel::Trepan::CmdProcessor; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | use Devel::Trepan::SigHandler; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | use Devel::Trepan::WatchMgr; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | ▶ | use Devel::Trepan::IO::Output; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | ▶ | use Devel::Trepan::Interface::Script; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | ▶ | use Devel::Trepan::Interface::Server; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | ▶ | use Devel::Trepan::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # print join(', ', @INC, "\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | use vars qw(@ISA $dbgr $invoke_opts); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | use constant HAVE_BULLWINKLE => eval q(use Devel::Trepan::BWProcessors; 1) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.9
Subroutine
BEGIN: called CC=1 SCAR=0.5
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | @ISA = qw(DB); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub add_startup_files($$;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_startup_files: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | my ($cmdproc, $startup_file, $nowarn) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_startup_files: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $errmsg = Devel::Trepan::Util::invalid_filename($startup_file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if ($errmsg) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | print STDERR "${errmsg}.\n" unless $nowarn; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | push @{$cmdproc->{cmd_queue}}, "source $startup_file"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my %ORIG_SIG = %SIG; # Makes a copy of %SIG; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $self = { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | watch => Devel::Trepan::WatchMgr->new(), # List of watch expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | orig_sig => \%ORIG_SIG, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | caught_signal => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | exec_strs => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | need_e_remap => 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $self->awaken(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->skippkg('Devel::Trepan::Core'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | $self->skippkg('Devel::Trepan::DB::Use'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | $self->skippkg('SelfLoader'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->register(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->ready(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # Called when debugger is ready for reading commands. Main | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # entry point. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | sub idle($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
idle: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | my ($self, $event, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
idle: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $proc = $self->{proc}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $event = 'terminated' if $DB::package eq 'Devel::Trepan::Terminated'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if ($self->{need_e_remap} && $DB::filename eq '-e') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$self->{"need_e_remap"} and $DB::filename eq "-e"
$self->{"need_e_remap"} and $DB::filename eq "-e"
MC/DC0%0/2
$self->{"need_e_remap"} and $DB::filename eq "-e"
$self->{"need_e_remap"}
$DB::filename eq "-e"
MC/DC0%0/2
$self->{"need_e_remap"} and $DB::filename eq "-e"
$self->{"need_e_remap"}
$DB::filename eq "-e"
Truth table0%0/3
A and B
A= $self->{"need_e_remap"}B= $DB::filename eq "-e"
Truth table0%0/3
A and B
A= $self->{"need_e_remap"}B= $DB::filename eq "-e"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | remap_dbline_to_file(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $self->{need_e_remap} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $proc->process_commands($DB::caller, $event, $args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $self->{caught_signal} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # Called on catching a signal that SigHandler says | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # we should enter the debugger for. That it there is 'stop' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # set on that signal. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | sub signal_handler($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signal_handler: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my ($self, $signame) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signal_handler: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $DB::running = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $DB::step = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $DB::caller = [caller(1)]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ($DB::package, $DB::filename, $DB::lineno, $DB::subroutine, $DB::hasargs, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | $DB::wantarray, $DB::evaltext, $DB::is_require, $DB::hints, $DB::bitmask, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | $DB::hinthash | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ) = @{$DB::caller}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $proc = $self->{proc}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $self->{caught_signal} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $DB::signal |= 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | sub output($) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | my ($self, $msg) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $proc = $self->{proc}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | chomp($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $proc->msg($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | sub warning($) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warning: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my ($self, $msg) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warning: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $proc = $self->{proc}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | chomp($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $proc->errmsg($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | ▶ | sub awaken($;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
awaken: called CC=30 SCAR=61.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | my ($self, $opts) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
awaken: not called CC=30 SCAR=61.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # Process options | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if (!defined($opts) && $ENV{'TREPANPL_OPTS'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
not defined $opts and $ENV{"TREPANPL_OPTS"}
not defined $opts and $ENV{"TREPANPL_OPTS"}
MC/DC0%0/2
not defined $opts and $ENV{"TREPANPL_OPTS"}
not defined $opts
$ENV{"TREPANPL_OPTS"}
MC/DC0%0/2
not defined $opts and $ENV{"TREPANPL_OPTS"}
not defined $opts
$ENV{"TREPANPL_OPTS"}
Truth table33%1/3
not(A) and B
A= not defined $optsB= $ENV{"TREPANPL_OPTS"}
Truth table0%0/3
not(A) and B
A= not defined $optsB= $ENV{"TREPANPL_OPTS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $opts = eval "$ENV{'TREPANPL_OPTS'}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $invoke_opts = $opts; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # require Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # import Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # print Dumper($opts), "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $exec_strs_ary = $opts->{exec_strs}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if (defined $exec_strs_ary && scalar @{$exec_strs_ary}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%1/4
defined $exec_strs_ary and scalar @{$exec_strs_ary;}
defined $exec_strs_ary and scalar @{$exec_strs_ary;}
MC/DC0%0/1
defined $exec_strs_ary and scalar @{$exec_strs_ary;}
defined $exec_strs_ary
MC/DC0%0/1
defined $exec_strs_ary and scalar @{$exec_strs_ary;}
defined $exec_strs_ary
Truth table50%1/2
A
A= defined $exec_strs_ary
Truth table0%0/2
A
A= defined $exec_strs_ary
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->{exec_strs} = $opts->{exec_strs}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $self->{need_e_remap} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | $0 = $opts->{dollar_0} if $opts->{dollar_0}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | $DB::fall_off_on_end = 1 if $opts->{fall_off_end} || $opts->{traceprint}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$opts->{"fall_off_end"} or $opts->{"traceprint"}
$opts->{"fall_off_end"} or $opts->{"traceprint"}
MC/DC0%0/2
$opts->{"fall_off_end"} or $opts->{"traceprint"}
$opts->{"fall_off_end"}
$opts->{"traceprint"}
MC/DC0%0/2
$opts->{"fall_off_end"} or $opts->{"traceprint"}
$opts->{"fall_off_end"}
$opts->{"traceprint"}
Truth table33%1/3
A or B
A= $opts->{"fall_off_end"}B= $opts->{"traceprint"}
Truth table0%0/3
A or B
A= $opts->{"fall_off_end"}B= $opts->{"traceprint"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | $SIG{__DIE__} = \&DB::catch if $opts->{post_mortem}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $proc; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $batch_filename = $opts->{testing}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if ($opts->{bw} && HAVE_BULLWINKLE) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%1/4
$opts->{"bw"} and 0
$opts->{"bw"} and 0
MC/DC0%0/1
$opts->{"bw"} and 0
$opts->{"bw"}
MC/DC0%0/1
$opts->{"bw"} and 0
$opts->{"bw"}
Truth table50%1/2
A
A= $opts->{"bw"}
Truth table0%0/2
A
A= $opts->{"bw"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $bw_opts = $opts->{bw}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | $bw_opts = {} unless ref($bw_opts) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if (defined $batch_filename) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $fh = IO::File->new($batch_filename, 'r'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $bw_opts = {input => $fh, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | bw_opts => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | echo_read => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | input_opts => {readline => 0}} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $proc = Devel::Trepan::BWProcessor->new(undef, $self, $bw_opts); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | $batch_filename = $opts->{batchfile} unless defined $batch_filename; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my %cmdproc_opts = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | for my $field | |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | (qw(basename cmddir highlight readline traceprint)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # print "field $field $opts->{$field}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $cmdproc_opts{$field} = $opts->{$field}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if (defined $batch_filename) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $result = Devel::Trepan::Util::invalid_filename($batch_filename); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | if (defined $result) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | print STDERR "$result\n" | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my $output = Devel::Trepan::IO::Output->new; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | my $script_opts = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | $opts->{testing} ? {abort_on_error => 0} : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $script_intf = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | Devel::Trepan::Interface::Script->new($batch_filename, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | $output, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | $script_opts); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $proc = Devel::Trepan::CmdProcessor->new([$script_intf], | |||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | \%cmdproc_opts); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $self->{proc} = $proc; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $main::TREPAN_CMDPROC = $self->{proc}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $intf = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if (defined($dbgr) && exists($dbgr->{proc})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
defined $dbgr and exists $dbgr->{"proc"}
defined $dbgr and exists $dbgr->{"proc"}
MC/DC50%1/2
defined $dbgr and exists $dbgr->{"proc"}
defined $dbgr
exists $dbgr->{"proc"}
MC/DC0%0/2
defined $dbgr and exists $dbgr->{"proc"}
defined $dbgr
exists $dbgr->{"proc"}
Truth table66%2/3
A and B
A= defined $dbgrB= exists $dbgr->{"proc"}
Truth table0%0/3
A and B
A= defined $dbgrB= exists $dbgr->{"proc"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $intf = $dbgr->{proc}{interfaces}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | $intf->[-1]{input}{term_readline} = $opts->{readline} if | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | exists($opts->{readline}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ($opts->{server}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $server_opts = $opts->{server}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if ($server_opts->[0] eq 'tcp') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | $server_opts = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | io => 'tcp', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | host => $opts->{host}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | port => $opts->{port}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | logger => *STDOUT | |||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } elsif ($server_opts->[0] eq 'fifo') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $server_opts = { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | io => 'fifo', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | logger => *STDOUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } elsif ($server_opts->[0] eq 'tty') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $server_opts = { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | io => 'tty', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | logger => *STDOUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | die "Unknown server protocol: $server_opts->[0]"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $intf = [ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | Devel::Trepan::Interface::Server->new(undef, undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | $server_opts) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $proc = Devel::Trepan::CmdProcessor->new($intf, $self, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | \%cmdproc_opts); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $main::TREPAN_CMDPROC = $self->{proc}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | $opts = {} unless defined $opts; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | for my $startup_file (@{$opts->{cmdfiles}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | add_startup_files($proc, $startup_file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if (!$opts->{nx} && exists $opts->{initfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
not $opts->{"nx"} and exists $opts->{"initfile"}
not $opts->{"nx"} and exists $opts->{"initfile"}
MC/DC0%0/2
not $opts->{"nx"} and exists $opts->{"initfile"}
not $opts->{"nx"}
exists $opts->{"initfile"}
MC/DC0%0/2
not $opts->{"nx"} and exists $opts->{"initfile"}
not $opts->{"nx"}
exists $opts->{"initfile"}
Truth table33%1/3
not(A) and B
A= not $opts->{"nx"}B= exists $opts->{"initfile"}
Truth table0%0/3
not(A) and B
A= not $opts->{"nx"}B= exists $opts->{"initfile"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | add_startup_files($proc, $opts->{initfile}, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $proc->{skip_count} = -1 if $opts->{traceprint}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $self->{proc} = $proc; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | $self->{sigmgr} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | Devel::Trepan::SigMgr->new(sub{ $DB::running = 0; $DB::single = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->signal_handler(@_) }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | sub {$proc->msg(@_)}, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | sub {$proc->errmsg(@_)}, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | sub {$proc->section(@_)}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | sub display_lists ($) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
display_lists: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | return $self->{proc}{displays}{list}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # Restore the value of $0 that we had when we came in here. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # See above for why we have to save and restore $0. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | $0 = $dollar0_save; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | ▶ | END { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | $DB::ready = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # FIXME: remove the next line and make this really OO. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | $dbgr = __PACKAGE__->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||