GCOV(1) BSD Reference Manual GCOV(1)NAMEgcov - test code coverage in programs
SYNOPSISgcov [-b] [-f] [-l] [-n] [-o directory] [-v] sourcefile
DESCRIPTION
The gcov program generates annotated program source listings that de-
scribe the number of times a given source line was executed in the course
of running the program. It can also generate statistics about branches.
The options are as follows:
-b Generate branch statistics into the output files and send a sum-
mary to the standard output.
-f Produce branch summaries for each function as well as each file.
-l Generate separate coverate listings for header files depending on
which source file included that header file. Normally gcov pro-
duces a file named header.h.gcov for a given header file
header.h; with -l, if the source file is source.c, gcov produces
source.c.header.h.gcov instead. This is helpful if more than one
source file in the current directory includes the same header.
-n Suppresses creation of the annotated listing files.
-o directory
Check for statistics files in the given directory.
-v Print gcov 's version number to standard error.
To use gcov, you should build your program with the gcc(1) flags
-fprofile-arcs and -ftest-coverage. These flags cause statistics files
with the suffixes .bb, .bbg and .da to appear when you run the program.
You should also disable optimization, so that executable code for each
source code line will (generally) be contiguous.
Gcov reads the statistics files and the source code, and it generates an-
notated listing files with the suffix .gcov. Each executable source line
is annotated with the number of times it was executed, or with `######'
if it was never executed at all.
SEE ALSOgcc(1), gprof(1)
For more complete documentation, you can view the gcov manual using
``info gcov''.
AUTHORS
Gcov was written by James E. Wilson and Bob Manson of Cygnus Support.
Gcov is distributed by the GNU Project of the Free Software Foundation.
April 28, 1999 1