Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>.gcda is not generated by compiler; it's generated by your program when you execute it.</p> <p>.gcno is the file generated at compilation time and it is the 'note file'. gcc generate a basic block graph notes file (.gcno) for each CU(compiler unit).</p> <blockquote> <p>So how does main.gcda is generated?</p> </blockquote> <p>At running time the statistic data is gathered and stored in memory. Some exit callback is registered and is called to write the data to the .gcda file when the program terminates. This means if you call abort() instead of exit() in your program, no .gcda file would be generated.</p> <blockquote> <p>How the instrumentation is done? Can I see the instrumented code?</p> </blockquote> <p>You way need check gcc's implementation to get the details but basically the instrumentation is done by inserting instruction to the program to count the number of times each instruction is executed. But it doesn't really have to keep a counter for each instruction; GCC uses some algorithm to generate a program flow graph and finds a spanning tree for the graph. Only some special arcs have to be instrumented and from them the coverage of all code branches can be generated. You can disassemble the binary to see the instrumented code. And here are some files for coverage if you want to look into the gcc source file:</p> <p><em><strong>toplev.c coverage.c profile.c libgcov.c gcov.c gcov-io.c</em></strong></p> <p>edit: some known gcov bugs FYI:</p> <p><a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484</a></p> <p><a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28441">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28441</a></p> <p><a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44779">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44779</a></p> <p><a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7970">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7970</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload