Commit f5d39c3d by Nathan Sidwell

re PR other/20564 (gcov default behaviour changed)

	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
parent e1283056
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> 2005-03-21 Richard Sandiford <rsandifo@redhat.com>
* libgcc2.h (LIBGCC2_HAS_SF_MODE): New macro. * libgcc2.h (LIBGCC2_HAS_SF_MODE): New macro.
...@@ -240,7 +248,6 @@ ...@@ -240,7 +248,6 @@
scale_bbs_frequencies_int. scale_bbs_frequencies_int.
* tree-ssa-loop-ch.c (copy_loop_headers): Fix profiling info. * tree-ssa-loop-ch.c (copy_loop_headers): Fix profiling info.
>>>>>>> 2.7929
2005-03-18 Kazu Hirata <kazu@cs.umass.edu> 2005-03-18 Kazu Hirata <kazu@cs.umass.edu>
* config/m32r/m32r-protos.h: Remove the prototypes for * config/m32r/m32r-protos.h: Remove the prototypes for
...@@ -488,6 +495,7 @@ ...@@ -488,6 +495,7 @@
(arc_rodata_string, TARGET_OPTIONS): Delete. (arc_rodata_string, TARGET_OPTIONS): Delete.
* config/arc/arc.opt: New file. * config/arc/arc.opt: New file.
>>>>>>> 2.7930
2005-03-17 Richard Henderson <rth@redhat.com> 2005-03-17 Richard Henderson <rth@redhat.com>
* doc/extend.texi (Weak Pragmas): New section. * doc/extend.texi (Weak Pragmas): New section.
......
...@@ -207,7 +207,7 @@ option is not supplied, it defaults to the current directory. ...@@ -207,7 +207,7 @@ option is not supplied, it defaults to the current directory.
@item -u @item -u
@itemx --unconditional-branches @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. Unconditional branches are normally not interesting.
@end table @end table
...@@ -232,9 +232,27 @@ program source code. The format is ...@@ -232,9 +232,27 @@ program source code. The format is
Additional block information may succeed each line, when requested by Additional block information may succeed each line, when requested by
command line option. The @var{execution_count} is @samp{-} for lines command line option. The @var{execution_count} is @samp{-} for lines
containing no code and @samp{#####} for lines which were never containing no code and @samp{#####} for lines which were never executed.
executed. Some lines of information at the start have @var{line_number} Some lines of information at the start have @var{line_number} of zero.
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 When printing percentages, 0% and 100% are only printed when the values
are @emph{exactly} 0% and 100% respectively. Other values which would are @emph{exactly} 0% and 100% respectively. Other values which would
...@@ -278,7 +296,6 @@ Here is a sample: ...@@ -278,7 +296,6 @@ Here is a sample:
-: 1:#include <stdio.h> -: 1:#include <stdio.h>
-: 2: -: 2:
-: 3:int main (void) -: 3:int main (void)
function main called 1 returned 1 blocks executed 75%
1: 4:@{ 1: 4:@{
1: 5: int i, total; 1: 5: int i, total;
-: 6: -: 6:
...@@ -307,7 +324,6 @@ counts, and the output looks like this: ...@@ -307,7 +324,6 @@ counts, and the output looks like this:
-: 1:#include <stdio.h> -: 1:#include <stdio.h>
-: 2: -: 2:
-: 3:int main (void) -: 3:int main (void)
function main called 1 returned 1 blocks executed 75%
1: 4:@{ 1: 4:@{
1: 4-block 0 1: 4-block 0
1: 5: int i, total; 1: 5: int i, total;
...@@ -390,6 +406,10 @@ call 0 called 1 returned 100% ...@@ -390,6 +406,10 @@ call 0 called 1 returned 100%
-: 17:@} -: 17:@}
@end smallexample @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 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 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 be multiple branches and calls listed for a single source line if there
......
...@@ -1774,7 +1774,7 @@ output_lines (FILE *gcov_file, const source_t *src) ...@@ -1774,7 +1774,7 @@ output_lines (FILE *gcov_file, const source_t *src)
const line_t *line; /* current line info ptr. */ const line_t *line; /* current line info ptr. */
char string[STRING_SIZE]; /* line buffer. */ char string[STRING_SIZE]; /* line buffer. */
char const *retval = ""; /* status of source file reading. */ 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:Source:%s\n", "-", 0, src->name);
fprintf (gcov_file, "%9s:%5d:Graph:%s\n", "-", 0, bbg_file_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) ...@@ -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]; for (line_num = 1, line = &src->lines[line_num];
line_num < src->num_lines; line_num++, line++) line_num < src->num_lines; line_num++, line++)
{ {
...@@ -1810,11 +1813,11 @@ output_lines (FILE *gcov_file, const source_t *src) ...@@ -1810,11 +1813,11 @@ output_lines (FILE *gcov_file, const source_t *src)
{ {
arc_t *arc = fn->blocks[fn->num_blocks - 1].pred; arc_t *arc = fn->blocks[fn->num_blocks - 1].pred;
gcov_type return_count = fn->blocks[fn->num_blocks - 1].count; gcov_type return_count = fn->blocks[fn->num_blocks - 1].count;
for (; arc; arc = arc->pred_next) for (; arc; arc = arc->pred_next)
if (arc->fake) if (arc->fake)
return_count -= arc->count; return_count -= arc->count;
fprintf (gcov_file, "function %s", fn->name); fprintf (gcov_file, "function %s", fn->name);
fprintf (gcov_file, " called %s", fprintf (gcov_file, " called %s",
format_gcov (fn->blocks[0].count, 0, -1)); format_gcov (fn->blocks[0].count, 0, -1));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment