This file is indexed.

/usr/share/perl5/Test/Valgrind/Suppressions.pm is in libtest-valgrind-perl 1.18-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package Test::Valgrind::Suppressions;

use strict;
use warnings;

=head1 NAME

Test::Valgrind::Suppressions - Generate suppressions for given tool and command.

=head1 VERSION

Version 1.18

=cut

our $VERSION = '1.18';

=head1 DESCRIPTION

This module is an helper for generating suppressions.

=cut

use base qw<Test::Valgrind::Carp>;

=head1 METHODS

=head2 C<generate>

    Test::Valgrind::Suppressions->generate(
     tool    => $tool,
     command => $command,
     target  => $target,
    );

Generates suppressions for the command C<< $command->new_trainer >> and the tool C<< $tool->new_trainer >>, and writes them in the file specified by C<$target>.
The action used behind the scenes is L<Test::Valgrind::Action::Suppressions>.

Returns the status code.

=cut

sub generate {
 my $self = shift;

 my %args = @_;

 my $cmd = delete $args{command};
 unless (ref $cmd) {
  require Test::Valgrind::Command;
  $cmd = Test::Valgrind::Command->new(
   command => $cmd,
   args    => [ ],
  );
 }
 $cmd = $cmd->new_trainer;
 return unless defined $cmd;

 my $tool = delete $args{tool};
 unless (ref $tool) {
  require Test::Valgrind::Tool;
  $tool = Test::Valgrind::Tool->new(tool => $tool);
 }
 $tool = $tool->new_trainer;
 return unless defined $tool;

 my $target = delete $args{target};
 $self->_croak('Invalid target') unless $target and not ref $target;

 require Test::Valgrind::Action;
 my $action = Test::Valgrind::Action->new(
  action => 'Suppressions',
  target => $target,
  name   => 'PerlSuppression',
 );

 require Test::Valgrind::Session;
 my $sess = Test::Valgrind::Session->new(
  min_version => $tool->requires_version,
 );

 eval {
  $sess->run(
   command => $cmd,
   tool    => $tool,
   action  => $action,
  );
 };
 $self->_croak($@) if $@;

 my $status = $sess->status;
 $status = 255 unless defined $status;

 return $status;
}

=head2 C<maybe_generalize>

    my $mangled_suppression = Test::Valgrind::Suppressions->maybe_generalize(
     $session,
     $suppression,
    );

Removes all wildcard frames at the end of the suppression.
It also replaces sequences of wildcard frames by C<'...'> when C<valgrind> C<3.4.0> or higher is used.
Returns the mangled suppression.

=cut

sub maybe_generalize {
 shift;

 my ($sess, $supp) = @_;

 1 while $supp =~ s/[^\r\n]*:\s*\*\s*$//;

 # With valgrind 3.4.0, we can replace unknown series of frames by '...'
 if ($sess->version >= '3.4.0') {
  $supp .= "...\n";
  $supp =~ s/(?:^\s*(?:\.{3}|\*:\S*|obj:\*)\s*\n)+/...\n/mg;
 }

 $supp;
}

=head2 C<maybe_z_demangle>

    my $demangled_symbol = Test::Valgrind::Suppressions->maybe_z_demangle(
     $symbol,
    );

If C<$symbol> is Z-encoded as described in C<valgrind>'s F<include/pub_tool_redir.h>, extract and decode its function name part.
Otherwise, C<$symbol> is returned as is.

This routine follows C<valgrind>'s F<coregrind/m_demangle/demangle.c:maybe_Z_demangle>.

=cut

my %z_escapes = (
 a => '*',
 c => ':',
 d => '.',
 h => '-',
 p => '+',
 s => ' ',
 u => '_',
 A => '@',
 D => '$',
 L => '(',
 R => ')',
 Z => 'Z',
);

sub maybe_z_demangle {
 my ($self, $sym) = @_;

 $sym =~ s/^_vg[rwn]Z([ZU])_// or return $sym;

 my $fn_is_encoded = $1 eq 'Z';

 $sym =~ /^VG_Z_/ and $self->_croak('Symbol with a "VG_Z_" prefix is invalid');
 $sym =~ s/^[^_]*_//
                   or $self->_croak('Symbol doesn\'t contain a function name');

 if ($fn_is_encoded) {
  $sym =~ s/Z(.)/
   my $c = $z_escapes{$1};
   $self->_croak('Invalid escape sequence') unless defined $c;
   $c;
  /ge;
 }

 $self->_croak('Empty symbol') unless length $sym;

 return $sym;
}

=head1 SEE ALSO

L<Test::Valgrind>, L<Test::Valgrind::Command>, L<Test::Valgrind::Tool>, L<Test::Valgrind::Action::Suppressions>.

=head1 AUTHOR

Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.

You can contact me by mail or on C<irc.perl.org> (vincent).

=head1 BUGS

Please report any bugs or feature requests to C<bug-test-valgrind-suppressions at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind>.
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Test::Valgrind::Suppressions

=head1 COPYRIGHT & LICENSE

Copyright 2008,2009,2010,2011,2013,2015 Vincent Pit, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

=cut

1; # End of Test::Valgrind::Suppressions