X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FSuppressions.pm;h=1226aab89d4e993983eb8b719d9e1935c872de63;hp=cd59fc2126015cb617d5e82dc3d61060e5c23241;hb=b34179155630f5f4cbea1749af4054a746ded9a4;hpb=90b6c795c9fab6343c3501923aacc8f43f7a82ea diff --git a/lib/Test/Valgrind/Suppressions.pm b/lib/Test/Valgrind/Suppressions.pm index cd59fc2..1226aab 100644 --- a/lib/Test/Valgrind/Suppressions.pm +++ b/lib/Test/Valgrind/Suppressions.pm @@ -9,11 +9,11 @@ Test::Valgrind::Suppressions - Generate suppressions for given tool and command. =head1 VERSION -Version 1.12 +Version 1.17 =cut -our $VERSION = '1.12'; +our $VERSION = '1.17'; =head1 DESCRIPTION @@ -21,11 +21,17 @@ This module is an helper for generating suppressions. =cut -use base qw/Test::Valgrind::Carp/; +use base qw; =head1 METHODS -=head2 C<< generate tool => $tool, command => $command, target => $target >> +=head2 C + + 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. @@ -88,30 +94,40 @@ sub generate { return $status; } -=head2 C +=head2 C + + my $mangled_suppression = Test::Valgrind::Suppressions->maybe_generalize( + $session, + $suppression, + ); Removes all wildcard frames at the end of the suppression. -Moreover, C<'...'> is appended when C C<3.4.0> or higher is used. +It also replaces sequences of wildcard frames by C<'...'> when C C<3.4.0> or higher is used. Returns the mangled suppression. =cut -sub strip_tail { +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 ge '3.4.0') { - 1 while $supp =~ s/[^\r\n]*\.{3}\s*$//; $supp .= "...\n"; + $supp =~ s/(?:^\s*(?:\.{3}|\*:\S*|obj:\*)\s*\n)+/...\n/mg; } $supp; } -=head2 C +=head2 C + + my $demangled_symbol = Test::Valgrind::Suppressions->maybe_z_demangle( + $symbol, + ); If C<$symbol> is Z-encoded as described in C's F, extract and decode its function name part. Otherwise, C<$symbol> is returned as is. @@ -182,7 +198,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2008-2009 Vincent Pit, all rights reserved. +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.