=cut
+use Test::Valgrind::Suppressions;
+
use base qw/Test::Valgrind::Parser::Text Test::Valgrind::Carp/;
=head1 METHODS
if ($_ eq '{') { # A suppression block begins
$in = 1;
} elsif ($_ eq '}') { # A suppression block ends
- # With valgrind 3.4.0, we can replace unknown series of frames by '...'
- if ($sess->version ge '3.4.0') {
- my $unknown_tail;
- ++$unknown_tail while $s =~ s/(\n)\s*obj:\*\s*$/$1/;
- $s .= "...\n" if $unknown_tail;
- }
-
+ $s = Test::Valgrind::Suppressions->strip_tail($sess, $s); # Strip the tail
push @supps, $s; # Add the suppression that just ended to the list
$s = ''; # Reset the state
$in = 0;
return $status;
}
+=head2 C<strip_tail $session, $suppression>
+
+Removes all wildcard frames at the end of the suppression.
+Moreover, C<'...'> is appended when C<valgrind> C<3.4.0> or higher is used.
+Returns the mangled suppression.
+
+=cut
+
+sub strip_tail {
+ 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 '...'
+ $supp .= "...\n" if $sess->version ge '3.4.0';
+
+ $supp;
+}
+
=head1 SEE ALSO
L<Test::Valgrind>, L<Test::Valgrind::Command>, L<Test::Valgrind::Tool>, L<Test::Valgrind::Action::Suppressions>.