Brief Description Of; Gcov With Gcc Optimization; Gcov Data Files - Red Hat ENTERPRISE LINUX 3 - USING GCC Using Instructions

Using the gnu compiler collection (gcc)
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING GCC:
Table of Contents

Advertisement

236
doesn't match the executable (differing number of basic block counts) it will ignore the contents of
the file. It then adds in the new execution counts and finally writes the data to the file.
10.3. Using
gcov
If you plan to use
gcov
special GCC options:
GCC options; but if you want to prove that every single line in your program was executed, you should
not compile with optimization at the same time. On some machines the optimizer can eliminate some
simple code lines by combining them with other lines. For example, code like this:
if (a != b)
c = 1;
else
c = 0;
can be compiled into one instruction on some machines. In this case, there is no way for
calculate separate execution counts for each line because there isn't separate code for each line. Hence
the
output looks like this if you compiled the program with optimization:
gcov
100:
12:if (a != b)
100:
13:
100:
14:else
100:
15:
The output shows that this block of code, combined by optimization, executed 100 times. In one
sense this result is correct, because there was only one instruction representing all four of these lines.
However, the output does not indicate how many times the result was 0 and how many times the result
was 1.

10.4. Brief description of

uses two files for profiling. The names of these files are derived from the original object file by
gcov
substituting the file suffix with either
as the object file, and contain data stored in a platform-independent format.
The
files is generated when the source file is compiled with the GCC
.bbg
tion. It contains information to reconstruct the basic block graphs and assign source line numbers to
blocks.
The
file is generated when a program containing object files built with the GCC
.da
option is executed. A separate
-fprofile-arcs
with this option. It contains arc transition counts, and some summary information.
The full details of the file format is specified in
should be used to access the coverage files.
with GCC Optimization
to help optimize your code, you must first compile your program with two
-fprofile-arcs -ftest-coverage
c = 1;
c = 0;
gcov
.bbg
Chapter 10.
. Aside from that, you can use any other
data files
, or
. All of these files are placed in the same directory
.da
file is created for each object file compiled
.da
, and functions provided in that header file
gcov-io.h
gcov
--a Test Coverage Program
-ftest-coverage
to
gcov
op-

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents