NetBSD/gnu/usr.bin/egcs/gcov/gcov.1
1999-03-18 05:56:52 +00:00

128 lines
4.0 KiB
Groff

.\" $NetBSD: gcov.1,v 1.2 1999/03/18 05:56:52 cgd Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 13, 1999
.Dt GCOV 1
.Os
.Sh NAME
.Nm gcov
.Nd display basic block profile / coverage data
.Sh SYNOPSIS
.Nm
.Op Fl bflnv
.Op Fl o Ar dir
.Ar source.c
.Sh DESCRIPTION
The C compiler
.Xr gcc 1
supports the command line options
.Fl fprofile-arcs
and
.Fl ftest-coverage .
These options cause the compiler to insert instrumentation into the
object files it generates which measure how often each basic block is
executed; in addition, when compiling a file named (for instance)
.Pa source.c ,
in addition to generating the object file
.Pa source.o ,
the compiler also generates
.Pa source.bb
and
.Pa source.bbg ;
these files describe the control flow graph of the program.
.Pp
When executed, the program will update execution counts for each
basic block in a file
named
.Pa source.da .
This file will be created if it doesn't exist. If the program is run
multiple times, the execution counts will reflect all runs of the
program since the file was first created.
The
.Xr gcov 1
program can then be used to display the collected data in
human-readable form. When the command
.Dl gcov Pa source.c
is run, a copy of the source file with execution counts prepended to each line is
created in
.Pa source.c.gcov ,
and some summary statistics are printed to standard output.
.Pp
The following options are available:
.Bl -tag -width -o-dir
.It Fl b
Include information about branch frequencies in the output file and
on standard output.
.It Fl f
Output function-level summaries in addition to a summary for the whole
source file.
.It Fl l
Create longer unambiguous names when executable code in the object
comes from an included header file rather than the main file.
If, for example,
.Pa source.c
includes one or more header files
.Pa header.h
which include instrumented code, the report for this code will be put
in
.Pa source.c.header.h.gcov
instead of the default
.Pa header.h.gcov .
.It Fl n
Do not create output files (but still display summaries to standard
output).
.It Fl v
Display the version number of
.Xr gcov 1
.It Fl o Ar dir
Find
.Pa .bb ,
.Pa .bbg ,
and
.Pa .da
files in the directory
.Pa dir .
.El
.Sh SEE ALSO
.Xr gcc 1 ,
.Xr gprof 1
.br
The
.Sq gcc
entry in
.Xr info 1
.Sh HISTORY
.Nm
appeared in
.Nx 1.4 .