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

filter: Statementstmt 22.9% 101 / 441 Branchbran 1.9% 4 / 210 Conditioncond 0.0% 0 / 51 MC/DCmcdc 0.0% 0 / 29 Subroutinesub 68.1% 30 / 44 Podpod 0.0% 0 / 14 totaltotal 17.1% 135 / 789 CC 142 SCAR 61.9
CC
142
Cov
15%
parse_list_cmd
812.0
parse_list_cmd
812.0
parse_list_cmd
812.0
CRAP 485.5
« lib/Devel/Trepan/DB/Backtrace.pm ↑ Summary lib/Devel/Trepan/CmdProcessor/Frame.pm »
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2012, 2014-2015 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 # require_relative '../../app/condition'
7  
8 package Devel::Trepan::CmdProcessor::Command::List;
9 12 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10 12 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
11 12 ▶use Devel::Trepan::DB::LineCache;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
12 12 ▶use Devel::Trepan::CmdProcessor::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
13 12 ▶use if !@ISA, Devel::Trepan::CmdProcessor::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
14 12 ▶use Devel::Trepan::CmdProcessor::Parse::Range;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶unless (@ISA) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@ISA) 0 1 1
17 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
18 use constant ALIASES => qw(l list> l>);
19 use constant CATEGORY => 'files';
20 use constant SHORT_HELP => 'List source code';
21 use constant MIN_ARGS => 0; # Need at least this many
22 use constant MAX_ARGS => 3; # Need at most this many - undef -> unlimited.
23 use constant NEED_STACK => 0;
24 EOE
25 }
26  
27 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
28 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
29  
30 1 our $NAME = set_name();
31 =head2 Synopsis:
32  
33 =cut
34 1 our $HELP = <<'HELP';
35 =pod
36  
37 B<list>[E<gt>] I<location> [I<number>]
38  
39 List Perl source code.
40  
41 Without arguments, prints lines centered around the current
42 line. If this is the first list command issued since the debugger
43 command loop was entered, then the current line is the current
44 frame. If a subsequent list command was issued with no intervening
45 frame changing, then that is start the line after we last one
46 previously shown.
47  
48 If the command has a '>' suffix, then line centering is disabled and
49 listing begins at the specificed location.
50  
51 The number of lines to show is controlled by the debugger "listsize"
52 setting. Use L<C<set max
53 list>|Devel::Trepan::CmdProcessor::Set::Max::List> or L<C<show max
54 list>|Devel::Trepan::CmdProcessor::Show::Max::List> to see or set the
55 value.
56  
57 If the location form is used with a subsequent parameter, the
58 parameter is the starting line number. When there two numbers are
59 given, the last number value is treated as a stopping line unless it
60 is less than the start line, in which case it is taken to mean the
61 number of lines to list instead.
62  
63 =head2 Examples:
64  
65 list 5 # List centered around line 5
66 list foo.pl:5 # List foo.pl at line 5
67 list , 16 # list lines ending in line 16
68 list . # List lines centered from where we currently are stopped
69 list . 3 # List 3 lines starting from where we currently are stopped
70 # if . > 3. Otherwise we list from . to 3.
71 list - # List lines previous to those just shown
72  
73 The output of the list command give a line number, and some status
74 information about the line and the text of the line. Here is some
75 hypothetical list output modeled roughly around line 251 of one
76 version of this code:
77  
78 251 cmd.proc.frame_setup(tf)
79 252 -> brkpt_cmd.run(['break'])
80 253 B01 line = __LINE__
81 254 b02 cmd.run(['list', __LINE__.to_s])
82 255 t03 puts '--' * 10
83  
84 Line 251 has nothing special about it. Line 252 is where we are
85 currently stopped. On line 253 there is a breakpoint 1 which is
86 enabled, while at line 255 there is an breakpoint 2 which is
87 disabled.
88  
89 =head2 See also:
90  
91 L<C<set
92 autolist>|Devel::Trepan::CmdProcessor::Command::Set::Auto::List>,
93 L<C<help syntax
94 location>|Devel::Trepan::CmdProcessor::Command::Help::location>,
95 L<C<disassemble>|Devel::Trepan::CmdProcessor::Command::Disassemble>,
96 and L<C<deparse>|Devel::Trepan::CmdProcessor::Command::Deparse>.
97  
98 =cut
99 HELP
100  
101 # FIXME: Should we include all files?
102 # Combine with BREAK completion.
103 sub complete($$)
104 0 ▶{
Subroutine complete: not called CC=1 SCAR=6.9
Subroutine complete: not called CC=1 SCAR=6.9
Pod undocumented
Pod undocumented
105 0 ▶ my ($self, $prefix) = @_;
Subroutine complete: not called CC=1 SCAR=6.9
Pod undocumented
106 0 my $filename = $self->{proc}->filename;
107 # For line numbers we'll use stoppable line number even though one
108 # can enter line numbers that don't have breakpoints associated with them
109 0 my @completions = sort(('.', '-', file_list, DB::subs(),
110 trace_line_numbers($filename)));
111 0 Devel::Trepan::Complete::complete_token(\@completions, $prefix);
112 }
113  
114 # If last is less than first, assume last is a count rather than an
115 # end line number.
116 sub adjust_end($$)
117 0 ▶{
Subroutine adjust_end: not called CC=2 SCAR=17.9
Subroutine adjust_end: not called CC=2 SCAR=17.9
Pod undocumented
Pod undocumented
118 0 ▶ my ($start, $end) = @_;
Subroutine adjust_end: not called CC=2 SCAR=17.9
Pod undocumented
119 0 ▶ return ($start < $end ) ? $start + $end - 1 : $end;
Branch: 3 branches
BranchTrueFalseTotal
$start < $end ? : 0 0 0
$start < $end ? : 0 0 0
$start < $end ? : 0 0 0
120 }
121  
122 sub no_frame_msg($)
123 0 ▶{
Subroutine no_frame_msg: not called CC=1 SCAR=6.9
Subroutine no_frame_msg: not called CC=1 SCAR=6.9
Pod undocumented
Pod undocumented
124 0 ▶ my $self = shift;
Subroutine no_frame_msg: not called CC=1 SCAR=6.9
Pod undocumented
125 0 $self->errmsg("No Perl program loaded.");
126 0 return (undef, undef, undef);
127 }
128  
129  
130 # What a mess. Necessitated I suppose because we want to allow
131 # somewhat flexible parsing with either module names, files or none
132 # and optional line counts or end-line numbers.
133 # TODO: allow a negative start to count from the end of the file.
134  
135 # Parses arguments for the "list" command and returns the tuple:
136 # filename, start, last
137 # or sets these to nil if there was some problem.
138 sub parse_list_cmd($$$$)
139 0 ▶{
Subroutine parse_list_cmd: not called CC=28 SCAR=67.0
Subroutine parse_list_cmd: not called CC=28 SCAR=67.0
Pod undocumented
Pod undocumented
140 0 ▶ my ($self, $args, $listsize, $center_correction) = @_;
Subroutine parse_list_cmd: not called CC=28 SCAR=67.0
Pod undocumented
141  
142 0 my @args = @$args;
143 0 shift @args;
144  
145 0 my $proc = $self->{proc};
146 0 my $frame = $proc->{frame};
147 0 my $filename = $proc->{list_filename};
148 0 my $fn;
149 0 my ($start, $end);
150  
151 0 ▶ if (scalar @args > 0) {
Branch: 6 branches
BranchTrueFalseTotal
if (scalar @args > 0) { } 0 0 0
elsif ($frame and not $frame->{'line'} and $proc->{'frame'}) { } 0 0 0
if (scalar @args > 0) { } 0 0 0
elsif ($frame and not $frame->{'line'} and $proc->{'frame'}) { } 0 0 0
if (scalar @args > 0) { } 0 0 0
elsif ($frame and not $frame->{'line'} and $proc->{'frame'}) { } 0 0 0
152  
153 0 my $command = $proc->{current_command};
154 0 $command = substr($command, index($command, ' '));
155 0 my $value_ref;
156  
157 # Parse input and build tree
158 0 my $eval_ok = eval { $value_ref = parse_range( \$command ); 1; };
159 0 ▶ if ( !$eval_ok ) {
Branch: 3 branches
BranchTrueFalseTotal
unless ($eval_ok) 0 0 0
unless ($eval_ok) 0 0 0
unless ($eval_ok) 0 0 0
160 0 my $eval_error = $EVAL_ERROR;
161 PARSE_EVAL_ERROR: {
162 0 $self->errmsg("list parsing error: $EVAL_ERROR");
163 0 return undef, undef, undef;
164 }
165 }
166 0 my @ary = @$$value_ref;
167 0 my $start_symbol_name = shift @ary;
168 0 ▶ unless ($start_symbol_name eq 'range') {
Branch: 3 branches
BranchTrueFalseTotal
unless ($start_symbol_name eq "range") 0 0 0
unless ($start_symbol_name eq "range") 0 0 0
unless ($start_symbol_name eq "range") 0 0 0
169 0 $proc->errmsg("List expecting a range parse");
170 0 return undef, undef, undef;
171 }
172  
173 0 my %range = range_build(@ary);
174  
175 0 my $direction = $range{direction};
176 0 ▶ if (defined $direction) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $direction) { } 0 0 0
if (defined $direction) { } 0 0 0
if (defined $direction) { } 0 0 0
177 0 ▶ if ($direction eq '-') {
Branch: 9 branches
BranchTrueFalseTotal
if ($direction eq '-') { } 0 0 0
elsif ($direction eq '+') { } 0 0 0
elsif ($direction eq '.') { } 0 0 0
if ($direction eq '-') { } 0 0 0
elsif ($direction eq '+') { } 0 0 0
elsif ($direction eq '.') { } 0 0 0
if ($direction eq '-') { } 0 0 0
elsif ($direction eq '+') { } 0 0 0
elsif ($direction eq '.') { } 0 0 0
178 0 ▶ return $self->no_frame_msg() unless $proc->{list_line};
Branch: 3 branches
BranchTrueFalseTotal
unless $proc->{"list_line"} 0 0 0
unless $proc->{"list_line"} 0 0 0
unless $proc->{"list_line"} 0 0 0
179 0 $start = $proc->{list_line} - 2*$listsize;
180 0 ▶ $start = 1 if $start < 1;
Branch: 3 branches
BranchTrueFalseTotal
if $start < 1 0 0 0
if $start < 1 0 0 0
if $start < 1 0 0 0
181 } elsif ($direction eq '+') {
182 0 ▶ return $self->no_frame_msg() unless $proc->{list_line};
Branch: 3 branches
BranchTrueFalseTotal
unless $proc->{"list_line"} 0 0 0
unless $proc->{"list_line"} 0 0 0
unless $proc->{"list_line"} 0 0 0
183 0 $start = $proc->{list_line} - $center_correction;
184 } elsif ($direction eq '.') {
185 0 my $frame = $proc->{frame};
186 0 ▶ return $self->no_frame_msg() unless defined $frame;
Branch: 3 branches
BranchTrueFalseTotal
unless defined $frame 0 0 0
unless defined $frame 0 0 0
unless defined $frame 0 0 0
187 0 $filename = $frame->{file};
188 0 $start = $frame->{line} - ($listsize / 2);
189 } else {
190 0 $proc->errmsg("List command expecting a range parse");
191 0 return undef, undef, undef;
192 }
193 } else {
194 0 my $loc_start = $range{start};
195 0 ▶ if (defined $loc_start) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $loc_start) 0 0 0
if (defined $loc_start) 0 0 0
if (defined $loc_start) 0 0 0
196 0 ▶ if (ref $loc_start eq 'HASH') {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $loc_start eq 'HASH') { } 0 0 0
if (ref $loc_start eq 'HASH') { } 0 0 0
if (ref $loc_start eq 'HASH') { } 0 0 0
197 0 my $location = $loc_start->{location};
198 0 ▶ unless (defined $location) {
Branch: 3 branches
BranchTrueFalseTotal
unless (defined $location) 0 0 0
unless (defined $location) 0 0 0
unless (defined $location) 0 0 0
199 0 $proc->errmsg("List command parse expected a location");
200 0 return undef, undef, undef;
201  
202 };
203 0 ▶ $filename = $location->{filename} if $location->{filename};
Branch: 3 branches
BranchTrueFalseTotal
if $location->{"filename"} 0 0 0
if $location->{"filename"} 0 0 0
if $location->{"filename"} 0 0 0
204 0 ▶ $start = $location->{line_num} if $location->{line_num};
Branch: 3 branches
BranchTrueFalseTotal
if $location->{"line_num"} 0 0 0
if $location->{"line_num"} 0 0 0
if $location->{"line_num"} 0 0 0
205 0 ▶ $start = $location->{offset} if $location->{offset};
Branch: 3 branches
BranchTrueFalseTotal
if $location->{"offset"} 0 0 0
if $location->{"offset"} 0 0 0
if $location->{"offset"} 0 0 0
206 } else {
207 0 $start = $loc_start;
208 }
209 }
210 0 my $loc_end = $range{end};
211 0 ▶ if (defined $loc_end) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $loc_end) 0 0 0
if (defined $loc_end) 0 0 0
if (defined $loc_end) 0 0 0
212 0 ▶ $end = $loc_end->{line_num} if $loc_end->{line_num};
Branch: 3 branches
BranchTrueFalseTotal
if $loc_end->{"line_num"} 0 0 0
if $loc_end->{"line_num"} 0 0 0
if $loc_end->{"line_num"} 0 0 0
213 # FIXME handle offset
214 # $end = $loc_end->{offset} if $loc_end->{offset};
215 0 ▶ if (!defined $start) {
Branch: 3 branches
BranchTrueFalseTotal
unless (defined $start) 0 0 0
unless (defined $start) 0 0 0
unless (defined $start) 0 0 0
216 0 $start = $end - $listsize;
217 }
218 }
219 }
220 ▶ } elsif ($frame && !$frame->{line} and $proc->{frame}) {
Condition0%0/18
$frame and not $frame->{"line"} and $proc->{"frame"}
!ll&&!rl&&r
000
$frame and not $frame->{"line"}
!ll&&!rl&&r
000
$frame and not $frame->{"line"} and $proc->{"frame"}
!ll&&!rl&&r
000
$frame and not $frame->{"line"}
!ll&&!rl&&r
000
$frame and not $frame->{"line"} and $proc->{"frame"}
!ll&&!rl&&r
000
$frame and not $frame->{"line"}
!ll&&!rl&&r
000
MC/DC0%0/3
$frame and not $frame->{"line"} and $proc->{"frame"}
$frame not $frame->{"line"} $proc->{"frame"}
MC/DC0%0/3
$frame and not $frame->{"line"} and $proc->{"frame"}
$frame not $frame->{"line"} $proc->{"frame"}
MC/DC0%0/3
$frame and not $frame->{"line"} and $proc->{"frame"}
$frame not $frame->{"line"} $proc->{"frame"}
Truth table0%0/4
A and not(B) and C
A= $frameB= not $frame->{"line"}C= $proc->{"frame"}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= $frameB= not $frame->{"line"}C= $proc->{"frame"}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= $frameB= not $frame->{"line"}C= $proc->{"frame"}
ABCresult
0XX0
10X0
1100
1111
221 0 $start = $frame->{line} - $center_correction;
222 } else {
223 0 ▶ $start = ($proc->{list_line} || $frame->{line}) - $center_correction;
Condition0%0/9
$proc->{'list_line'} || $frame->{'line'}
l!l&&r!l&&!r
000
$proc->{'list_line'} || $frame->{'line'}
l!l&&r!l&&!r
000
$proc->{'list_line'} || $frame->{'line'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$proc->{'list_line'} || $frame->{'line'}
$proc->{'list_line'} $frame->{'line'}
MC/DC0%0/2
$proc->{'list_line'} || $frame->{'line'}
$proc->{'list_line'} $frame->{'line'}
MC/DC0%0/2
$proc->{'list_line'} || $frame->{'line'}
$proc->{'list_line'} $frame->{'line'}
Truth table0%0/3
A || B
A= $proc->{'list_line'}B= $frame->{'line'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $proc->{'list_line'}B= $frame->{'line'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $proc->{'list_line'}B= $frame->{'line'}
ABresult
1X1
011
000
224 }
225 0 ▶ $start = 1 if $start < 1;
Branch: 3 branches
BranchTrueFalseTotal
if $start < 1 0 0 0
if $start < 1 0 0 0
if $start < 1 0 0 0
226 0 ▶ $end = $start + $listsize - 1 unless $end;
Branch: 3 branches
BranchTrueFalseTotal
unless $end 0 0 0
unless $end 0 0 0
unless $end 0 0 0
227  
228 0 ▶ cache_file($filename) unless is_cached($filename);
Branch: 3 branches
BranchTrueFalseTotal
unless &is_cached($filename) 0 0 0
unless &is_cached($filename) 0 0 0
unless &is_cached($filename) 0 0 0
229 0 return ($filename, $start, $end);
230 }
231  
232 # This method runs the command
233 sub run($$)
234 0 ▶{
Subroutine run: not called CC=20 SCAR=59.1
Subroutine run: not called CC=20 SCAR=59.1
Pod undocumented
Pod undocumented
235 0 my ($self, $args) = @_;
236 0 my $proc = $self->{proc};
237  
238 0 my $listsize = $proc->{settings}{maxlist};
239 0 ▶ my $center_correction =
Branch: 2 branches
BranchTrueFalseTotal
substr($args->[0], -1, 1) eq '>' ? : 0 0 0
substr($args->[0], -1, 1) eq '>' ? : 11 0 11
240 (substr($args->[0], -1, 1) eq '>') ? 0 : int(($listsize-1) / 2);
241  
242 0 my ($filename, $start, $end) = parse_list_cmd($self, $args, $listsize,
243 $center_correction);
244  
245 0 ▶ return unless $filename;
Branch: 2 branches
BranchTrueFalseTotal
unless $filename 0 0 0
unless $filename 0 11 11
246  
247 # We now have range information. Do the listing.
248 0 my $max_line = Devel::Trepan::DB::LineCache::size($filename);
249 0 $filename = map_file($filename);
250 0 ▶ unless (defined $max_line && -r $filename) {
Branch: 2 branches
BranchTrueFalseTotal
unless (defined $max_line and -r $filename) 0 0 0
unless (defined $max_line and -r $filename) 0 0 0
Condition0%0/6
defined $max_line and -r $filename
!ll&&!rl&&r
000
defined $max_line and -r $filename
!ll&&!rl&&r
000
MC/DC0%0/2
defined $max_line and -r $filename
defined $max_line -r $filename
MC/DC0%0/2
defined $max_line and -r $filename
defined $max_line -r $filename
Truth table0%0/3
A and B
A= defined $max_lineB= -r $filename
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $max_lineB= -r $filename
ABresult
0X0
100
111
251 0 $proc->errmsg("File \"$filename\" not found.");
252 0 return;
253 }
254  
255 0 ▶ if ($start > $max_line) {
Branch: 2 branches
BranchTrueFalseTotal
if ($start > $max_line) 0 0 0
if ($start > $max_line) 0 0 0
256 0 my $mess = sprintf('Bad line range [%d...%d]; file "%s" has only %d lines',
257 $start, $end, $proc->canonic_file($filename), $max_line);
258 0 $proc->errmsg($mess);
259 0 return;
260 }
261  
262 0 ▶ if ($end > $max_line) {
Branch: 2 branches
BranchTrueFalseTotal
if ($end > $max_line) 0 0 0
if ($end > $max_line) 0 0 0
263 # msg('End position changed to end line %d ' % max_line)
264 0 $end = $max_line;
265 }
266  
267 # begin
268 my $opts = {
269 reload_on_change => $proc->{settings}{reload},
270 output => $proc->{settings}{highlight}
271 0 };
272 0 my $bp;
273 0 local(*DB::dbline) = "::_<$filename";
274 0 my $lineno;
275 0 my $msg = sprintf("%s [%d-%d]",
276 $proc->canonic_file($filename), $start, $end);
277  
278 # FIXME: put in frame?
279 0 my $frame_filename = $proc->filename();
280 0 ▶ $frame_filename = map_file($frame_filename)
Branch: 2 branches
BranchTrueFalseTotal
if &filename_is_eval($frame_filename) 0 0 0
if &filename_is_eval($frame_filename) 0 0 0
281 if filename_is_eval($frame_filename);
282  
283 0 $self->section($msg);
284 0 ▶ for ($lineno = $start; $lineno <= $end; $lineno++) {
Branch: 2 branches
BranchTrueFalseTotal
if ($lineno <= $end) 0 0 0
if ($lineno <= $end) 0 0 0
285 0 my $a_pad = ' ';
286 0 my $line = getline($filename, $lineno, $opts);
287 0 ▶ unless (defined $line) {
Branch: 2 branches
BranchTrueFalseTotal
unless (defined $line) 0 0 0
unless (defined $line) 0 0 0
288 0 ▶ if ($lineno > $max_line) {
Branch: 2 branches
BranchTrueFalseTotal
if ($lineno > $max_line) { } 0 0 0
if ($lineno > $max_line) { } 0 0 0
289 0 $proc->msg('[EOF]');
290 0 last;
291 } else {
292 0 $line = '';
293 }
294 }
295 0 chomp $line;
296 0 my $s = sprintf('%3d', $lineno);
297 0 ▶ $s = $s . ' ' if length($s) < 4;
Branch: 2 branches
BranchTrueFalseTotal
if length $s < 4 0 0 0
if length $s < 4 0 0 0
298  
299 ## FIXME: move into DB::Breakpoint and adjust List.pm
300 0 ▶ if (exists($DB::dbline{$lineno}) and
Branch: 2 branches
BranchTrueFalseTotal
if (exists $DB::dbline{$lineno} and my $brkpts = $DB::dbline{$lineno}) { } 0 0 0
if (exists $DB::dbline{$lineno} and my $brkpts = $DB::dbline{$lineno}) { } 0 0 0
Condition0%0/6
exists $DB::dbline{$lineno} and my $brkpts = $DB::dbline{$lineno}
!ll&&!rl&&r
000
exists $DB::dbline{$lineno} and my $brkpts = $DB::dbline{$lineno}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $DB::dbline{$lineno} and my $brkpts = $DB::dbline{$lineno}
exists $DB::dbline{$lineno} my $brkpts = $DB::dbline{$lineno}
MC/DC0%0/2
exists $DB::dbline{$lineno} and my $brkpts = $DB::dbline{$lineno}
exists $DB::dbline{$lineno} my $brkpts = $DB::dbline{$lineno}
Truth table0%0/3
A and B
A= exists $DB::dbline{$lineno}B= my $brkpts = $DB::dbline{$lineno}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $DB::dbline{$lineno}B= my $brkpts = $DB::dbline{$lineno}
ABresult
0X0
100
111
301 my $brkpts = $DB::dbline{$lineno}) {
302 0 my $found = 0;
303 0 for my $bp (@{$brkpts}) {
304 0 ▶ if (defined($bp)) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $bp) 0 0 0
if (defined $bp) 0 0 0
305 0 $a_pad = sprintf('%02d', $bp->id);
306 0 $s .= $bp->icon_char;
307 0 $found = 1;
308 0 last;
309 }
310 }
311 0 ▶ $s .= ' ' unless $found;
Branch: 2 branches
BranchTrueFalseTotal
unless $found 0 0 0
unless $found 0 0 0
312 } else {
313 0 $s .= ' ';
314 }
315 ## FIXME move above code
316 0 my $opts = {unlimited => 1};
317 0 my $mess;
318 0 ▶ if ($proc->{frame} && $lineno == $proc->line &&
Branch: 2 branches
BranchTrueFalseTotal
if ($proc->{'frame'} and $lineno == $proc->line and $frame_filename eq $filename) { } 0 0 0
if ($proc->{'frame'} and $lineno == $proc->line and $frame_filename eq $filename) { } 0 0 0
Condition0%0/12
$proc->{"frame"} and $lineno == $proc->line and $frame_filename eq $filename
!ll&&!rl&&r
000
$proc->{"frame"} and $lineno == $proc->line
!ll&&!rl&&r
000
$proc->{"frame"} and $lineno == $proc->line and $frame_filename eq $filename
!ll&&!rl&&r
000
$proc->{"frame"} and $lineno == $proc->line
!ll&&!rl&&r
000
MC/DC0%0/3
$proc->{"frame"} and $lineno == $proc->line and $frame_filename eq $filename
$proc->{"frame"} $lineno == $proc->line $frame_filename eq $filename
MC/DC0%0/3
$proc->{"frame"} and $lineno == $proc->line and $frame_filename eq $filename
$proc->{"frame"} $lineno == $proc->line $frame_filename eq $filename
Truth table0%0/4
A and B and C
A= $proc->{"frame"}B= $lineno == $proc->lineC= $frame_filename eq $filename
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and B and C
A= $proc->{"frame"}B= $lineno == $proc->lineC= $frame_filename eq $filename
ABCresult
0XX0
10X0
1100
1111
319 $frame_filename eq $filename) {
320 0 $s .= '->';
321 0 $s = $proc->bolden($s);
322 } else {
323 0 $s .= $a_pad;
324 }
325 0 $mess = "$s\t$line";
326 0 $proc->msg($mess, $opts);
327 }
328 0 $proc->{list_line} = $lineno + $center_correction;
329 0 $proc->{list_filename} = $filename;
330 # rescue => e
331 # errmsg e.to_s if settings[:debugexcept]
332 # end
333 }
334  
335 1 ▶unless (caller) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 1 1
336 0 require Devel::Trepan::CmdProcessor::Mock;
337 0 my $proc = Devel::Trepan::CmdProcessor->new(undef, 'bogus');
338 0 my $cmd = __PACKAGE__->new($proc);
339 0 require Devel::Trepan::DB::Sub;
340 0 require Devel::Trepan::DB::LineCache;
341 0 cache_file(__FILE__);
342 0 my $frame_ary = Devel::Trepan::CmdProcessor::Mock::create_frame();
343 0 $proc->frame_setup($frame_ary);
344 0 $proc->{settings}{highlight} = undef;
345 0 $cmd->run([$NAME]);
346 0 print '-' x 20, "\n";
347 0 $proc->{current_command} = "$NAME";
348 0 $cmd->run([$NAME]);
349 0 print '-' x 20, "\n";
350 0 $proc->{current_command} = sprintf "%s %s:%s", $NAME, __FILE__, __LINE__;
351 0 $cmd->run(["{$NAME}>", __FILE__, __LINE__]);
352 0 print '-' x 20, "\n";
353 0 $proc->{current_command} = sprintf "%s %s:1", $NAME, __FILE__;
354 0 $cmd->run(["{$NAME}>", __FILE__, 1]);
355 }
356  
357 1 1;
« lib/Devel/Trepan/DB/Backtrace.pm ↑ Summary lib/Devel/Trepan/CmdProcessor/Frame.pm »