Dpkg/Shlibs/Objdump/Object.pm

filter: Statementstmt 81.3% 135 / 166 Branchbran 73.9% 71 / 96 Conditioncond 62.5% 30 / 48 MC/DCmcdc 46.1% 12 / 26 Subroutinesub 90.4% 19 / 21 Podpod 0.0% 0 / 15 totaltotal 71.7% 267 / 372 CC 69 SCAR 27.3
CC
69
Cov
76%
parse_objdump_output
30.7
analyze
30.0
_select_objdump
12.0
CRAP 15.3
« Dpkg/Control/FieldsCore.pm ↑ Summary Dpkg/Deps/OR.pm »
1 # Copyright © 2007-2010 Raphaël Hertzog <hertzog@debian.org>
2 # Copyright © 2007-2009,2012-2015,2017-2018 Guillem Jover <guillem@debian.org>
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 2 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 <https://www.gnu.org/licenses/>.
16  
17 =encoding utf8
18  
19 =head1 NAME
20  
21 Dpkg::Shlibs::Objdump::Object - represent an object from objdump output
22  
23 =head1 DESCRIPTION
24  
25 This module provides a class to represent an object parsed from
26 L<objdump(1)> output.
27  
28 B<Note>: This is a private module, its API can change at any time.
29  
30 =cut
31  
32 package Dpkg::Shlibs::Objdump::Object 0.01;
33  
34 2 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 2 ▶use Dpkg::Gettext;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 2 ▶use Dpkg::ErrorHandling;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 2 ▶use Dpkg::Path qw(find_command);
Subroutine BEGIN: called CC=1 SCAR=0.0
39 2 ▶use Dpkg::Arch qw(debarch_to_gnutriplet get_build_arch get_host_arch);
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 24 ▶sub new {
Subroutine new: called CC=4 SCAR=15.0
Pod undocumented
42 24 my $this = shift;
43 24 ▶ my $file = shift // '';
Condition50%1/2
shift() // ""
l!l
024
MC/DC0%0/1
shift() // ""
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
44 24 ▶ my $class = ref($this) || $this;
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
0240
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
45 24 my $self = {};
46 24 bless $self, $class;
47  
48 24 $self->reset;
49 24 ▶ if ($file) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file) 0 24 24
50 0 $self->analyze($file);
51 }
52  
53 24 return $self;
54 }
55  
56 24 ▶sub reset {
Subroutine reset: called CC=1 SCAR=0.0
Pod undocumented
57 24 my $self = shift;
58  
59 24 $self->{file} = '';
60 24 $self->{id} = '';
61 24 $self->{HASH} = '';
62 24 $self->{GNU_HASH} = '';
63 24 $self->{INTERP} = 0;
64 24 $self->{SONAME} = '';
65 24 $self->{NEEDED} = [];
66 24 $self->{RPATH} = [];
67 24 $self->{dynsyms} = {};
68 24 $self->{flags} = {};
69 24 $self->{dynrelocs} = {};
70  
71 24 return $self;
72 }
73  
74 0 ▶sub _select_objdump {
Subroutine _select_objdump: not called CC=3 SCAR=24.8
75 # Decide which objdump to call.
76 0 ▶ if (get_build_arch() ne get_host_arch()) {
Branch: 1 branch
BranchTrueFalseTotal
if (get_build_arch() ne get_host_arch()) 0 0 0
77 0 my $od = debarch_to_gnutriplet(get_host_arch()) . '-objdump';
78 0 ▶ return $od if find_command($od);
Branch: 1 branch
BranchTrueFalseTotal
if find_command($od) 0 0 0
79 }
80 0 return 'objdump';
81 }
82  
83 0 ▶sub analyze {
Subroutine analyze: not called CC=5 SCAR=34.0
Pod undocumented
84 0 my ($self, $file) = @_;
85  
86 0 ▶ $file ||= $self->{file};
Condition0%0/3
$file ||= $self->{"file"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$file ||= $self->{"file"}
$file $self->{"file"}
Truth table0%0/3
A ||= B
A= $fileB= $self->{"file"}
ABresult
1X1
011
000
87 0 ▶ return unless $file;
Branch: 1 branch
BranchTrueFalseTotal
unless $file 0 0 0
88  
89 0 $self->reset;
90 0 $self->{file} = $file;
91  
92 0 $self->{exec_abi} = Dpkg::Shlibs::Objdump::get_format($file);
93  
94 0 ▶ if (not defined $self->{exec_abi}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"exec_abi"}) 0 0 0
95 0 warning(g_("unknown executable format in file '%s'"), $file);
96 0 return;
97 }
98  
99 0 state $OBJDUMP = _select_objdump();
100 0 local $ENV{LC_ALL} = 'C';
101 0 ▶ open(my $objdump, '-|', $OBJDUMP, '-w', '-f', '-p', '-T', '-R', $file)
Branch: 1 branch
BranchTrueFalseTotal
open my $objdump, "-|", $OBJDUMP, "-w", "-f", "-p", "-T", "-R", $file or syserr(g_("cannot create child process for %s"), $OBJDUMP) 0 0 0
102 or syserr(g_('cannot create child process for %s'), $OBJDUMP);
103 0 my $ret = $self->parse_objdump_output($objdump);
104 0 close($objdump);
105 0 return $ret;
106 }
107  
108 24 ▶sub parse_objdump_output {
Subroutine parse_objdump_output: called CC=29 SCAR=34.2
Pod undocumented
109 24 my ($self, $fh) = @_;
110  
111 24 my $section = 'none';
112 24 my $verneed_lib = undef;
113 24 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 13136 24 13160
114 13136 s/\s*$//;
115 13136 ▶ next if length == 0;
Branch: 1 branch
BranchTrueFalseTotal
if length $_ == 0 184 12952 13136
116  
117 12952 ▶ if (/^DYNAMIC SYMBOL TABLE:/) {
Branch: 6 branches
BranchTrueFalseTotal
if (/^DYNAMIC SYMBOL TABLE:/u) { } 24 12928 12952
elsif (/^DYNAMIC RELOCATION RECORDS/u) { } 12 12916 12928
elsif (/^Dynamic Section:/u) { } 22 12894 12916
elsif (/^Program Header:/u) { } 20 12874 12894
elsif (/^Version definitions:/u) { } 10 12864 12874
elsif (/^Version References:/u) { } 20 12844 12864
118 24 $section = 'dynsym';
119 24 next;
120 } elsif (/^DYNAMIC RELOCATION RECORDS/) {
121 12 $section = 'dynreloc';
122 # Skip header.
123 12 <$fh>;
124 12 next;
125 } elsif (/^Dynamic Section:/) {
126 22 $section = 'dyninfo';
127 22 next;
128 } elsif (/^Program Header:/) {
129 20 $section = 'program';
130 20 next;
131 } elsif (/^Version definitions:/) {
132 10 $section = 'verdef';
133 10 next;
134 } elsif (/^Version References:/) {
135 20 $section = 'verref';
136 20 next;
137 }
138  
139 12844 ▶ if ($section eq 'dynsym') {
Branch: 6 branches
BranchTrueFalseTotal
if ($section eq 'dynsym') { } 10710 2134 12844
elsif ($section eq 'dynreloc') { } 1028 1106 2134
elsif ($section eq 'dyninfo') { } 490 616 1106
elsif ($section eq 'verref') { } 92 524 616
elsif ($section eq 'program') { } 288 236 524
elsif ($section eq 'none') { } 72 164 236
140 10710 $self->parse_dynamic_symbol($_);
141 } elsif ($section eq 'dynreloc') {
142 1028 ▶ if (/^\S+\s+(\S+)\s+(.+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\S+\s+(\S+)\s+(.+)$/u) { } 1028 0 1028
143 1028 $self->{dynrelocs}{$2} = $1;
144 } else {
145 0 warning(g_('cannot parse dynamic relocation record: %s'), $_);
146 }
147 } elsif ($section eq 'dyninfo') {
148 490 ▶ if (/^\s*NEEDED\s+(\S+)/) {
Branch: 6 branches
BranchTrueFalseTotal
if (/^\s*NEEDED\s+(\S+)/u) { } 36 454 490
elsif (/^\s*SONAME\s+(\S+)/u) { } 18 436 454
elsif (/^\s*HASH\s+(\S+)/u) { } 8 428 436
elsif (/^\s*GNU_HASH\s+(\S+)/u) { } 18 410 428
elsif (/^\s*RUNPATH\s+(\S+)/u) { } 0 410 410
elsif (/^\s*RPATH\s+(\S+)/u) { } 0 410 410
149 36 push @{$self->{NEEDED}}, $1;
150 } elsif (/^\s*SONAME\s+(\S+)/) {
151 18 $self->{SONAME} = $1;
152 } elsif (/^\s*HASH\s+(\S+)/) {
153 8 $self->{HASH} = $1;
154 } elsif (/^\s*GNU_HASH\s+(\S+)/) {
155 18 $self->{GNU_HASH} = $1;
156 } elsif (/^\s*RUNPATH\s+(\S+)/) {
157 # RUNPATH takes precedence over RPATH but is considered after
158 # LD_LIBRARY_PATH while RPATH is considered before (if RUNPATH
159 # is not set).
160 0 my $runpath = $1;
161 0 $self->{RPATH} = [ split /:/, $runpath ];
162 } elsif (/^\s*RPATH\s+(\S+)/) {
163 0 my $rpath = $1;
164 0 ▶ unless (scalar(@{$self->{RPATH}})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @{$self->{"RPATH"};}) 0 0 0
165 0 $self->{RPATH} = [ split /:/, $rpath ];
166 }
167 }
168 } elsif ($section eq 'verref') {
169 92 ▶ if (/^\s*required from ([^:]*):/) {
Branch: 2 branches
BranchTrueFalseTotal
if (/^\s*required from ([^:]*):/u) { } 28 64 92
elsif (/^\s*0x[[:xdigit:]]*\s*0x[[:xdigit:]]*\s*\d*\s*(.*)/u) { } 64 0 64
170 28 $verneed_lib = $1;
171 } elsif (/^\s*0x[[:xdigit:]]*\s*0x[[:xdigit:]]*\s*\d*\s*(.*)/) {
172 64 $self->add_verneed_symbol($verneed_lib, $1);
173 }
174 } elsif ($section eq 'program') {
175 288 ▶ if (/^\s*INTERP\s+/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*INTERP\s+/u) 6 282 288
176 6 $self->{INTERP} = 1;
177 }
178 } elsif ($section eq 'none') {
179 72 ▶ if (/^\s*.+:\s*file\s+format\s+(\S+)$/) {
Branch: 2 branches
BranchTrueFalseTotal
if (/^\s*.+:\s*file\s+format\s+(\S+)$/u) { } 24 48 72
elsif (/^architecture:\s*\S+,\s*flags\s*\S+:$/u) { } 24 24 48
180 24 $self->{format} = $1;
181 } elsif (/^architecture:\s*\S+,\s*flags\s*\S+:$/) {
182 # Parse 2 lines of "-f":
183 #
184 # architecture: i386, flags 0x00000112:
185 # EXEC_P, HAS_SYMS, D_PAGED
186 # start address 0x08049b50
187 24 $_ = <$fh>;
188 24 chomp;
189 24 $self->{flags}{$_} = 1 foreach (split(/,\s*/));
190 }
191 }
192 }
193 # Update status of dynamic symbols given the relocations that have
194 # been parsed after the symbols.
195 24 $self->apply_relocations();
196  
197 24 return $section ne 'none';
198 }
199  
200 # Output format of objdump -w -T
201 #
202 # /lib/libc.so.6: file format elf32-i386
203 #
204 # DYNAMIC SYMBOL TABLE:
205 # 00056ef0 g DF .text 000000db GLIBC_2.2 getwchar
206 # 00000000 g DO *ABS* 00000000 GCC_3.0 GCC_3.0
207 # 00069960 w DF .text 0000001e GLIBC_2.0 bcmp
208 # 00000000 w D *UND* 00000000 _pthread_cleanup_pop_restore
209 # 0000b788 g DF .text 0000008e Base .protected xine_close
210 # 0000b788 g DF .text 0000008e .hidden IA__g_free
211 # | ||||||| | | | |
212 # | ||||||| | | Version str (.visibility) + Symbol name
213 # | ||||||| | Alignment
214 # | ||||||| Section name (or *UND* for an undefined symbol)
215 # | ||||||F=Function,f=file,O=object
216 # | |||||d=debugging,D=dynamic
217 # | ||||I=Indirect
218 # | |||W=warning
219 # | ||C=constructor
220 # | |w=weak
221 # | g=global,l=local,!=both global/local
222 # Size of the symbol
223 #
224 # «GLIBC_2.2» is the version string associated to the symbol
225 # «(GLIBC_2.2)» is the same but the symbol is hidden, a newer version of the
226 # symbol exist.
227  
228 2 my $vis_regex = qr/(\.protected|\.hidden|\.internal|0x\S+)/;
229 2 my $dynsym_regex = qr<
230 ^
231 [0-9a-f]+ # Symbol size.
232 \ (.{7}) # Flags.
233 \s+(\S+) # Section name.
234 \s+[0-9a-f]+ # Alignment.
235 (?:\s+(\S+))? # Version string.
236 (?:\s+$vis_regex)? # Visibility.
237 \s+(.+) # Symbol name.
238 >x;
239  
240 10710 ▶sub parse_dynamic_symbol {
Subroutine parse_dynamic_symbol: called CC=11 SCAR=24.5
Pod undocumented
241 10710 my ($self, $line) = @_;
242 10710 ▶ if ($line =~ $dynsym_regex) {
Branch: 3 branches
BranchTrueFalseTotal
if ($line =~ /$dynsym_regex/u) { } 10710 0 10710
elsif ($line =~ /^[0-9a-f]+ (.{7})\s+(\S+)\s+[0-9a-f]+/u) { } 0 0 0
elsif ($line =~ /^REG_G\d+\s+/u) { } 0 0 0
243 10710 my ($flags, $sect, $ver, $vis, $name) = ($1, $2, $3, $4, $5);
244  
245 # Special case if version is missing but extra visibility attribute
246 # replaces it in the match.
247 10710 ▶ if (defined($ver) and $ver =~ /^$vis_regex$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ver and $ver =~ /^$vis_regex$/u) 22 10688 10710
Condition100%3/3
defined $ver and $ver =~ /^$vis_regex$/u
!ll&&!rl&&r
5181017022
MC/DC100%2/2
defined $ver and $ver =~ /^$vis_regex$/u
defined $ver $ver =~ /^$vis_regex$/u
Truth table100%3/3
A and B
A= defined $verB= $ver =~ /^$vis_regex$/u
ABresult
0X0
100
111
248 22 $vis = $ver;
249 22 $ver = '';
250 }
251  
252 # Cleanup visibility field.
253 10710 ▶ $vis =~ s/^\.// if defined($vis);
Branch: 1 branch
BranchTrueFalseTotal
if defined $vis 34 10676 10710
254  
255 10710 ▶ my $symbol = {
Condition100%4/4
$ver // ""
l!l
10192518
$vis // ""
l!l
3410676
MC/DC100%1/1
$ver // ""
$ver
MC/DC100%1/1
$vis // ""
$vis
Truth table100%2/2
A
A= $ver
Aresult
11
00
Truth table100%2/2
A
A= $vis
Aresult
11
00
256 name => $name,
257 version => $ver // '',
258 section => $sect,
259 dynamic => substr($flags, 5, 1) eq 'D',
260 debug => substr($flags, 5, 1) eq 'd',
261 type => substr($flags, 6, 1),
262 weak => substr($flags, 1, 1) eq 'w',
263 local => substr($flags, 0, 1) eq 'l',
264 global => substr($flags, 0, 1) eq 'g',
265 visibility => $vis // '',
266 hidden => '',
267 defined => $sect ne '*UND*'
268 };
269  
270 # Handle hidden symbols.
271 10710 ▶ if (defined($ver) and $ver =~ /^\((.*)\)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ver and $ver =~ /^\((.*)\)$/u) 528 10182 10710
Condition100%3/3
defined $ver and $ver =~ /^\((.*)\)$/u
!ll&&!rl&&r
5189664528
MC/DC100%2/2
defined $ver and $ver =~ /^\((.*)\)$/u
defined $ver $ver =~ /^\((.*)\)$/u
Truth table100%3/3
A and B
A= defined $verB= $ver =~ /^\((.*)\)$/u
ABresult
0X0
100
111
272 528 $ver = $1;
273 528 $symbol->{version} = $1;
274 528 $symbol->{hidden} = 1;
275 }
276  
277 # Register symbol.
278 10710 $self->add_dynamic_symbol($symbol);
279 } elsif ($line =~ /^[0-9a-f]+ (.{7})\s+(\S+)\s+[0-9a-f]+/) {
280 # Same start but no version and no symbol ... just ignore.
281 } elsif ($line =~ /^REG_G\d+\s+/) {
282 # Ignore some s390-specific output like:
283 # REG_G6 g R *UND* 0000000000000000 #scratch
284 } else {
285 0 warning(g_('cannot parse dynamic symbol definition: %s'), $line);
286 }
287 }
288  
289 24 ▶sub apply_relocations {
Subroutine apply_relocations: called CC=7 SCAR=19.7
Pod undocumented
290 24 my $self = shift;
291 24 foreach my $sym (values %{$self->{dynsyms}}) {
292 # We want to mark as undefined symbols those which are currently
293 # defined but that depend on a copy relocation.
294 10760 ▶ next if not $sym->{defined};
Branch: 1 branch
BranchTrueFalseTotal
unless $sym->{"defined"} 992 9768 10760
295  
296 9768 my @relocs;
297  
298 # When objdump qualifies the symbol with a version it will use @ when
299 # the symbol is in an undefined section (which we discarded above, or
300 # @@ otherwise.
301 9768 ▶ push @relocs, $sym->{name} . '@@' . $sym->{version} if $sym->{version};
Branch: 1 branch
BranchTrueFalseTotal
if $sym->{"version"} 9564 204 9768
302  
303 # Symbols that are not versioned, or versioned but shown with objdump
304 # from binutils < 2.26, do not have a version appended.
305 9768 push @relocs, $sym->{name};
306  
307 9768 foreach my $reloc (@relocs) {
308 19332 ▶ next if not exists $self->{dynrelocs}{$reloc};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"dynrelocs"}{$reloc} 19124 208 19332
309 208 ▶ next if not $self->{dynrelocs}{$reloc} =~ /^R_.*_COPY$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dynrelocs"}{$reloc} =~ /^R_.*_COPY$/u 208 0 208
310  
311 0 $sym->{defined} = 0;
312 0 last;
313 }
314 }
315 }
316  
317 # Inject the version reference dependency as an undefined symbol into the
318 # dynamic symbol information.
319 #
320 # We do not currently use the $solib name, which would denote a stronger
321 # tighter dependency on a specific shared object, but for now this should
322 # suffice.
323 64 ▶sub add_verneed_symbol($self, $solib, $name)
Subroutine add_verneed_symbol: called CC=1 SCAR=0.0
Pod undocumented
324 {
325 64 my $symbol = {
326 name => $name,
327 version => $name,
328 section => '*UND*',
329 dynamic => 1,
330 debug => 0,
331 type => 'O',
332 weak => 0,
333 local => 0,
334 global => 1,
335 visibility => '',
336 hidden => '',
337 defined => 0,
338 };
339  
340 # Register synthetic symbol.
341 64 $self->add_dynamic_symbol($symbol);
342  
343 64 return;
344 }
345  
346 10778 ▶sub add_dynamic_symbol {
Subroutine add_dynamic_symbol: called CC=3 SCAR=11.0
Pod undocumented
347 10778 my ($self, $symbol) = @_;
348 10778 $symbol->{objid} = $symbol->{soname} = $self->get_id();
349 10778 ▶ $symbol->{soname} =~ s{^.*/}{} unless $self->{SONAME};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"SONAME"} 828 9950 10778
350 10778 ▶ if ($symbol->{version}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($symbol->{'version'}) { } 10238 540 10778
351 10238 $self->{dynsyms}{$symbol->{name} . '@' . $symbol->{version}} = $symbol;
352 } else {
353 540 $self->{dynsyms}{$symbol->{name} . '@Base'} = $symbol;
354 }
355 }
356  
357 10778 ▶sub get_id {
Subroutine get_id: called CC=2 SCAR=7.1
Pod undocumented
358 10778 my $self = shift;
359 10778 ▶ return $self->{SONAME} || $self->{file};
Condition66%2/3
$self->{'SONAME'} || $self->{'file'}
l!l&&r!l&&!r
99500828
MC/DC50%1/2
$self->{'SONAME'} || $self->{'file'}
$self->{'SONAME'} $self->{'file'}
Truth table66%2/3
A || B
A= $self->{'SONAME'}B= $self->{'file'}
ABresult
1X1
011
000
360 }
361  
362 38 ▶sub get_symbol {
Subroutine get_symbol: called CC=4 SCAR=14.3
Pod undocumented
363 38 my ($self, $name) = @_;
364 38 ▶ if (exists $self->{dynsyms}{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"dynsyms"}{$name}) 32 6 38
365 32 return $self->{dynsyms}{$name};
366 }
367 6 ▶ if ($name !~ /@/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($name =~ /@/u) 6 0 6
368 6 ▶ if (exists $self->{dynsyms}{$name . '@Base'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"dynsyms"}{$name . '@Base'}) 6 0 6
369 6 return $self->{dynsyms}{$name . '@Base'};
370 }
371 }
372 0 return;
373 }
374  
375 35 ▶sub get_exported_dynamic_symbols {
Subroutine get_exported_dynamic_symbols: called CC=3 SCAR=11.0
Pod undocumented
376 35 my $self = shift;
377 return grep {
378 $_->{defined} && $_->{dynamic} && ! $_->{local}
379 35 ▶ } values %{$self->{dynsyms}};
Condition83%5/6
$_->{'defined'} && $_->{'dynamic'} && !$_->{'local'}
!ll&&!rl&&r
345022668
$_->{"defined"} and $_->{"dynamic"}
!ll&&!rl&&r
2856022668
MC/DC66%2/3
$_->{'defined'} && $_->{'dynamic'} && !$_->{'local'}
$_->{"defined"} $_->{"dynamic"} !$_->{'local'}
Truth table75%3/4
A and B && not(C)
A= $_->{"defined"}B= $_->{"dynamic"}C= !$_->{'local'}
ABCresult
0XX0
10X0
1100
1111
380 }
381  
382 2 ▶sub get_undefined_dynamic_symbols {
Subroutine get_undefined_dynamic_symbols: called CC=2 SCAR=7.0
Pod undocumented
383 2 my $self = shift;
384 return grep {
385 (! $_->{defined}) && $_->{dynamic}
386 2 ▶ } values %{$self->{dynsyms}};
Condition66%2/3
!$_->{'defined'} && $_->{'dynamic'}
!ll&&!rl&&r
4462018
MC/DC50%1/2
!$_->{'defined'} && $_->{'dynamic'}
!$_->{'defined'} $_->{'dynamic'}
Truth table66%2/3
not(A) && B
A= !$_->{'defined'}B= $_->{'dynamic'}
ABresult
0X0
100
111
387 }
388  
389 2 ▶sub get_needed_libraries {
Subroutine get_needed_libraries: called CC=1 SCAR=0.0
Pod undocumented
390 2 my $self = shift;
391 2 return @{$self->{NEEDED}};
392 }
393  
394 8 ▶sub is_executable {
Subroutine is_executable: called CC=4 SCAR=15.6
Pod undocumented
395 8 my $self = shift;
396 return (exists $self->{flags}{EXEC_P} && $self->{flags}{EXEC_P}) ||
397 8 ▶ (exists $self->{INTERP} && $self->{INTERP});
Condition55%5/9
exists $self->{'flags'}{'EXEC_P'} && $self->{'flags'}{'EXEC_P'} || exists $self->{'INTERP'} && $self->{'INTERP'}
l!l&&r!l&&!r
044
exists $self->{"flags"}{"EXEC_P"} and $self->{"flags"}{"EXEC_P"}
!ll&&!rl&&r
800
exists $self->{"INTERP"} and $self->{"INTERP"}
!ll&&!rl&&r
044
MC/DC25%1/4
exists $self->{'flags'}{'EXEC_P'} && $self->{'flags'}{'EXEC_P'} || exists $self->{'INTERP'} && $self->{'INTERP'}
exists $self->{"flags"}{"EXEC_P"} $self->{"flags"}{"EXEC_P"} exists $self->{"INTERP"} $self->{"INTERP"}
Truth table28%2/7
A and B || C and D
A= exists $self->{"flags"}{"EXEC_P"}B= $self->{"flags"}{"EXEC_P"}C= exists $self->{"INTERP"}D= $self->{"INTERP"}
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
398 }
399  
400 8 ▶sub is_public_library {
Subroutine is_public_library: called CC=4 SCAR=17.1
Pod undocumented
401 8 my $self = shift;
402 return exists $self->{flags}{DYNAMIC} && $self->{flags}{DYNAMIC}
403 8 ▶ && exists $self->{SONAME} && $self->{SONAME};
Condition44%4/9
exists $self->{'flags'}{'DYNAMIC'} && $self->{'flags'}{'DYNAMIC'} && exists $self->{'SONAME'} && $self->{'SONAME'}
!ll&&!rl&&r
044
exists $self->{"flags"}{"DYNAMIC"} and $self->{"flags"}{"DYNAMIC"} and exists $self->{"SONAME"}
!ll&&!rl&&r
008
exists $self->{"flags"}{"DYNAMIC"} and $self->{"flags"}{"DYNAMIC"}
!ll&&!rl&&r
008
MC/DC25%1/4
exists $self->{'flags'}{'DYNAMIC'} && $self->{'flags'}{'DYNAMIC'} && exists $self->{'SONAME'} && $self->{'SONAME'}
exists $self->{"flags"}{"DYNAMIC"} $self->{"flags"}{"DYNAMIC"} exists $self->{"SONAME"} $self->{'SONAME'}
Truth table40%2/5
A and B and C && D
A= exists $self->{"flags"}{"DYNAMIC"}B= $self->{"flags"}{"DYNAMIC"}C= exists $self->{"SONAME"}D= $self->{'SONAME'}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
404 }
405  
406 =head1 CHANGES
407  
408 =head2 Version 0.xx
409  
410 This is a private module.
411  
412 =cut
413  
414 2 1;
« Dpkg/Control/FieldsCore.pm ↑ Summary Dpkg/Deps/OR.pm »