X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FTool%2Fmemcheck.pm;h=2c0c6840bee1b1c521b0f924d3f0b8c114c1dfad;hb=90b6c795c9fab6343c3501923aacc8f43f7a82ea;hp=1302efefc3750ed7b3af24b088382dacb3b78340;hpb=14b54bdeb3ebea2f465cf5a034c59138b736b982;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/lib/Test/Valgrind/Tool/memcheck.pm b/lib/Test/Valgrind/Tool/memcheck.pm index 1302efe..2c0c684 100644 --- a/lib/Test/Valgrind/Tool/memcheck.pm +++ b/lib/Test/Valgrind/Tool/memcheck.pm @@ -9,15 +9,15 @@ Test::Valgrind::Tool::memcheck - Run an analysis through the memcheck tool. =head1 VERSION -Version 1.02 +Version 1.12 =cut -our $VERSION = '1.02'; +our $VERSION = '1.12'; =head1 DESCRIPTION -This tool parses the XML output of a C run with L. +This class contains the information required by the session for running the C tool. =cut @@ -73,9 +73,28 @@ sub callers { $_[0]->{callers} } sub suppressions_tag { 'memcheck-' . $_[1]->version } +=head2 C + +This tool uses a L parser in analysis mode, and a L parser in suppressions mode. + +=cut + +sub parser_class { + my ($self, $session) = @_; + + my $class = $session->do_suppressions + ? 'Test::Valgrind::Parser::Suppressions::Text' + : 'Test::Valgrind::Parser::XML::Twig'; + + local $@; + eval "require $class"; + + return $class; +} + =head2 C -This tool emits C object reports in analysis mode. +This tool emits C object reports in analysis mode, and C object reports in suppressions mode. =cut @@ -99,10 +118,8 @@ sub args { '--error-limit=yes', ); - unless ($sess->do_suppressions) { - push @args, '--track-origins=yes' if $sess->version ge '3.4.0'; - push @args, '--xml=yes'; - } + push @args, '--track-origins=yes' if $sess->version ge '3.4.0' + and not $sess->do_suppressions; push @args, $self->SUPER::args(@_); @@ -113,8 +130,6 @@ sub args { L, L. -L. - =head1 AUTHOR Vincent Pit, C<< >>, L. @@ -146,7 +161,7 @@ package Test::Valgrind::Tool::memcheck::Report; use base qw/Test::Valgrind::Report/; -our $VERSION = '1.02'; +our $VERSION = '1.12'; my @kinds = qw/ InvalidFree @@ -201,9 +216,9 @@ sub dump { my ($ip, $obj, $fn, $dir, $file, $line) = map { (defined) ? $_ : '?' } @$_; my $frame; if ($fn eq '?' and $obj eq '?') { - $ip =~ s/^0x//g; - $ip = hex $ip; - $frame = sprintf "0x%0${pad}X", $ip; + $ip =~ s/^0x//gi; + my $l = length $ip; + $frame = '0x' . ($l < $pad ? ('0' x ($pad - $l)) : '') . uc($ip); } else { $frame = sprintf '%s (%s) [%s:%s]', $fn, $obj, $file, $line; }