@@ -73,7 +73,7 @@ use Digest::MD5 qw(md5_base64);
73
73
74
74
# Global constants
75
75
our $title = " LCOV - code coverage report" ;
76
- our $lcov_version = ' LCOV version 1.11 pre (CVS $Revision: 1.72 $)' ;
76
+ our $lcov_version = ' LCOV version 1.11 pre (CVS $Revision: 1.73 $)' ;
77
77
our $lcov_url = " http://ltp.sourceforge.net/coverage/lcov.php" ;
78
78
our $tool_name = basename($0 );
79
79
@@ -706,6 +706,8 @@ sub get_fn_list($)
706
706
# rename_functions(info, conv)
707
707
#
708
708
# Rename all function names in INFO according to CONV: OLD_NAME -> NEW_NAME.
709
+ # In case two functions demangle to the same name, assume that they are
710
+ # different object code implementations for the same source function.
709
711
#
710
712
711
713
sub rename_functions ($$)
@@ -719,57 +721,66 @@ sub rename_functions($$)
719
721
my $sumfnccount ;
720
722
my %newfuncdata ;
721
723
my %newsumfnccount ;
724
+ my $f_found ;
725
+ my $f_hit ;
722
726
723
727
# funcdata: function name -> line number
724
728
$funcdata = $data -> {" func" };
725
- foreach my $fn_name (keys (%{$funcdata })) {
726
- $newfuncdata {$conv -> {$fn_name }} = $funcdata -> {$fn_name };
729
+ foreach my $fn (keys (%{$funcdata })) {
730
+ my $cn = $conv -> {$fn };
731
+
732
+ # Abort if two functions on different lines map to the
733
+ # same demangled name.
734
+ if (defined ($newfuncdata {$cn }) &&
735
+ $newfuncdata {$cn } != $funcdata -> {$fn }) {
736
+ die (" ERROR: Demangled function name $fn " .
737
+ " maps to different lines (" .
738
+ $newfuncdata {$cn }." vs " .
739
+ $funcdata -> {$fn }." )\n " );
740
+ }
741
+ $newfuncdata {$cn } = $funcdata -> {$fn };
727
742
}
728
743
$data -> {" func" } = \%newfuncdata ;
729
744
730
745
# testfncdata: test name -> testfnccount
731
746
# testfnccount: function name -> execution count
732
747
$testfncdata = $data -> {" testfnc" };
733
- foreach my $test_name (keys (%{$testfncdata })) {
734
- my $testfnccount = $testfncdata -> {$test_name };
748
+ foreach my $tn (keys (%{$testfncdata })) {
749
+ my $testfnccount = $testfncdata -> {$tn };
735
750
my %newtestfnccount ;
736
751
737
- foreach my $fn_name (keys (%{$testfnccount })) {
738
- $newtestfnccount {$conv -> {$fn_name }} =
739
- $testfnccount -> {$fn_name };
752
+ foreach my $fn (keys (%{$testfnccount })) {
753
+ my $cn = $conv -> {$fn };
754
+
755
+ # Add counts for different functions that map
756
+ # to the same name.
757
+ $newtestfnccount {$cn } +=
758
+ $testfnccount -> {$fn };
740
759
}
741
- $testfncdata -> {$test_name } = \%newtestfnccount ;
760
+ $testfncdata -> {$tn } = \%newtestfnccount ;
742
761
}
743
762
744
763
# sumfnccount: function name -> execution count
745
764
$sumfnccount = $data -> {" sumfnc" };
746
- foreach my $fn_name (keys (%{$sumfnccount })) {
747
- $newsumfnccount {$conv -> {$fn_name }} =
748
- $sumfnccount -> {$fn_name };
765
+ foreach my $fn (keys (%{$sumfnccount })) {
766
+ my $cn = $conv -> {$fn };
767
+
768
+ # Add counts for different functions that map
769
+ # to the same name.
770
+ $newsumfnccount {$cn } += $sumfnccount -> {$fn };
749
771
}
750
772
$data -> {" sumfnc" } = \%newsumfnccount ;
751
- }
752
- }
753
773
754
- #
755
- # check_unique_conv(CONV)
756
- #
757
- # Check that there is no A in CONV: A -> B where C -> B.
758
- #
759
-
760
- sub check_unique_conv ($)
761
- {
762
- my ($conv ) = @_ ;
763
- my %rconv ;
764
-
765
- foreach my $fn_name (keys (%{$conv })) {
766
- my $c = $conv -> {$fn_name };
767
-
768
- if (defined ($rconv {$c })) {
769
- die (" ERROR: non-unique c++filt output for " .
770
- " '$fn_name ' and '$rconv {$c }!\n " );
774
+ # Update function found and hit counts since they may have
775
+ # changed
776
+ $f_found = 0;
777
+ $f_hit = 0;
778
+ foreach my $fn (keys (%newsumfnccount )) {
779
+ $f_found ++;
780
+ $f_hit ++ if ($newsumfnccount {$fn } > 0);
771
781
}
772
- $rconv {$c } = $fn_name ;
782
+ $data -> {" f_found" } = $f_found ;
783
+ $data -> {" f_hit" } = $f_hit ;
773
784
}
774
785
}
775
786
@@ -821,9 +832,6 @@ sub demangle_cpp($)
821
832
$changed ++ if ($fn_list -> [$i ] ne $fn_list_demangled [$i ]);
822
833
}
823
834
824
- # Should not be necessary but could silently produce incorrect results
825
- check_unique_conv(\%demangled );
826
-
827
835
info(" Demangling $changed function names\n " );
828
836
829
837
# Change all occurrences of function names in INFO
0 commit comments