commands.sh

gcov

linux

Code coverage analysis and profiling tool that discovers untested parts of a program. Also displays a copy of source code annotated with execution frequencies of code segments.

More info →

Options (5)

-a, --all-blocksboolean

Write individual execution counts for every basic block

Example: gcov {{[-a|--all-blocks]}} {{path/to/file.cpp}}
-b, --branch-probabilitiesboolean

Write branch frequencies to the output file and print summary information to `stdout` as a percentage

Example: gcov {{[-b|--branch-probabilities]}} {{path/to/file.cpp}}
-c, --branch-countsboolean

Write branch frequencies as the number of branches taken, rather than the percentage

Example: gcov {{[-c|--branch-counts]}} {{path/to/file.cpp}}
-n, --no-outputboolean

Do not create a `gcov` output file

Example: gcov {{[-n|--no-output]}} {{path/to/file.cpp}}
-f, --function-summariesboolean

Write file level as well as function level summaries

Example: gcov {{[-f|--function-summaries]}} {{path/to/file.cpp}}

Examples (6)

Generate a coverage report named `file.cpp.gcov`

gcov path/to/file.cpp

Write individual execution counts for every basic block

gcov [-a|--all-blocks] path/to/file.cpp

Write branch frequencies to the output file and print summary information to `stdout` as a percentage

gcov [-b|--branch-probabilities] path/to/file.cpp

Write branch frequencies as the number of branches taken, rather than the percentage

gcov [-c|--branch-counts] path/to/file.cpp

Do not create a `gcov` output file

gcov [-n|--no-output] path/to/file.cpp

Write file level as well as function level summaries

gcov [-f|--function-summaries] path/to/file.cpp
made by @shridhargupta | data from tldr-pages