X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FSuppressions.pm;h=62d43e88cd9d3b4e35ad3eff4a91893ce2454271;hp=1226aab89d4e993983eb8b719d9e1935c872de63;hb=f2071d95aaaa4817e91cc33530deedc8d701d44d;hpb=b34179155630f5f4cbea1749af4054a746ded9a4 diff --git a/lib/Test/Valgrind/Suppressions.pm b/lib/Test/Valgrind/Suppressions.pm index 1226aab..62d43e8 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.17 +Version 1.19 =cut -our $VERSION = '1.17'; +our $VERSION = '1.19'; =head1 DESCRIPTION @@ -115,9 +115,28 @@ sub maybe_generalize { 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') { - $supp .= "...\n"; - $supp =~ s/(?:^\s*(?:\.{3}|\*:\S*|obj:\*)\s*\n)+/...\n/mg; + my $can_ellipsis = $sess->version >= '3.4.0'; + + my $did_length_check; + + ELLIPSIS: { + if ($can_ellipsis) { + $supp .= "...\n"; + $supp =~ s/(?:^\s*(?:\.{3}|\*:\S*|obj:\*)\s*(?:\n|\z))+/...\n/mg; + } + + last if $did_length_check++; + + my $frames_count =()= $supp =~ m/^(?:(?:obj|fun|\*):|\.{3}\s*$)/mg; + if ($frames_count > 24) { + # Keep only 24 frames, and even sacrifice one more if we can do ellipsis. + my $last = $can_ellipsis ? 23 : 24; + my $len = length $supp; + $supp =~ m/^(?:(?:obj|fun|\*):\S*|\.{3})\s*\n/mg for 1 .. $last; + my $p = pos $supp; + substr $supp, $p, $len - $p, ''; + redo ELLIPSIS if $can_ellipsis; + } } $supp; @@ -198,7 +217,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2008,2009,2010,2011,2013,2015 Vincent Pit, all rights reserved. +Copyright 2008,2009,2010,2011,2013,2015,2016 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.