Anonymous avatar Anonymous committed eef58dc

gcov: add configuration file option to not use gcov's -a option

lcov calls gcov while specifying its --all-blocks option to get more
detailed branch coverage data per line. It turns out that this option
is broken on many versions of gcov, resulting in an endless loop while
processing some gcov data files. There's also a slight performance
penalty when specifying -a.

lcov users can opt to not use the -a option by setting configuration
option geninfo_gcov_all_blocks to 0 in the lcovrc file.

Comments (0)

Files changed (3)

 our @gcov_options;
 our @internal_dirs;
 our $opt_config_file;
+our $opt_gcov_all_blocks = 1;
 
 our $cwd = `pwd`;
 chomp($cwd);
 		"geninfo_no_checksum"		=> \$no_checksum, # deprecated
 		"geninfo_compat_libtool"	=> \$compat_libtool,
 		"geninfo_external"		=> \$opt_external,
+		"geninfo_gcov_all_blocks"	=> \$opt_gcov_all_blocks,
 	});
 
 	# Merge options
 $gcov_caps = get_gcov_capabilities();
 push(@gcov_options, "-b") if ($gcov_caps->{'branch-probabilities'});
 push(@gcov_options, "-c") if ($gcov_caps->{'branch-counts'});
-push(@gcov_options, "-a") if ($gcov_caps->{'all-blocks'});
+push(@gcov_options, "-a") if ($gcov_caps->{'all-blocks'} &&
+			      $opt_gcov_all_blocks);
 push(@gcov_options, "-p") if ($gcov_caps->{'preserve-paths'});
 
 # Check output filename
 # option of geninfo if non-zero, same as --no-checksum if zero)
 #geninfo_checksum = 1
 
+# Specify whether to capture coverage data for external source files (can
+# be overridden by the --external and --no-external options of geninfo/lcov)
+#geninfo_external = 1
+
 # Enable libtool compatibility mode if non-zero (same as --compat-libtool option
 # of geninfo if non-zero, same as --no-compat-libtool if zero)
 #geninfo_compat_libtool = 0
 
+# Use gcov's --all-blocks option if non-zero
+#geninfo_gcov_all_blocks = 1
+
 # Directory containing gcov kernel files
 # lcov_gcov_dir = /proc/gcov
 
 # choosing a directory prefix in list output. This value is ignored when
 # lcov_list_full_path is non-zero.
 lcov_list_truncate_max = 20
-
-# Specify whether to capture coverage data for external source files (can
-# be overridden by the --external and --no-external options of geninfo/lcov)
-geninfo_external = 1
 geninfo_compat_libtool = 0
 .br
 
+# Specify whether to capture coverage data for external source
+.br
+# files
+.br
+#geninfo_external = 1
+.br
+
+# Use gcov's --all-blocks option if non-zero
+.br
+#geninfo_gcov_all_blocks = 1
+.br
+
 # Directory containing gcov kernel files
 .br
 lcov_gcov_dir = /proc/gcov
 .br
 lcov_list_truncate_max = 20
 
-# Specify whether to capture coverage data for external source
-.br
-# files
-.br
-geninfo_external = 1
-.br
 .PP
 
 .SH OPTIONS
 Default is 1.
 .PP
 
+.BR geninfo_gcov_all_blocks " ="
+.IR 0 | 1
+.IP
+If non\-zero, call the gcov tool with option --all-blocks.
+
+Using --all-blocks will produce more detailed branch coverage information for
+each line. Set this option to zero if you do not need detailed branch coverage
+information to speed up the process of capturing code coverage or to work
+around a bug in some versions of gcov which will cause it to endlessly loop
+when analysing some files.
+
+Default is 1.
+.PP
 
 .BR lcov_gcov_dir " ="
 .I path_to_kernel_coverage_data
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.