X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FParser%2FSuppressions%2FText.pm;h=c8e6e9f73ee604c734b34a9059392159a317554a;hb=f81011346e3e0eb98b78830bcdb9b547a09ad3e8;hp=d84adbf2ac4b112c66a44ccfad7905f343bca215;hpb=01ace0ff88ffd8fb63dfebcc3b8a8baaf9e0df25;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/lib/Test/Valgrind/Parser/Suppressions/Text.pm b/lib/Test/Valgrind/Parser/Suppressions/Text.pm index d84adbf..c8e6e9f 100644 --- a/lib/Test/Valgrind/Parser/Suppressions/Text.pm +++ b/lib/Test/Valgrind/Parser/Suppressions/Text.pm @@ -9,18 +9,20 @@ Test::Valgrind::Parser::Suppressions::Text - Parse valgrind suppressions output =head1 VERSION -Version 1.02 +Version 1.11 =cut -our $VERSION = '1.02'; +our $VERSION = '1.11'; =head1 DESCRIPTION -This is a L object that can extract suppressions from C's text output. +This is a L object that can extract suppressions from C's text output. =cut +use Test::Valgrind::Suppressions; + use base qw/Test::Valgrind::Parser::Text Test::Valgrind::Carp/; =head1 METHODS @@ -34,12 +36,6 @@ Their C member contains the raw text of the suppression. sub report_class { 'Test::Valgrind::Report::Suppressions' } -=head2 C - -Parses the filehandle C<$fh> fed with the output of F and sends a report to the session C<$session> for each suppression. - -=cut - sub parse { my ($self, $sess, $fh) = @_; @@ -50,7 +46,6 @@ sub parse { s/^\s*#\s//; # Strip comments next if /^==/; # Valgrind info line - next if /valgrind/; # and /\Q$file\E/; s/^\s*//; # Strip leading spaces s/<[^>]+>//; # Strip tags @@ -60,18 +55,19 @@ sub parse { 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; } elsif ($in) { # We're inside a suppresion block - $s .= "$_\n"; # Append the current line to the state + if (/^fun\s*:\s*(.*)/) { + # Sometimes valgrind seems to forget to Z-demangle the symbol names. + # Make sure it's done and append the result to the state. + my $sym = $1; + $s .= 'fun:' . Test::Valgrind::Suppressions->maybe_z_demangle($sym) . "\n"; + } else { + $s .= "$_\n"; + } } }