Page MenuHomePhabricator

Fix reading gcov data that does not have function names
Needs ReviewPublic

Authored by arseny.kapoulkine on Jan 14 2016, 8:59 PM.

Details

Reviewers
bogner
Summary

In order for recent gcov versions to read the coverage data, you have to use UseCfgChecksum=true and FunctionNamesInData=false options for coverage profiling pass. This is because gcov is expecting the function section in .gcda to be exactly 3 words in size, containing ident and two checksums.

While llvm-cov is compatible with UseCfgChecksum=true, it always expects a function name in .gcda function sections (it's not compatible with FunctionNamesInData=false). Thus it's currently impossible to generate one set of coverage files that works with both gcov and llvm-cov.

This change fixes the reading of coverage information to only read the function name if it's present.

Diff Detail

Event Timeline

arseny.kapoulkine retitled this revision from to Fix reading gcov data that does not have function names.
arseny.kapoulkine updated this object.
arseny.kapoulkine added a reviewer: bogner.
arseny.kapoulkine added a subscriber: llvm-commits.
vsk added a subscriber: vsk.Jan 19 2016, 7:44 PM

Updated the diff to use "have we read the entire chunk" as a condition so that we don't have to track the required length specifically. Also added a test (compiled with clang with options that make the output gcov-compatible).

Updated the diff to use "have we read the entire chunk" as a condition so that we don't have to track the required length specifically. Also added a test (compiled with clang with options that make the output gcov-compatible).