gcov code coverage

$vi hey.c
$gcc -fprofile-arcs -ftest-coverage hey.c
Hey :)
$gcov hey.c
File 'hey.c'
Lines executed:100.00% of 3
hey.c:creating 'hey.c.gcov'

$cat hey.c.gcov
-: 0:Source:hey.c
-: 0:Graph:hey.gcno
-: 0:Data:hey.gcda
-: 0:Runs:1
-: 0:Programs:1
-: 1:#include
1: 2:main()
-: 3:{
1: 4:printf(" Hey :) \n");
1: 5:}

The ".gcov" files can be examined using a normal editor. The first
column is the number of times that the line is executed. A decimal
number indicates the number of times that the line of code executes, a
'-' means that it is no code is generated for the line, and "#####"
indicates the generated code was not executed at all. To the right of
the first ':' is line number the remainder of the line is the source

Reference/Source :

%d bloggers like this: