]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Suppressions.pm
Improve perl suppressions accuracy
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Suppressions.pm
index bee6a0dd45a3e7e840b3782b0807998a8cc7e030..a125839a6dff017fee51fd0e9804c66c7ebd80e0 100644 (file)
@@ -94,29 +94,30 @@ sub generate {
  return $status;
 }
 
-=head2 C<strip_tail>
+=head2 C<maybe_generalize>
 
-    my $mangled_suppression = Test::Valgrind::Suppressions->strip_tail(
+    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<valgrind> C<3.4.0> or higher is used.
+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 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;