Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCOV: What is the difference between --coverage and --ftest-coverage when building with GCC?

Tags:

Trying to get code coverage up and running, and I'm just reading documentation first. I found a few articles that mention building with the --coverage flag, while others mention the --ftest-coverage.

Both descriptions seem to say they do the same thing, but I'm not certain.


Here's two articles:

  • http://bobah.net/d4d/tools/code-coverage-with-gcov

  • http://www.osadl.org/Dumping-gcov-data-at-runtime-simple-ex.online-coverage-analysis.0.html


What's the difference?

like image 368
user3338893 Avatar asked Mar 03 '15 19:03

user3338893


People also ask

What is difference between gcov and LCOV?

Lcov is a graphical front-end for gcov. It collects gcov data for multiple source files and creates HTML pages containing the source code annotated with coverage information. It also adds overview pages for easy navigation within the file structure. Lcov supports statement, function, and branch coverage measurement.

What is gcov in GCC?

DESCRIPTION. gcov is a test coverage program. Use it in concert with GCC to analyze your programs to help create more efficient, faster running code and to discover untested parts of your program. You can use gcov as a profiling tool to help discover where your optimization efforts will best affect your code.


1 Answers

As already stated in the comments --coverage is a synonym for other flags related to code coverage depending on the context.

3.11 Program Instrumentation Options:

--coverage

This option is used to compile and link code instrumented for coverage analysis. The option is a synonym for -fprofile-arcs -ftest-coverage (when compiling) and -lgcov (when linking).

like image 185
sigy Avatar answered Sep 28 '22 05:09

sigy