r176617 - Add flags for additional control over coverage generation. Pick the version

Nick Lewycky nicholas at mxc.ca
Fri Mar 8 15:40:50 PST 2013


Sean Silva wrote:
> I fully agree with Chandler.

Yep. Sorry I've been slow to follow up, I thought I would get back to 
this the next morning. Besides just adding comments, I also need tests, 
I should sink the CoverageVersion byte reversal down inside 
GCovProfiling, and I got the sense of the flag 
"-coverage-function-names-in-data" backwards (turning it on turns 
function names off).

  One concrete request:
>
> +  /// The version string to put into coverage files.
> +  char CoverageVersion[4];
>
> Could you give an explicit link to the spec where the meaning of these
> magic 4 characters is defined?

To quote http://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html:

   "The full details of the file format is specified in gcov-io.h, and 
functions provided in that header file should be used to access the 
coverage files."

where gcov-io.h is a file in gcc's source code. That file does have a 
comment blob on the top which explains a bit about the format including 
the mysterious version number. You can read it here: 
http://opensource.apple.com/source/gcc/gcc-1765/gcc/gcov-io.h

Do you want me to include a link to the gcc source code?

My advice for picking a version is to start with any four bytes, and run 
gcov over your generated files. Gcov will emit a version warning telling 
you which 4 bytes it wanted to see:

   $ gcov foo.gcno
   foo.gcno:version '402*', prefer '407*'

Nick



More information about the cfe-commits mailing list