diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-31 15:18:24 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-31 15:18:24 +0000 |
commit | 2ff443c918d1f708d739a167488ace48c61dce75 (patch) | |
tree | 79429246167a06afe199b37908d8c7b8ada6a867 /gcc/doc/gcov.texi | |
parent | cc403f28bb913c02de306103efb99632d4bc128a (diff) | |
download | ppe42-gcc-2ff443c918d1f708d739a167488ace48c61dce75.tar.gz ppe42-gcc-2ff443c918d1f708d739a167488ace48c61dce75.zip |
* gcov.c: Add -a & -u options.
(struct arc_info): Add local_span, is_call_non_return,
is_nonlocal_return, is_unconditional flags, remove is_call flag.
(struct block_info): Add flags, is_call_site, is_nonlocal_return
members. Make encodings a union with span member.
(struct function_info): Add blocks_executed, line, src, line_next
members.
(struct coverage_info): Make branches a union with blocks member.
(struct source_info): Add functions member.
(object_summary, program_count): New global variables.
(flag_all_blocks, flag_unconditional): New flags.
(find_source, output_branch_count): New functions.
(print_usage): Adjust.
(options): Adjust.
(process_args): Adjust.
(read_graph_file) <GCOV_TAG_FUNCTION>: Adjust.
<GCOV_TAG_BLOCKS>: Read flags.
<GCOV_TAG_LINES>: Adjust.
(read_count_file): Process SUMMARY tags.
(solve_flow_graph): Set is_unconditional and clear is_call_site
appropriately.
(add_branch_counts): Adjust. Don't count unconditional branches.
(add_line_counts): Deal with all-blocks mode, accumulate block
coverage.
(accumulate_line_counts): Adjust, generate local spanning tree for
all-blocks mode.
(output_lines): Adjust.
* profile.c (branch_prob): Alter GCOV_FUNCTION_TAG record.
* doc/gcov.texi: Document.
testsuite:
* lib/gcov.exp: Adjust call return testing strings.
* g77.dg/gcov/gcov-1.f: Don't expect unconditional branches.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65090 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/gcov.texi')
-rw-r--r-- | gcc/doc/gcov.texi | 88 |
1 files changed, 76 insertions, 12 deletions
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index b7cfee2019d..c1eae2c7bdf 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -120,6 +120,7 @@ gcov @r{[}@var{options}@r{]} @var{sourcefile} @ignore @c man begin SYNOPSIS gcov [@option{-v}|@option{--version}] [@option{-h}|@option{--help}] + [@option{-a}|@option{--all-blocks}] [@option{-b}|@option{--branch-probabilities}] [@option{-c}|@option{--branch-counts}] [@option{-n}|@option{--no-output}] @@ -127,6 +128,7 @@ gcov [@option{-v}|@option{--version}] [@option{-h}|@option{--help}] [@option{-p}|@option{--preserve-paths}] [@option{-f}|@option{--function-summaries}] [@option{-o}|@option{--object-directory} @var{directory|file}] @var{sourcefile} + [@option{-u}|@option{--unconditional-branches}] @c man end @c man begin SEEALSO gpl(7), gfdl(7), fsf-funding(7), gcc(1) and the Info entry for @file{gcc}. @@ -145,11 +147,23 @@ exit without doing any further processing. Display the @command{gcov} version number (on the standard output), and exit without doing any further processing. +@item -a +@itemx --all-blocks +Write individual execution counts for every basic block. Normally gcov +outputs execution counts only for the main blocks of a line. With this +option you can determine if blocks within a single line are not being +executed. In this mode each block is shown, and contributes to the +occupancy and execution count of, the first line of source that it +contains. A multi-line block will only contribute to that first line, +and other lines will not be show to contain code, unless a subsequent +block begins on those lines. + @item -b @itemx --branch-probabilities Write branch frequencies to the output file, and write branch summary info to the standard output. This option allows you to see how often -each branch in your program was taken. +each branch in your program was taken. Unconditional branches will not +be shown, unless the @option{-u} option is given. @item -c @itemx --branch-counts @@ -192,6 +206,11 @@ source file name, without its extension. If a file is specified here, the data files are named after that file, without its extension. If this 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. +Unconditional branches are normally not interesting. + @end table Gcov should be run with the current directory the same as that when you @@ -248,26 +267,68 @@ Here is a sample: @smallexample -: 0:Source:tmp.c - -: 0:Object:tmp.bb + -: 0:Graph:tmp.bbg + -: 0:Data:tmp.da + -: 0:Runs:1 + -: 0:Programs:1 + -: 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: + 1: 7: total = 0; + -: 8: + 11: 9: for (i = 0; i < 10; i++) + 10: 10: total += i; + -: 11: + 1: 12: if (total != 45) + #####: 13: printf ("Failure\n"); + -: 14: else + 1: 15: printf ("Success\n"); + 1: 16: return 0; + -: 17:@} +@end smallexample + +When you use the @option{-a} option, you will get individual block +counts, and the output looks like this: + +@smallexample + -: 0:Source:tmp.c + -: 0:Graph:tmp.bbg + -: 0:Data:tmp.da + -: 0:Runs:1 + -: 0:Programs:1 -: 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; -: 6: 1: 7: total = 0; -: 8: 11: 9: for (i = 0; i < 10; i++) + 11: 9-block 0 10: 10: total += i; + 10: 10-block 0 -: 11: 1: 12: if (total != 45) + 1: 12-block 0 #####: 13: printf ("Failure\n"); + $$$$$: 13-block 0 -: 14: else 1: 15: printf ("Success\n"); + 1: 15-block 0 1: 16: return 0; - 1: 17:@} + 1: 16-block 0 + -: 17:@} @end smallexample +As you can see, line 13 contains a basic block that was not executed. + @need 450 When you use the @option{-b} option, your output looks like this: @@ -284,31 +345,34 @@ Here is a sample of a resulting @file{tmp.c.gcov} file: @smallexample -: 0:Source:tmp.c - -: 0:Object:tmp.bb + -: 0:Graph:tmp.bbg + -: 0:Data:tmp.da + -: 0:Runs:1 + -: 0:Programs:1 -: 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: 1: 7: total = 0; -: 8: 11: 9: for (i = 0; i < 10; i++) -branch 0: taken 90% -branch 1: taken 100% -branch 2: taken 100% +branch 0 taken 91% (fallthrough) +branch 1 taken 9% 10: 10: total += i; -: 11: 1: 12: if (total != 45) -branch 0: taken 100% +branch 0 taken 0% (fallthrough) +branch 1 taken 100% #####: 13: printf ("Failure\n"); -call 0: never executed -branch 1: never executed +call 0 never executed -: 14: else 1: 15: printf ("Success\n"); -call 0: returns 100% +call 0 called 1 returned 100% 1: 16: return 0; - 1: 17:@} + -: 17:@} @end smallexample For each basic block, a line is printed after the last line of the basic |