re PR other/20564 (gcov default behaviour changed)
authorNathan Sidwell <nathan@gcc.gnu.org>
Mon, 21 Mar 2005 12:31:10 +0000 (12:31 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Mon, 21 Mar 2005 12:31:10 +0000 (12:31 +0000)
PR other/20564
* gcov.c (output_lines): Only output function block summary when
outputting branch information.
* doc/gcov.texi: Document format of preamble and additional block
information lines.

From-SVN: r96788

gcc/ChangeLog
gcc/doc/gcov.texi
gcc/gcov.c

index 2fc3d9404b76394861f3e7c067a7367a029b13c9..2e947eaed20c20a4e450cb2244dac28b7fdc0b6b 100644 (file)
@@ -1,3 +1,11 @@
+2005-03-21  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR other/20564
+       * gcov.c (output_lines): Only output function block summary when
+       outputting branch information.
+       * doc/gcov.texi: Document format of preamble and additional block
+       information lines.
+
 2005-03-21  Richard Sandiford  <rsandifo@redhat.com>
 
        * libgcc2.h (LIBGCC2_HAS_SF_MODE): New macro.
        scale_bbs_frequencies_int.
        * tree-ssa-loop-ch.c (copy_loop_headers): Fix profiling info.
 
->>>>>>> 2.7929
 2005-03-18  Kazu Hirata  <kazu@cs.umass.edu>
 
        * config/m32r/m32r-protos.h: Remove the prototypes for
        (arc_rodata_string, TARGET_OPTIONS): Delete.
        * config/arc/arc.opt: New file.
 
+>>>>>>> 2.7930
 2005-03-17  Richard Henderson  <rth@redhat.com>
 
        * doc/extend.texi (Weak Pragmas): New section.
index 3278a4b5a97718195db05998341be9e4eb9f4af2..bfe4a3d204e26bfbdb9a54c90653dfe5dc9034a2 100644 (file)
@@ -207,7 +207,7 @@ option is not supplied, it defaults to the current directory.
 
 @item -u
 @itemx --unconditional-branches
-When branch counts are given, include those of unconditional branches.
+When branch probabilities are given, include those of unconditional branches.
 Unconditional branches are normally not interesting.
 
 @end table
@@ -232,9 +232,27 @@ program source code.  The format is
 
 Additional block information may succeed each line, when requested by
 command line option.  The @var{execution_count} is @samp{-} for lines
-containing no code and @samp{#####} for lines which were never
-executed.  Some lines of information at the start have @var{line_number}
-of zero.
+containing no code and @samp{#####} for lines which were never executed.
+Some lines of information at the start have @var{line_number} of zero.
+
+The preamble lines are of the form
+
+@smallexample
+-:0:@var{tag}:@var{value}
+@end smallexample
+
+The ordering and number of these preamble lines will be augmented as
+@command{gcov} development progresses --- do not rely on them remaining
+unchanged.  Use @var{tag} to locate a particular preamble line.
+
+The additional block information is of the form
+
+@smallexample
+@var{tag} @var{information}
+@end smallexample
+
+The @var{information} is human readable, but designed to be simple
+enough for machine parsing too.
 
 When printing percentages, 0% and 100% are only printed when the values
 are @emph{exactly} 0% and 100% respectively.  Other values which would
@@ -278,7 +296,6 @@ Here is a sample:
         -:    1:#include <stdio.h>
         -:    2:
         -:    3:int main (void)
-function main called 1 returned 1 blocks executed 75%
         1:    4:@{
         1:    5:  int i, total;
         -:    6:
@@ -307,7 +324,6 @@ counts, and the output looks like this:
         -:    1:#include <stdio.h>
         -:    2:
         -:    3:int main (void)
-function main called 1 returned 1 blocks executed 75%
         1:    4:@{
         1:    4-block  0
         1:    5:  int i, total;
@@ -390,6 +406,10 @@ call    0 called 1 returned 100%
         -:   17:@}
 @end smallexample
 
+For each function, a line is printed showing how many times the function
+is called, how many times it returns and what percentage of the
+function's blocks were executed.
+
 For each basic block, a line is printed after the last line of the basic
 block describing the branch or call that ends the basic block.  There can
 be multiple branches and calls listed for a single source line if there
index ee4d6b9aa80e338457b2a1db3a090526489580ca..6675a06b60e023928763328aeafe6abcac5e21d7 100644 (file)
@@ -1774,7 +1774,7 @@ output_lines (FILE *gcov_file, const source_t *src)
   const line_t *line;           /* current line info ptr.  */
   char string[STRING_SIZE];     /* line buffer.  */
   char const *retval = "";     /* status of source file reading.  */
-  function_t *fn = src->functions;
+  function_t *fn = NULL;
 
   fprintf (gcov_file, "%9s:%5d:Source:%s\n", "-", 0, src->name);
   fprintf (gcov_file, "%9s:%5d:Graph:%s\n", "-", 0, bbg_file_name);
@@ -1803,6 +1803,9 @@ output_lines (FILE *gcov_file, const source_t *src)
        }
     }
 
+  if (flag_branches)
+    fn = src->functions;
+
   for (line_num = 1, line = &src->lines[line_num];
        line_num < src->num_lines; line_num++, line++)
     {
@@ -1810,11 +1813,11 @@ output_lines (FILE *gcov_file, const source_t *src)
        {
          arc_t *arc = fn->blocks[fn->num_blocks - 1].pred;
          gcov_type return_count = fn->blocks[fn->num_blocks - 1].count;
-
+         
          for (; arc; arc = arc->pred_next)
            if (arc->fake)
              return_count -= arc->count;
-
+         
          fprintf (gcov_file, "function %s", fn->name);
          fprintf (gcov_file, " called %s",
                   format_gcov (fn->blocks[0].count, 0, -1));