Subject: | gcov2perl improvement |
Currently, gcov2perl searches the source file in the same directory as
the .gcov file.
But .o & .gcov could be build in a different directory of the source
directory (especially in pure C project).
This issue could be easily fixed, because the first line of gcov file
contains the full path of the source file. See the following patch.
Regards.
François Perrad.
Subject: | gcov2perl.patch |
Index: gcov2perl
===================================================================
--- gcov2perl (revision 250)
+++ gcov2perl (working copy)
@@ -53,11 +53,11 @@
$run{collected} = ["statement"];
my $structure = Devel::Cover::DB::Structure->new;
$structure->add_criteria("statement");
- $run{digests}{$f} = $structure->set_file($f);
open F, $file or die "Can't open $file: $!\n";
while (<F>)
{
+ $f = $1 if /^[^:]+:[^:]+:Source:(.*)$/;
next unless my ($count, $line) = /(.{9}):\s*(\d+):/;
$count =~ s/\s+//g;
next if $count eq "-";
@@ -69,6 +69,8 @@
}
close F or die "Can't close $file: $!\n";
+ $run{digests}{$f} = $structure->set_file($f);
+
my $run = time . ".$$." . sprintf "%05d", rand 2 ** 16;
my $db = $Options->{db};
my $cover = Devel::Cover::DB->new