1997-03-28 23:43:13 +01:00
|
|
|
|
/* Gcov.c: prepend line execution counts and branch probabilities to a
|
|
|
|
|
source file.
|
2000-02-26 07:23:30 +01:00
|
|
|
|
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
|
2003-07-06 20:59:38 +02:00
|
|
|
|
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
1997-03-28 23:43:13 +01:00
|
|
|
|
Contributed by James E. Wilson of Cygnus Support.
|
1997-12-20 12:31:54 +01:00
|
|
|
|
Mangled by Bob Manson of Cygnus Support.
|
2002-12-16 19:23:00 +01:00
|
|
|
|
Mangled further by Nathan Sidwell <nathan@codesourcery.com>
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
Gcov is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
Gcov is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with Gcov; see the file COPYING. If not, write to
|
1999-01-11 14:34:38 +01:00
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
/* ??? Print a list of the ten blocks with the highest execution counts,
|
|
|
|
|
and list the line numbers corresponding to those blocks. Also, perhaps
|
|
|
|
|
list the line numbers with the highest execution counts, only printing
|
|
|
|
|
the first if there are several which are all listed in the same block. */
|
|
|
|
|
|
|
|
|
|
/* ??? Should have an option to print the number of basic blocks, and the
|
|
|
|
|
percent of them that are covered. */
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* ??? Does not correctly handle the case where two .bb files refer to
|
|
|
|
|
the same included source file. For example, if one has a short
|
|
|
|
|
file containing only inline functions, which is then included in
|
|
|
|
|
two other files, then there will be two .bb files which refer to
|
|
|
|
|
the include file, but there is no way to get the total execution
|
|
|
|
|
counts for the included file, can only get execution counts for one
|
|
|
|
|
or the other of the including files. this can be fixed by --ratios
|
|
|
|
|
--long-file-names --preserve-paths and perl. */
|
|
|
|
|
|
|
|
|
|
/* Need an option to show individual block counts, and show
|
|
|
|
|
probabilities of fall through arcs. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
1997-12-20 12:31:54 +01:00
|
|
|
|
#include "config.h"
|
More cutover to system.h:
* Makefile.in (cppalloc.o, cpperror.o, cppexp.o, cpphash.o,
cpplib.o, cppmain.o, fix-header.o, gcov.o, gen-protos.o,
gengenrtl.o, halfpic.o, hash.o, scan-decls.o, scan.o): Depend on
system.h.
* cpphash.c: Include config.h.
* cppalloc.c: Include system.h. Add parameters to various
function prototypes.
* cpperror.c: Likewise.
* cppexp.c: Likewise.
* cpphash.c: Likewise.
* cpplib.c: Likewise.
* cppmain.c: Likewise.
* fix-header.c: Likewise.
* gcov.c: Likewise.
* gen-protos.c: Likewise.
* gengenrtl.c: Likewise.
* halfpic.c: Likewise.
* hash.c: Likewise.
* scan-decls.c: Likewise.
* scan.c: Likewise.
From-SVN: r18911
1998-03-30 14:05:54 +02:00
|
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "coretypes.h"
|
|
|
|
|
#include "tm.h"
|
1999-01-27 02:43:17 +01:00
|
|
|
|
#include "intl.h"
|
2001-11-01 22:48:49 +01:00
|
|
|
|
#include "version.h"
|
system.h: Always prototype abort.
1999-04-16 22:44 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* system.h: Always prototype abort. Prototype fatal. Define
abort to call fatal, not fprintf/exit. Define a stub macro
for trim_filename.
* toplev.c: Define DIR_SEPARATOR. (trim_filename): New
function.
* toplev.h: Prototype trim_filename, and #undef system.h's stub.
* gcc.c, genattr.c, genattrtab.c, gencodes.c, genconfig.c,
genemit.c, genextract.c, genflags.c, genopinit.c, genoutput.c,
genpeep.c, genrecog.c: Make fatal non-static.
* gcov.c, gengenrtl.c, protoize.c: #undef abort after
including system.h.
* config/i386/dgux.h, config/m68k/xm-amix.h: Remove stale code
relating to abort.
From-SVN: r26511
1999-04-16 21:52:44 +02:00
|
|
|
|
#undef abort
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2001-11-01 22:48:49 +01:00
|
|
|
|
#include <getopt.h>
|
|
|
|
|
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
#define IN_GCOV 1
|
1997-03-28 23:43:13 +01:00
|
|
|
|
#include "gcov-io.h"
|
2003-04-21 23:23:43 +02:00
|
|
|
|
#include "gcov-io.c"
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* The bbg file is generated by -ftest-coverage option. The da file is
|
|
|
|
|
generated by a program compiled with -fprofile-arcs. Their formats
|
|
|
|
|
are documented in gcov-io.h. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
/* The functions in this file for creating and solution program flow graphs
|
2002-12-16 19:23:00 +01:00
|
|
|
|
are very similar to functions in the gcc source file profile.c. In
|
|
|
|
|
some places we make use of the knowledge of how profile.c works to
|
|
|
|
|
select particular algorithms here. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
/* This is the size of the buffer used to read in source file lines. */
|
|
|
|
|
|
|
|
|
|
#define STRING_SIZE 200
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
struct function_info;
|
|
|
|
|
struct block_info;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
struct source_info;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Describes an arc between two basic blocks. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
typedef struct arc_info
|
|
|
|
|
{
|
2003-01-18 23:32:06 +01:00
|
|
|
|
/* source and destination blocks. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
struct block_info *src;
|
|
|
|
|
struct block_info *dst;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* transition counts. */
|
|
|
|
|
gcov_type count;
|
2003-08-27 23:13:17 +02:00
|
|
|
|
/* used in cycle search, so that we do not clobber original counts. */
|
|
|
|
|
gcov_type cs_count;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
unsigned int count_valid : 1;
|
|
|
|
|
unsigned int on_tree : 1;
|
|
|
|
|
unsigned int fake : 1;
|
|
|
|
|
unsigned int fall_through : 1;
|
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
/* Arc is for a function that abnormally returns. */
|
|
|
|
|
unsigned int is_call_non_return : 1;
|
|
|
|
|
|
|
|
|
|
/* Arc is for catch/setjump. */
|
|
|
|
|
unsigned int is_nonlocal_return : 1;
|
|
|
|
|
|
|
|
|
|
/* Is an unconditional branch. */
|
|
|
|
|
unsigned int is_unconditional : 1;
|
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Loop making arc. */
|
|
|
|
|
unsigned int cycle : 1;
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Next branch on line. */
|
|
|
|
|
struct arc_info *line_next;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Links to next arc on src and dst lists. */
|
|
|
|
|
struct arc_info *succ_next;
|
|
|
|
|
struct arc_info *pred_next;
|
|
|
|
|
} arc_t;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Describes a basic block. Contains lists of arcs to successor and
|
|
|
|
|
predecessor blocks. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
typedef struct block_info
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Chain of exit and entry arcs. */
|
|
|
|
|
arc_t *succ;
|
|
|
|
|
arc_t *pred;
|
|
|
|
|
|
2003-01-18 23:32:06 +01:00
|
|
|
|
/* Number of unprocessed exit and entry arcs. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
gcov_type num_succ;
|
|
|
|
|
gcov_type num_pred;
|
|
|
|
|
|
2003-01-18 23:32:06 +01:00
|
|
|
|
/* Block execution count. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
gcov_type count;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
unsigned flags : 13;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned count_valid : 1;
|
|
|
|
|
unsigned valid_chain : 1;
|
|
|
|
|
unsigned invalid_chain : 1;
|
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
/* Block is a call instrumenting site. */
|
2003-04-06 15:18:41 +02:00
|
|
|
|
unsigned is_call_site : 1; /* Does the call. */
|
|
|
|
|
unsigned is_call_return : 1; /* Is the return. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
/* Block is a landing pad for longjmp or throw. */
|
|
|
|
|
unsigned is_nonlocal_return : 1;
|
|
|
|
|
|
|
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
/* Array of line numbers and source files. source files are
|
|
|
|
|
introduced by a linenumber of zero, the next 'line number' is
|
|
|
|
|
the number of the source file. Always starts with a source
|
|
|
|
|
file. */
|
|
|
|
|
unsigned *encoding;
|
|
|
|
|
unsigned num;
|
|
|
|
|
} line; /* Valid until blocks are linked onto lines */
|
|
|
|
|
struct
|
|
|
|
|
{
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Single line graph cycle workspace. Used for all-blocks
|
2003-06-23 17:27:37 +02:00
|
|
|
|
mode. */
|
2003-04-06 15:18:41 +02:00
|
|
|
|
arc_t *arc;
|
|
|
|
|
unsigned ident;
|
|
|
|
|
} cycle; /* Used in all-blocks mode, after blocks are linked onto
|
2003-06-23 17:27:37 +02:00
|
|
|
|
lines. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
} u;
|
|
|
|
|
|
|
|
|
|
/* Temporary chain for solving graph, and for chaining blocks on one
|
|
|
|
|
line. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
struct block_info *chain;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
} block_t;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Describes a single function. Contains an array of basic blocks. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
typedef struct function_info
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Name of function. */
|
|
|
|
|
char *name;
|
2003-04-24 11:46:17 +02:00
|
|
|
|
unsigned ident;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned checksum;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Array of basic blocks. */
|
|
|
|
|
block_t *blocks;
|
|
|
|
|
unsigned num_blocks;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
unsigned blocks_executed;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
|
|
|
|
/* Raw arc coverage counts. */
|
|
|
|
|
gcov_type *counts;
|
|
|
|
|
unsigned num_counts;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
|
|
|
|
|
/* First line number. */
|
|
|
|
|
unsigned line;
|
|
|
|
|
struct source_info *src;
|
|
|
|
|
|
|
|
|
|
/* Next function in same source file. */
|
|
|
|
|
struct function_info *line_next;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Next function. */
|
|
|
|
|
struct function_info *next;
|
|
|
|
|
} function_t;
|
|
|
|
|
|
|
|
|
|
/* Describes coverage of a file or function. */
|
|
|
|
|
|
|
|
|
|
typedef struct coverage_info
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
|
|
|
|
int lines;
|
|
|
|
|
int lines_executed;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
int branches;
|
|
|
|
|
int branches_executed;
|
|
|
|
|
int branches_taken;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
int calls;
|
|
|
|
|
int calls_executed;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
char *name;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
} coverage_t;
|
2002-08-07 01:18:01 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Describes a single line of source. Contains a chain of basic blocks
|
|
|
|
|
with code on it. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
typedef struct line_info
|
|
|
|
|
{
|
|
|
|
|
gcov_type count; /* execution count */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
union
|
|
|
|
|
{
|
2003-07-06 20:59:38 +02:00
|
|
|
|
arc_t *branches; /* branches from blocks that end on this
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
line. Used for branch-counts when not
|
2003-06-23 17:27:37 +02:00
|
|
|
|
all-blocks mode. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
block_t *blocks; /* blocks which start on this line. Used
|
2003-06-23 17:27:37 +02:00
|
|
|
|
in all-blocks mode. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
} u;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned exists : 1;
|
|
|
|
|
} line_t;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Describes a file mentioned in the block graph. Contains an array
|
|
|
|
|
of line info. */
|
2002-08-04 19:06:10 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
typedef struct source_info
|
|
|
|
|
{
|
|
|
|
|
/* Name of source file. */
|
|
|
|
|
char *name;
|
|
|
|
|
unsigned index;
|
2002-08-04 19:06:10 +02:00
|
|
|
|
|
2003-01-18 23:32:06 +01:00
|
|
|
|
/* Array of line information. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
line_t *lines;
|
|
|
|
|
unsigned num_lines;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
coverage_t coverage;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
|
|
|
|
|
/* Functions in this source file. These are in ascending line
|
|
|
|
|
number order. */
|
|
|
|
|
function_t *functions;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Next source file. */
|
|
|
|
|
struct source_info *next;
|
|
|
|
|
} source_t;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Holds a list of function basic block graphs. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static function_t *functions;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* This points to the head of the sourcefile structure list. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static source_t *sources;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
/* This holds data summary information. */
|
|
|
|
|
|
|
|
|
|
static struct gcov_summary object_summary;
|
|
|
|
|
static unsigned program_count;
|
|
|
|
|
|
2003-01-18 23:32:06 +01:00
|
|
|
|
/* Modification time of graph file. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static time_t bbg_file_time;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Name and file pointer of the input file for the basic block graph. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static char *bbg_file_name;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2003-07-06 16:51:48 +02:00
|
|
|
|
/* Stamp of the bbg file */
|
|
|
|
|
static unsigned bbg_stamp;
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Name and file pointer of the input file for the arc count data. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static char *da_file_name;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Output branch probabilities. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int flag_branches = 0;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2003-07-06 20:59:38 +02:00
|
|
|
|
/* Show unconditional branches too. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
static int flag_unconditional = 0;
|
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
/* Output a gcov file if this is true. This is on by default, and can
|
|
|
|
|
be turned off by the -n option. */
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int flag_gcov_file = 1;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* For included files, make the gcov output file name include the name
|
|
|
|
|
of the input source file. For example, if x.h is included in a.c,
|
|
|
|
|
then the output file name is a.c##x.h.gcov instead of x.h.gcov. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int flag_long_names = 0;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
/* Output count information for every basic block, not merely those
|
|
|
|
|
that contain line number information. */
|
|
|
|
|
|
|
|
|
|
static int flag_all_blocks = 0;
|
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
/* Output summary info for each function. */
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int flag_function_summary = 0;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Object directory file prefix. This is the directory/file where the
|
|
|
|
|
graph and data files are looked for, if nonzero. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
static char *object_directory = 0;
|
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
/* Preserve all pathname components. Needed when object files and
|
2002-12-16 19:23:00 +01:00
|
|
|
|
source files are in subdirectories. '/' is mangled as '#', '.' is
|
|
|
|
|
elided and '..' mangled to '^'. */
|
|
|
|
|
|
|
|
|
|
static int flag_preserve_paths = 0;
|
2002-08-04 19:06:10 +02:00
|
|
|
|
|
1999-11-10 18:17:15 +01:00
|
|
|
|
/* Output the number of times a branch was taken as opposed to the percentage
|
2003-01-18 23:32:06 +01:00
|
|
|
|
of times it was taken. */
|
2001-07-16 11:16:04 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int flag_counts = 0;
|
1999-11-10 18:17:15 +01:00
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
/* Forward declarations. */
|
2003-07-06 20:59:38 +02:00
|
|
|
|
static void fnotice (FILE *, const char *, ...) ATTRIBUTE_PRINTF_2;
|
|
|
|
|
static int process_args (int, char **);
|
|
|
|
|
static void print_usage (int) ATTRIBUTE_NORETURN;
|
|
|
|
|
static void print_version (void) ATTRIBUTE_NORETURN;
|
|
|
|
|
static void process_file (const char *);
|
|
|
|
|
static void create_file_names (const char *);
|
|
|
|
|
static source_t *find_source (const char *);
|
|
|
|
|
static int read_graph_file (void);
|
|
|
|
|
static int read_count_file (void);
|
|
|
|
|
static void solve_flow_graph (function_t *);
|
|
|
|
|
static void add_branch_counts (coverage_t *, const arc_t *);
|
|
|
|
|
static void add_line_counts (coverage_t *, function_t *);
|
|
|
|
|
static void function_summary (const coverage_t *, const char *);
|
|
|
|
|
static const char *format_gcov (gcov_type, gcov_type, int);
|
|
|
|
|
static void accumulate_line_counts (source_t *);
|
|
|
|
|
static int output_branch_count (FILE *, int, const arc_t *);
|
|
|
|
|
static void output_lines (FILE *, const source_t *);
|
|
|
|
|
static char *make_gcov_file_name (const char *, const char *);
|
|
|
|
|
static void release_structures (void);
|
|
|
|
|
extern int main (int, char **);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
int
|
2003-07-06 20:59:38 +02:00
|
|
|
|
main (int argc, char **argv)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
int argno;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2001-10-19 17:17:39 +02:00
|
|
|
|
gcc_init_libintl ();
|
1999-01-27 02:43:17 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
argno = process_args (argc, argv);
|
|
|
|
|
if (optind == argc)
|
|
|
|
|
print_usage (true);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (; argno != argc; argno++)
|
|
|
|
|
{
|
|
|
|
|
release_structures ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
process_file (argv[argno]);
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-01-27 02:43:17 +01:00
|
|
|
|
static void
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
|
fnotice (FILE *file, const char *msgid, ...)
|
1999-01-27 02:43:17 +01:00
|
|
|
|
{
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
|
va_list ap;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
|
va_start (ap, msgid);
|
1999-01-30 21:18:51 +01:00
|
|
|
|
vfprintf (file, _(msgid), ap);
|
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg.
gcc:
* builtins.c (validate_arglist): Eliminate libiberty VA_ macros,
always use stdarg.
* c-errors.c (pedwarn_c99): Likewise.
* c-format.c (status_warning): Likewise.
* c-semantics.c (build_stmt): Likewise.
* calls.c (emit_library_call, emit_library_call_value): Likewise.
* collect2.c (notice, fatal_perror, fatal, error): Likewise.
* cpperror.c (cpp_error, cpp_error_with_line): Likewise.
* diagnostic.c (build_message_string, output_printf,
output_verbatim, verbatim, inform, warning, pedwarn, error, sorry,
fatal_error, internal_error, warning_with_decl, pedwarn_with_decl,
error_with_decl, fnotice): Likewise.
* dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta,
dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr,
dw2_asm_output_addr_rtx, dw2_asm_output_nstring,
dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128,
dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128,
dw2_asm_output_encoded_addr_rtx): Likewise.
* emit-rtl.c (gen_rtx, gen_rtvec): Likewise.
* errors.c (warning, error, fatal, internal_error): Likewise.
* final.c (output_operand_lossage, asm_fprintf): Likewise.
* fix-header.c (fatal): Likewise.
* gcc.c (fatal, error, notice): Likewise.
* gcov.c (fnotice): Likewise.
* genattrtab.c (attr_rtx, attr_printf): Likewise.
* gengtype.c (error_at_line, xasprintf, oprintf): Likewise.
* gensupport.c (message_with_line): Likewise.
* mips-tfile.c (fatal, error): Likewise.
* protoize.c (notice): Likewise.
* ra-debug.c (ra_debug_msg): Likewise.
* read-rtl.c (fatal_with_file_and_line): Likewise.
* rtl-error.c (error_for_asm, warning_for_asm): Likewise.
* tree.c (build, build_nt, build_function_type_list): Likewise.
cp:
* error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate
libiberty VA_ macros, always use stdarg.
* rtti.c (create_pseudo_type_info): Likewise.
* tree.c (build_min_nt, build_min): Likewise.
From-SVN: r66919
2003-05-18 00:21:35 +02:00
|
|
|
|
va_end (ap);
|
1999-01-27 02:43:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
/* More 'friendly' abort that prints the line and file.
|
|
|
|
|
config.h can #define abort fancy_abort if you like that sort of thing. */
|
2003-07-06 20:59:38 +02:00
|
|
|
|
extern void fancy_abort (void) ATTRIBUTE_NORETURN;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
fancy_abort (void)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
[multiple changes]
Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR>
* gcov.c (DIR_SEPARATOR): Provide default.
(output_data): Add test for MS-DOS format absolute filename.
(fancy_abort): Correct program name.
(open_files): Open all files in binary mode.
* libgcc2.c (__bb_exit_func): Likewise.
* profile.c (init_branch_prob): Specify binary when opening files.
* flags.h (flag_unwind_tables): New decl.
* toplev.c (flag_unwind_table): New definition.
(f_options): Add -funwind-tables.
(decode_g_option): Clarify warning when unknown -g option is given.
(rest_of_compilation): If inside an inlined external function,
pretend we are just being declared.
* dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables.
(dwarf2out_frame_finish): Likewise.
Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com>
* flow.c (propagate_block): When the last reference to a label
before an ADDR_VEC is deleted because the reference is a dead
store, delete the ADDR_VEC.
Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt>
* fold-const.c (merge_ranges): In not in0, but in1, handle
upper bounds equal like subset case.
Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com>
* dbxout.c (dbxout_parms): Generate a second stabs line for parameters
passed in a register but moved to the stack.
Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr>
* gcc.c (pass_exit_codes, greatest_status): New variables.
(struct option_map): Add entry for "--pass-exit-codes".
(execute): Update greatest_status if error.
(display_help): Add documentation for -pass-exit-codes.
(process_command): Handle -pass-exit-codes.
(main): Look at pass_exit_codes and greatest_status on call to exit.
Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* reload.c (find_reloads): Refine test for no input reload
case to not includes reloads emitted after insn.
* function.c (find_temp_slots_from_address): Handle sum involving
a register that points to a temp slot.
(update_temp_slot_address): Make recursive call if both old and
new are PLUS with a common operand.
* calls.c (expand_call): Mark temp slot for result as having
address taken.
* rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case.
* gcc.c (process_command): Add standard_exec_prefix with "GCC"
component as well as "BINUTILS".
* integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS.
* integrate.c (copy_rtx_and_substitute): Likewise.
(expand_inline_function, integrate_parm_decls, integrate_decl_tree):
All callers changed.
* unroll.c (inital_reg_note_copy, copy_loop_body): Likewise.
* dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use
gdb extensions, write size of type; also be more consistent
in using references when this is a subtype.
* pa.md (extv, extzv, insv): Use define_expand to reject constant
that is out of range.
* loop.c (unknown_constant_address_altered): New variable.
(prescan_loop): Initialize it.
(note_addr_stored): Set it for RTX_UNCHANGING_P MEM.
(invariant_p, case MEM): Remove handling for volatile and readony;
check new variable if readonly.
(check_dbra_loop): Chdeck unknown_constant_address_altered.
* cse.c (canon_hash, case MEM): Do not record if BLKmode.
(addr_affects_sp_p): Removed from note_mem_written and only
define #ifdef AUTO_INC_DEC.
* alpha.c (input_operand, case ADDRESSOF): Treat as REG.
* regclass.c (record_reg_classes): Properly handle register move
directions.
* varasm.c (initializer_constant_valid_p, case MINUS_EXPR):
Don't think valid if both operands are invalid.
(struct constant_descriptor): New field RTL.
(mark_const_hash_entry): Mark it.
(record_constant{,_rtx}): Initialize it.
(output_constant_def): Allocate RTL in permanent obstack and
save in table.
({record,compare}_constant_1): Modes must match for
CONSTRUCTOR of ARRAY_TYPE.
* c-common.h (initializer_constant_valid_p): Delete decl from here.
* output.h (initializer_constant_valid_p): Move decl to here.
* c-common.c (initializer_constant_valid_p): Delete function from here.
* varasm.c (initializer_constant_valid_p): Move function to here.
* tree.h (STRIP_SIGN_NOPS): New macro.
* fold-const.c (optimize_minmax_comparison): New function.
(invert_truthvalue, case WITH_RECORD_EXPR): New case.
(fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS.
(fold, case EQ_EXPR): Call optimize_minmax_comparison and add
cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and
widening conversions.
(fold, case LE_EXPR): Rework changing unsigned to signed comparisons
to look at size of mode, not precision of type; also add missing cases.
(optimize_bit_field_compare, decode_field_reference): Don't try to
optimize COMPONENT_REF of a PLACEHOLDER_EXPR.
* dwarf2out.c (ctype.h): Include.
(dwarf2out_set_demangle_name_func): New function.
(size_of_line_info): Deleted.
(output_line_info): Compute size of line info table from difference
of labels.
(base_type_die, add_name_attribute): Call demangle function, if any.
(field_byte_offset): Use bits per word for variable length fields.
(gen_array_type_die): Add array name.
(gen_subprogram_die): Ignore DECL_INLINE if -fno-inline.
(dwarf2out_add_library_unit_info): New function.
* explow.c (set_stack_check_libfunc): New function.
(stack_check_libfunc): New static variable.
(probe_stack_range): Allow front-end to set up a libfunc to call.
* combine.c (simplify_comparison): When making comparison in wider
mode, check for having commuted an AND and a SUBREG.
(contains_muldiv): New function.
(try_combine): Call it when dividing a PARALLEL.
(simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart.
(simplify_comparison, case ASHIFTRT): Recognize sign-extension of
a PLUS.
(record_value_for_reg): If TEM is a binary operation with two CLOBBERs,
use one of the CLOBBERs instead.
(if_then_else_cond): If comparing against zero, just return thing
being compared.
* optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x).
Don't generate shifts and subtract if have conditional arithmetic.
* rtl.h (delete_barrier): New declaration.
* jump.c (jump_optimize): Set up to handle conditional call.
In conditional arithmetic case, handle CALL_INSN followed by a BARRIER.
(delete_barrier): New function.
* rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode.
* recog.c (nonmemory_operand): Accept ADDRESSOF.
* tree.c (build_type_attribute_variant): Push to obstack of
ttype around type_hash_canon call.
* expr.c (placeholder_list): Move decl to file scope.
(expand_expr): Don't force access to volatile just because its
address is taken.
If ignoring reference operations, just expand the operands.
(expand_expr, case COMPONENT_REF): Propagate
EXPAND_CONST_ADDRESS to recursive call when expanding inner.
Refine test for using bitfield operations vs pointer punning.
(expand_expr, case CONVERT_EXPR): If converting to
BLKmode UNION_TYPE from BLKmode, just return inner object.
Use proper mode in store_field call.
Properly set sizes of object to store and total size in store_field
call for convert to union.
(expand_expr, case ARRAY_REF): If OP0 is in a register, put it in
memory (like for ADDR_EXPR). Also, don't put constant in register if
we'll want it in memory.
(readonly_fields_p): New function.
(expand_expr, case INDIRECT_REF): Call it if LHS.
(expand_assignment): Handle a RESULT_DECL where
DECL_RTL is a PARALLEL.
(do_jump, case WITH_RECORD_EXPR): New case.
(get_inner_reference): Always go inside a CONVERT_EXPR
and NOP_EXPR if both modes are the same.
(store_field): Use bitfield operations if size of bitsize is not same
as size of RHS's type.
Check for bitpos not a multiple of alignment in BLKmode case.
Do block move in largest possible alignment.
(store_constructor): Set BITSIZE to -1 for variable size and properly
in case of array of BLKmode.
(expand_expr_unaligned): New function.
(do_compare_and_jump): Call it.
* mips/iris5.h (SWITCHES_NEED_SPACES): New macro.
* collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES
does not include 'o'.
* function.c (instantiate_virtual_regs_1, case SET): Handle case where
both SET_DEST and SET_SRC reference a virtual register.
(gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG.
* integrate.c (expand_inline_function): Handle case of setting
virtual stack vars register (from built in setjmp); when parameter
lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early.
(subst_constant): Add new parm, MEMONLY.
(expand_inline_function, integrate_parm_decls): Pass new parm.
(integrate_decl_tree): Likewise.
(copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P.
(try_constants): Call subst_constants twice, with MEMONLY 0 and 1.
(copy_rtx_and_substitute, case SET): Add explicit calls to
copy_rtx_and_substitute for both sides.
* stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for
constraints.
(pushcase{,_range}): Convert to NOMINAL_TYPE after checking for
within INDEX_TYPE, instead of before.
(fixup_gotos): Use f->target_rtl, not the next insn,
since latter may be from a later fixup.
(expand_value_return): Correctly convert VAL when promoting function
return; support RETURN_REG being a PARALLEL.
(expand_return): When checking for result in regs and having
cleanup, consider PARALLEL in DECL_RTL as being in regs.
From-SVN: r30299
1999-11-01 02:11:22 +01:00
|
|
|
|
fnotice (stderr, "Internal gcov abort.\n");
|
1997-03-28 23:43:13 +01:00
|
|
|
|
exit (FATAL_EXIT_CODE);
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-01 22:48:49 +01:00
|
|
|
|
/* Print a usage message and exit. If ERROR_P is nonzero, this is an error,
|
|
|
|
|
otherwise the output of --help. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
print_usage (int error_p)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2001-11-01 22:48:49 +01:00
|
|
|
|
FILE *file = error_p ? stderr : stdout;
|
|
|
|
|
int status = error_p ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2001-11-01 22:48:49 +01:00
|
|
|
|
fnotice (file, "Usage: gcov [OPTION]... SOURCEFILE\n\n");
|
|
|
|
|
fnotice (file, "Print code coverage information.\n\n");
|
|
|
|
|
fnotice (file, " -h, --help Print this help, then exit\n");
|
|
|
|
|
fnotice (file, " -v, --version Print version number, then exit\n");
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fnotice (file, " -a, --all-blocks Show information for every basic block\n");
|
2001-11-01 22:48:49 +01:00
|
|
|
|
fnotice (file, " -b, --branch-probabilities Include branch probabilities in output\n");
|
|
|
|
|
fnotice (file, " -c, --branch-counts Given counts of branches taken\n\
|
|
|
|
|
rather than percentages\n");
|
|
|
|
|
fnotice (file, " -n, --no-output Do not create an output file\n");
|
|
|
|
|
fnotice (file, " -l, --long-file-names Use long output file names for included\n\
|
|
|
|
|
source files\n");
|
|
|
|
|
fnotice (file, " -f, --function-summaries Output summaries for each function\n");
|
2002-08-04 19:06:10 +02:00
|
|
|
|
fnotice (file, " -o, --object-directory DIR|FILE Search for object files in DIR or called FILE\n");
|
|
|
|
|
fnotice (file, " -p, --preserve-paths Preserve all pathname components\n");
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fnotice (file, " -u, --unconditional-branches Show unconditional branch counts too\n");
|
2001-11-01 22:48:49 +01:00
|
|
|
|
fnotice (file, "\nFor bug reporting instructions, please see:\n%s.\n",
|
2002-10-08 21:45:17 +02:00
|
|
|
|
bug_report_url);
|
2001-11-01 22:48:49 +01:00
|
|
|
|
exit (status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print version information and exit. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
print_version (void)
|
2001-11-01 22:48:49 +01:00
|
|
|
|
{
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
fnotice (stdout, "gcov (GCC) %s\n", version_string);
|
|
|
|
|
fnotice (stdout, "Copyright (C) 2003 Free Software Foundation, Inc.\n");
|
2001-11-01 22:48:49 +01:00
|
|
|
|
fnotice (stdout,
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
"This is free software; see the source for copying conditions.\n"
|
|
|
|
|
"There is NO warranty; not even for MERCHANTABILITY or \n"
|
|
|
|
|
"FITNESS FOR A PARTICULAR PURPOSE.\n\n");
|
2001-11-01 22:48:49 +01:00
|
|
|
|
exit (SUCCESS_EXIT_CODE);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-11-01 22:48:49 +01:00
|
|
|
|
static const struct option options[] =
|
|
|
|
|
{
|
|
|
|
|
{ "help", no_argument, NULL, 'h' },
|
|
|
|
|
{ "version", no_argument, NULL, 'v' },
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{ "all-blocks", no_argument, NULL, 'a' },
|
2001-11-01 22:48:49 +01:00
|
|
|
|
{ "branch-probabilities", no_argument, NULL, 'b' },
|
|
|
|
|
{ "branch-counts", no_argument, NULL, 'c' },
|
|
|
|
|
{ "no-output", no_argument, NULL, 'n' },
|
|
|
|
|
{ "long-file-names", no_argument, NULL, 'l' },
|
|
|
|
|
{ "function-summaries", no_argument, NULL, 'f' },
|
2002-08-04 19:06:10 +02:00
|
|
|
|
{ "preserve-paths", no_argument, NULL, 'p' },
|
|
|
|
|
{ "object-directory", required_argument, NULL, 'o' },
|
|
|
|
|
{ "object-file", required_argument, NULL, 'o' },
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{ "unconditional-branches", no_argument, NULL, 'u' },
|
2003-05-29 23:33:35 +02:00
|
|
|
|
{ 0, 0, 0, 0 }
|
2001-11-01 22:48:49 +01:00
|
|
|
|
};
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Process args, return index to first non-arg. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int
|
2003-07-06 20:59:38 +02:00
|
|
|
|
process_args (int argc, char **argv)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2001-11-01 22:48:49 +01:00
|
|
|
|
int opt;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
while ((opt = getopt_long (argc, argv, "abcfhlno:puv", options, NULL)) != -1)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2001-11-01 22:48:49 +01:00
|
|
|
|
switch (opt)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
case 'a':
|
|
|
|
|
flag_all_blocks = 1;
|
|
|
|
|
break;
|
2001-11-01 22:48:49 +01:00
|
|
|
|
case 'b':
|
2002-12-16 19:23:00 +01:00
|
|
|
|
flag_branches = 1;
|
2001-11-01 22:48:49 +01:00
|
|
|
|
break;
|
|
|
|
|
case 'c':
|
2002-12-16 19:23:00 +01:00
|
|
|
|
flag_counts = 1;
|
2001-11-01 22:48:49 +01:00
|
|
|
|
break;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
case 'f':
|
|
|
|
|
flag_function_summary = 1;
|
2001-11-01 22:48:49 +01:00
|
|
|
|
break;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
case 'h':
|
|
|
|
|
print_usage (false);
|
|
|
|
|
/* print_usage will exit. */
|
2001-11-01 22:48:49 +01:00
|
|
|
|
case 'l':
|
2002-12-16 19:23:00 +01:00
|
|
|
|
flag_long_names = 1;
|
2001-11-01 22:48:49 +01:00
|
|
|
|
break;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
case 'n':
|
|
|
|
|
flag_gcov_file = 0;
|
2001-11-01 22:48:49 +01:00
|
|
|
|
break;
|
|
|
|
|
case 'o':
|
|
|
|
|
object_directory = optarg;
|
|
|
|
|
break;
|
2002-08-04 19:06:10 +02:00
|
|
|
|
case 'p':
|
2002-12-16 19:23:00 +01:00
|
|
|
|
flag_preserve_paths = 1;
|
2002-08-04 19:06:10 +02:00
|
|
|
|
break;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
case 'u':
|
|
|
|
|
flag_unconditional = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
print_version ();
|
|
|
|
|
/* print_version will exit. */
|
2001-11-01 22:48:49 +01:00
|
|
|
|
default:
|
|
|
|
|
print_usage (true);
|
|
|
|
|
/* print_usage will exit. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
return optind;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process a single source file. */
|
2001-11-01 22:48:49 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
process_file (const char *file_name)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
|
|
|
|
source_t *src;
|
|
|
|
|
function_t *fn;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
create_file_names (file_name);
|
|
|
|
|
if (read_graph_file ())
|
|
|
|
|
return;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!functions)
|
|
|
|
|
{
|
|
|
|
|
fnotice (stderr, "%s:no functions found\n", bbg_file_name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (read_count_file ())
|
|
|
|
|
return;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (fn = functions; fn; fn = fn->next)
|
|
|
|
|
solve_flow_graph (fn);
|
|
|
|
|
for (src = sources; src; src = src->next)
|
2003-07-19 16:47:15 +02:00
|
|
|
|
src->lines = xcalloc (src->num_lines, sizeof (line_t));
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (fn = functions; fn; fn = fn->next)
|
|
|
|
|
{
|
|
|
|
|
coverage_t coverage;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
memset (&coverage, 0, sizeof (coverage));
|
|
|
|
|
coverage.name = fn->name;
|
|
|
|
|
add_line_counts (flag_function_summary ? &coverage : NULL, fn);
|
|
|
|
|
if (flag_function_summary)
|
|
|
|
|
{
|
|
|
|
|
function_summary (&coverage, "Function");
|
|
|
|
|
fnotice (stdout, "\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (src = sources; src; src = src->next)
|
|
|
|
|
{
|
|
|
|
|
accumulate_line_counts (src);
|
|
|
|
|
function_summary (&src->coverage, "File");
|
|
|
|
|
if (flag_gcov_file)
|
|
|
|
|
{
|
|
|
|
|
char *gcov_file_name = make_gcov_file_name (file_name, src->name);
|
|
|
|
|
FILE *gcov_file = fopen (gcov_file_name, "w");
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (gcov_file)
|
|
|
|
|
{
|
|
|
|
|
fnotice (stdout, "%s:creating `%s'\n",
|
|
|
|
|
src->name, gcov_file_name);
|
|
|
|
|
output_lines (gcov_file, src);
|
|
|
|
|
if (ferror (gcov_file))
|
|
|
|
|
fnotice (stderr, "%s:error writing output file `%s'\n",
|
|
|
|
|
src->name, gcov_file_name);
|
|
|
|
|
fclose (gcov_file);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fnotice (stderr, "%s:could not open output file `%s'\n",
|
|
|
|
|
src->name, gcov_file_name);
|
|
|
|
|
free (gcov_file_name);
|
|
|
|
|
}
|
|
|
|
|
fnotice (stdout, "\n");
|
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Release all memory used. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
release_structures (void)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
|
|
|
|
function_t *fn;
|
|
|
|
|
source_t *src;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
free (bbg_file_name);
|
|
|
|
|
free (da_file_name);
|
|
|
|
|
da_file_name = bbg_file_name = NULL;
|
|
|
|
|
bbg_file_time = 0;
|
2003-07-06 16:51:48 +02:00
|
|
|
|
bbg_stamp = 0;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
while ((src = sources))
|
|
|
|
|
{
|
|
|
|
|
sources = src->next;
|
|
|
|
|
|
|
|
|
|
free (src->name);
|
|
|
|
|
free (src->lines);
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
while ((fn = functions))
|
|
|
|
|
{
|
|
|
|
|
unsigned ix;
|
|
|
|
|
block_t *block;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
functions = fn->next;
|
|
|
|
|
for (ix = fn->num_blocks, block = fn->blocks; ix--; block++)
|
|
|
|
|
{
|
|
|
|
|
arc_t *arc, *arc_n;
|
|
|
|
|
|
|
|
|
|
for (arc = block->succ; arc; arc = arc_n)
|
|
|
|
|
{
|
|
|
|
|
arc_n = arc->succ_next;
|
|
|
|
|
free (arc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free (fn->blocks);
|
|
|
|
|
free (fn->counts);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Generate the names of the graph and data files. If OBJECT_DIRECTORY
|
|
|
|
|
is not specified, these are looked for in the current directory,
|
|
|
|
|
and named from the basename of the FILE_NAME sans extension. If
|
2002-08-04 19:06:10 +02:00
|
|
|
|
OBJECT_DIRECTORY is specified and is a directory, the files are in
|
2002-12-16 19:23:00 +01:00
|
|
|
|
that directory, but named from the basename of the FILE_NAME, sans
|
|
|
|
|
extension. Otherwise OBJECT_DIRECTORY is taken to be the name of
|
|
|
|
|
the object *file*, and the data files are named from that. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
create_file_names (const char *file_name)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
|
|
|
|
char *cptr;
|
2002-08-04 19:06:10 +02:00
|
|
|
|
char *name;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
int length = strlen (file_name);
|
2002-08-04 19:06:10 +02:00
|
|
|
|
int base;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
if (object_directory && object_directory[0])
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-08-04 19:06:10 +02:00
|
|
|
|
struct stat status;
|
|
|
|
|
|
|
|
|
|
length += strlen (object_directory) + 2;
|
|
|
|
|
name = xmalloc (length);
|
|
|
|
|
name[0] = 0;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
base = !stat (object_directory, &status) && S_ISDIR (status.st_mode);
|
|
|
|
|
strcat (name, object_directory);
|
|
|
|
|
if (base && name[strlen (name) - 1] != '/')
|
|
|
|
|
strcat (name, "/");
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-08-04 19:06:10 +02:00
|
|
|
|
name = xmalloc (length + 1);
|
|
|
|
|
name[0] = 0;
|
|
|
|
|
base = 1;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
if (base)
|
|
|
|
|
{
|
2003-06-29 15:53:12 +02:00
|
|
|
|
/* Append source file name. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
cptr = strrchr (file_name, '/');
|
|
|
|
|
strcat (name, cptr ? cptr + 1 : file_name);
|
2002-08-04 19:06:10 +02:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-09-08 14:47:27 +02:00
|
|
|
|
/* Remove the extension. */
|
2002-08-04 19:06:10 +02:00
|
|
|
|
cptr = strrchr (name, '.');
|
1997-03-28 23:43:13 +01:00
|
|
|
|
if (cptr)
|
2002-08-04 19:06:10 +02:00
|
|
|
|
*cptr = 0;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
length = strlen (name);
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_GRAPH_SUFFIX, GCOV_GRAPH_MAGIC): Rename to GCOV_NOTE_SUFFIX,
GCOV_NOTE_MAGIC.
(GCOV_DATA_SUFFIX, GCOV_NOTE_SUFFIX): Update.
(GCOV_DATA_MAGIC, GCOV_NOTE_MAGIC): Make non-palindromic.
(struct gcov_var): Change buffer's type. Add endian flag.
(gcov_open): Remove mode in libgcov.
(gcov_magic): Prototype.
* gcov-io.c (from_file): New.
(gcov_open): Clear endian flag.
(gcov_magic): New.
(gcov_write_bytes, gcov_read_bytes): Return gcov_unsigned_t
pointers.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_write_tag, gcov_write_length, gcov_write_tag_length): Update.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Update.
* gcov-iov.c (main): Correct cast.
* coverage.c (read_counts_file): Use gcov_magic. Remove endianness
conversion.
(gcov_begin_output): Use GCOV_NOTE_MAGIC.
(coverage_init): Use GCOV_NOTE_SUFFIX.
* libgcov.c (gcov_version_mismatch): Remove endianness conversion.
Rename to gcov_version, and return flag.
(gcov_exit): Use gcov_version.
(__gcov_init): Use gcov_version.
* Makefile.in (coverageexts): Update.
* gcov.c (print_version): Remove endianness conversion.
(create_file_names): Use GCOV_NOTE_SUFFIX.
(read_graph_file): Use gcov_magic.
(read_count_file): Likewise.
* gcov-dump.c (dump_file): Remove endianness conversion, use
gcov_magic.
From-SVN: r69137
2003-07-09 14:12:29 +02:00
|
|
|
|
|
|
|
|
|
bbg_file_name = xmalloc (length + strlen (GCOV_NOTE_SUFFIX) + 1);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
strcpy (bbg_file_name, name);
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_GRAPH_SUFFIX, GCOV_GRAPH_MAGIC): Rename to GCOV_NOTE_SUFFIX,
GCOV_NOTE_MAGIC.
(GCOV_DATA_SUFFIX, GCOV_NOTE_SUFFIX): Update.
(GCOV_DATA_MAGIC, GCOV_NOTE_MAGIC): Make non-palindromic.
(struct gcov_var): Change buffer's type. Add endian flag.
(gcov_open): Remove mode in libgcov.
(gcov_magic): Prototype.
* gcov-io.c (from_file): New.
(gcov_open): Clear endian flag.
(gcov_magic): New.
(gcov_write_bytes, gcov_read_bytes): Return gcov_unsigned_t
pointers.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_write_tag, gcov_write_length, gcov_write_tag_length): Update.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Update.
* gcov-iov.c (main): Correct cast.
* coverage.c (read_counts_file): Use gcov_magic. Remove endianness
conversion.
(gcov_begin_output): Use GCOV_NOTE_MAGIC.
(coverage_init): Use GCOV_NOTE_SUFFIX.
* libgcov.c (gcov_version_mismatch): Remove endianness conversion.
Rename to gcov_version, and return flag.
(gcov_exit): Use gcov_version.
(__gcov_init): Use gcov_version.
* Makefile.in (coverageexts): Update.
* gcov.c (print_version): Remove endianness conversion.
(create_file_names): Use GCOV_NOTE_SUFFIX.
(read_graph_file): Use gcov_magic.
(read_count_file): Likewise.
* gcov-dump.c (dump_file): Remove endianness conversion, use
gcov_magic.
From-SVN: r69137
2003-07-09 14:12:29 +02:00
|
|
|
|
strcpy (bbg_file_name + length, GCOV_NOTE_SUFFIX);
|
2002-08-04 19:06:10 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
da_file_name = xmalloc (length + strlen (GCOV_DATA_SUFFIX) + 1);
|
|
|
|
|
strcpy (da_file_name, name);
|
|
|
|
|
strcpy (da_file_name + length, GCOV_DATA_SUFFIX);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
return;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
/* Find or create a source file structure for FILE_NAME. Copies
|
|
|
|
|
FILE_NAME on creation */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
|
|
|
|
|
static source_t *
|
2003-07-06 20:59:38 +02:00
|
|
|
|
find_source (const char *file_name)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
|
|
|
|
source_t *src;
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
|
|
|
|
|
if (!file_name)
|
|
|
|
|
file_name = "<unknown>";
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (src = sources; src; src = src->next)
|
|
|
|
|
if (!strcmp (file_name, src->name))
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
return src;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-07-19 16:47:15 +02:00
|
|
|
|
src = xcalloc (1, sizeof (source_t));
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
src->name = xstrdup (file_name);
|
|
|
|
|
src->coverage.name = src->name;
|
|
|
|
|
src->index = sources ? sources->index + 1 : 1;
|
|
|
|
|
src->next = sources;
|
|
|
|
|
sources = src;
|
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
return src;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-19 06:18:13 +01:00
|
|
|
|
/* Read the graph file. Return nonzero on fatal error. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int
|
2003-07-06 20:59:38 +02:00
|
|
|
|
read_graph_file (void)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned version;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned current_tag = 0;
|
|
|
|
|
struct function_info *fn = NULL;
|
|
|
|
|
source_t *src = NULL;
|
|
|
|
|
unsigned ix;
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
unsigned tag;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
if (!gcov_open (bbg_file_name, 1))
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stderr, "%s:cannot open graph file\n", bbg_file_name);
|
|
|
|
|
return 1;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
bbg_file_time = gcov_time ();
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_GRAPH_SUFFIX, GCOV_GRAPH_MAGIC): Rename to GCOV_NOTE_SUFFIX,
GCOV_NOTE_MAGIC.
(GCOV_DATA_SUFFIX, GCOV_NOTE_SUFFIX): Update.
(GCOV_DATA_MAGIC, GCOV_NOTE_MAGIC): Make non-palindromic.
(struct gcov_var): Change buffer's type. Add endian flag.
(gcov_open): Remove mode in libgcov.
(gcov_magic): Prototype.
* gcov-io.c (from_file): New.
(gcov_open): Clear endian flag.
(gcov_magic): New.
(gcov_write_bytes, gcov_read_bytes): Return gcov_unsigned_t
pointers.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_write_tag, gcov_write_length, gcov_write_tag_length): Update.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Update.
* gcov-iov.c (main): Correct cast.
* coverage.c (read_counts_file): Use gcov_magic. Remove endianness
conversion.
(gcov_begin_output): Use GCOV_NOTE_MAGIC.
(coverage_init): Use GCOV_NOTE_SUFFIX.
* libgcov.c (gcov_version_mismatch): Remove endianness conversion.
Rename to gcov_version, and return flag.
(gcov_exit): Use gcov_version.
(__gcov_init): Use gcov_version.
* Makefile.in (coverageexts): Update.
* gcov.c (print_version): Remove endianness conversion.
(create_file_names): Use GCOV_NOTE_SUFFIX.
(read_graph_file): Use gcov_magic.
(read_count_file): Likewise.
* gcov-dump.c (dump_file): Remove endianness conversion, use
gcov_magic.
From-SVN: r69137
2003-07-09 14:12:29 +02:00
|
|
|
|
if (!gcov_magic (gcov_read_unsigned (), GCOV_NOTE_MAGIC))
|
2002-05-09 14:54:19 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stderr, "%s:not a gcov graph file\n", bbg_file_name);
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
gcov_close ();
|
2002-12-16 19:23:00 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
2002-05-09 14:54:19 +02:00
|
|
|
|
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
version = gcov_read_unsigned ();
|
|
|
|
|
if (version != GCOV_VERSION)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
|
|
|
|
char v[4], e[4];
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
GCOV_UNSIGNED2STRING (v, version);
|
|
|
|
|
GCOV_UNSIGNED2STRING (e, GCOV_VERSION);
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stderr, "%s:version `%.4s', prefer `%.4s'\n",
|
|
|
|
|
bbg_file_name, v, e);
|
|
|
|
|
}
|
2003-07-06 16:51:48 +02:00
|
|
|
|
bbg_stamp = gcov_read_unsigned ();
|
|
|
|
|
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
while ((tag = gcov_read_unsigned ()))
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned length = gcov_read_unsigned ();
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
gcov_position_t base = gcov_position ();
|
2003-04-24 11:46:17 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (tag == GCOV_TAG_FUNCTION)
|
2002-05-09 14:54:19 +02:00
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
char *function_name;
|
2003-04-24 11:46:17 +02:00
|
|
|
|
unsigned ident, checksum, lineno;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
source_t *src;
|
|
|
|
|
function_t *probe, *prev;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
2003-04-24 11:46:17 +02:00
|
|
|
|
ident = gcov_read_unsigned ();
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
checksum = gcov_read_unsigned ();
|
2003-04-24 11:46:17 +02:00
|
|
|
|
function_name = xstrdup (gcov_read_string ());
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
src = find_source (gcov_read_string ());
|
|
|
|
|
lineno = gcov_read_unsigned ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-07-19 16:47:15 +02:00
|
|
|
|
fn = xcalloc (1, sizeof (function_t));
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fn->name = function_name;
|
2003-04-24 11:46:17 +02:00
|
|
|
|
fn->ident = ident;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fn->checksum = checksum;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fn->src = src;
|
|
|
|
|
fn->line = lineno;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
|
|
|
|
fn->next = functions;
|
|
|
|
|
functions = fn;
|
|
|
|
|
current_tag = tag;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (lineno >= src->num_lines)
|
|
|
|
|
src->num_lines = lineno + 1;
|
|
|
|
|
/* Now insert it into the source file's list of
|
|
|
|
|
functions. Normally functions will be encountered in
|
|
|
|
|
ascending order, so a simple scan is quick. */
|
|
|
|
|
for (probe = src->functions, prev = NULL;
|
|
|
|
|
probe && probe->line > lineno;
|
|
|
|
|
prev = probe, probe = probe->line_next)
|
|
|
|
|
continue;
|
|
|
|
|
fn->line_next = probe;
|
|
|
|
|
if (prev)
|
|
|
|
|
prev->line_next = fn;
|
|
|
|
|
else
|
|
|
|
|
src->functions = fn;
|
2002-05-09 14:54:19 +02:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
else if (fn && tag == GCOV_TAG_BLOCKS)
|
2002-05-09 14:54:19 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (fn->blocks)
|
|
|
|
|
fnotice (stderr, "%s:already seen blocks for `%s'\n",
|
|
|
|
|
bbg_file_name, fn->name);
|
|
|
|
|
else
|
2002-05-09 14:54:19 +02:00
|
|
|
|
{
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
unsigned ix, num_blocks = GCOV_TAG_BLOCKS_NUM (length);
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fn->num_blocks = num_blocks;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-07-19 16:47:15 +02:00
|
|
|
|
fn->blocks = xcalloc (fn->num_blocks, sizeof (block_t));
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (ix = 0; ix != num_blocks; ix++)
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
fn->blocks[ix].flags = gcov_read_unsigned ();
|
2002-05-09 14:54:19 +02:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
else if (fn && tag == GCOV_TAG_ARCS)
|
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned src = gcov_read_unsigned ();
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
unsigned num_dests = GCOV_TAG_ARCS_NUM (length);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
if (src >= fn->num_blocks || fn->blocks[src].succ)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
goto corrupt;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
while (num_dests--)
|
2002-05-09 14:54:19 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
struct arc_info *arc;
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned dest = gcov_read_unsigned ();
|
|
|
|
|
unsigned flags = gcov_read_unsigned ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
if (dest >= fn->num_blocks)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
goto corrupt;
|
2003-07-19 16:47:15 +02:00
|
|
|
|
arc = xcalloc (1, sizeof (arc_t));
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
arc->dst = &fn->blocks[dest];
|
|
|
|
|
arc->src = &fn->blocks[src];
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
arc->count = 0;
|
|
|
|
|
arc->count_valid = 0;
|
|
|
|
|
arc->on_tree = !!(flags & GCOV_ARC_ON_TREE);
|
|
|
|
|
arc->fake = !!(flags & GCOV_ARC_FAKE);
|
|
|
|
|
arc->fall_through = !!(flags & GCOV_ARC_FALLTHROUGH);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
arc->succ_next = fn->blocks[src].succ;
|
|
|
|
|
fn->blocks[src].succ = arc;
|
|
|
|
|
fn->blocks[src].num_succ++;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
arc->pred_next = fn->blocks[dest].pred;
|
|
|
|
|
fn->blocks[dest].pred = arc;
|
|
|
|
|
fn->blocks[dest].num_pred++;
|
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (arc->fake)
|
|
|
|
|
{
|
|
|
|
|
if (src)
|
|
|
|
|
{
|
|
|
|
|
/* Exceptional exit from this function, the
|
|
|
|
|
source block must be a call. */
|
|
|
|
|
fn->blocks[src].is_call_site = 1;
|
|
|
|
|
arc->is_call_non_return = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Non-local return from a callee of this
|
2003-07-06 20:59:38 +02:00
|
|
|
|
function. The destination block is a catch or
|
|
|
|
|
setjmp. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
arc->is_nonlocal_return = 1;
|
|
|
|
|
fn->blocks[dest].is_nonlocal_return = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!arc->on_tree)
|
|
|
|
|
fn->num_counts++;
|
2002-05-09 14:54:19 +02:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
else if (fn && tag == GCOV_TAG_LINES)
|
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned blockno = gcov_read_unsigned ();
|
2003-07-19 16:47:15 +02:00
|
|
|
|
unsigned *line_nos = xcalloc (length - 1, sizeof (unsigned));
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
if (blockno >= fn->num_blocks || fn->blocks[blockno].u.line.encoding)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
goto corrupt;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (ix = 0; ; )
|
2002-05-09 14:54:19 +02:00
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned lineno = gcov_read_unsigned ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (lineno)
|
2002-05-09 14:54:19 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!ix)
|
|
|
|
|
{
|
|
|
|
|
line_nos[ix++] = 0;
|
|
|
|
|
line_nos[ix++] = src->index;
|
|
|
|
|
}
|
|
|
|
|
line_nos[ix++] = lineno;
|
|
|
|
|
if (lineno >= src->num_lines)
|
|
|
|
|
src->num_lines = lineno + 1;
|
2002-05-09 14:54:19 +02:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
const char *file_name = gcov_read_string ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!file_name)
|
2002-05-09 14:54:19 +02:00
|
|
|
|
break;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
src = find_source (file_name);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
line_nos[ix++] = 0;
|
|
|
|
|
line_nos[ix++] = src->index;
|
|
|
|
|
}
|
2002-05-09 14:54:19 +02:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fn->blocks[blockno].u.line.encoding = line_nos;
|
|
|
|
|
fn->blocks[blockno].u.line.num = ix;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
else if (current_tag && !GCOV_TAG_IS_SUBTAG (current_tag, tag))
|
|
|
|
|
{
|
|
|
|
|
fn = NULL;
|
|
|
|
|
current_tag = 0;
|
|
|
|
|
}
|
gcov-io.h (GCOV_LOCKED): New #define.
* gcov-io.h (GCOV_LOCKED): New #define.
(GCOV_LINKAGE): Make sure it is #defined.
(gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_read_string, gcov_time): Poison in libgcov.
(gcov_seek_end): Remove.
(gcov_write_tag_length, gcov_sync, gcov_rewrite): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): New #defines.
(gcov_write_tag, gcov_write_length): Not in libgcov.
* gcov-io.c (gcov_open): Use GCOV_LOCKED.
(gcov_write_tag, gcov_write_length): Not in libgcov.
(gcov_write_tag_length): New.
(gcov_write_summary): Use gcov_write_tag_length.
* libgcov.c: Always #include gcov-io.h.
(IN_LIBGCOV): -1 for inhibit_libc, +1 otherwise.
(GCOV_LINKAGE): Define to nothing for L_gcov.
(gcov_exit): Replace gcov_write_tag, gcov_write_length with
gcov_write_tag_length. Use gcov_rewrite & gcov_seek.
* gcov.c (read_graph_file): Replace gcov_seek by gcov_sync.
(read_count_file): Likewise.
* gcov-dump.c (dump_file): Likewise.
* coverag.c (read_counts_file): Likewise.
From-SVN: r66555
2003-05-07 12:40:09 +02:00
|
|
|
|
gcov_sync (base, length);
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
if (gcov_is_error ())
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!gcov_is_eof ())
|
|
|
|
|
{
|
|
|
|
|
corrupt:;
|
|
|
|
|
fnotice (stderr, "%s:corrupted\n", bbg_file_name);
|
|
|
|
|
gcov_close ();
|
|
|
|
|
return 1;
|
2002-05-09 14:54:19 +02:00
|
|
|
|
}
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
gcov_close ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-12-21 15:08:35 +01:00
|
|
|
|
/* We built everything backwards, so nreverse them all. */
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Reverse sources. Not strictly necessary, but we'll then process
|
|
|
|
|
them in the 'expected' order. */
|
|
|
|
|
{
|
|
|
|
|
source_t *src, *src_p, *src_n;
|
|
|
|
|
|
|
|
|
|
for (src_p = NULL, src = sources; src; src_p = src, src = src_n)
|
|
|
|
|
{
|
|
|
|
|
src_n = src->next;
|
|
|
|
|
src->next = src_p;
|
|
|
|
|
}
|
|
|
|
|
sources = src_p;
|
|
|
|
|
}
|
2002-05-09 14:54:19 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Reverse functions. */
|
|
|
|
|
{
|
|
|
|
|
function_t *fn, *fn_p, *fn_n;
|
2002-05-09 14:54:19 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (fn_p = NULL, fn = functions; fn; fn_p = fn, fn = fn_n)
|
|
|
|
|
{
|
|
|
|
|
unsigned ix;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fn_n = fn->next;
|
|
|
|
|
fn->next = fn_p;
|
2002-05-09 14:54:19 +02:00
|
|
|
|
|
2003-06-29 15:53:12 +02:00
|
|
|
|
/* Reverse the arcs. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (ix = fn->num_blocks; ix--;)
|
|
|
|
|
{
|
|
|
|
|
arc_t *arc, *arc_p, *arc_n;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (arc_p = NULL, arc = fn->blocks[ix].succ; arc;
|
|
|
|
|
arc_p = arc, arc = arc_n)
|
|
|
|
|
{
|
|
|
|
|
arc_n = arc->succ_next;
|
|
|
|
|
arc->succ_next = arc_p;
|
|
|
|
|
}
|
|
|
|
|
fn->blocks[ix].succ = arc_p;
|
|
|
|
|
|
|
|
|
|
for (arc_p = NULL, arc = fn->blocks[ix].pred; arc;
|
|
|
|
|
arc_p = arc, arc = arc_n)
|
|
|
|
|
{
|
|
|
|
|
arc_n = arc->pred_next;
|
|
|
|
|
arc->pred_next = arc_p;
|
|
|
|
|
}
|
|
|
|
|
fn->blocks[ix].pred = arc_p;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
functions = fn_p;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2002-05-09 14:54:19 +02:00
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Reads profiles from the count file and attach to each
|
2002-12-19 06:18:13 +01:00
|
|
|
|
function. Return nonzero if fatal error. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
static int
|
2003-07-06 20:59:38 +02:00
|
|
|
|
read_count_file (void)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned ix;
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned version;
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
unsigned tag;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
function_t *fn = NULL;
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
int error = 0;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
if (!gcov_open (da_file_name, 1))
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stderr, "%s:cannot open data file\n", da_file_name);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_GRAPH_SUFFIX, GCOV_GRAPH_MAGIC): Rename to GCOV_NOTE_SUFFIX,
GCOV_NOTE_MAGIC.
(GCOV_DATA_SUFFIX, GCOV_NOTE_SUFFIX): Update.
(GCOV_DATA_MAGIC, GCOV_NOTE_MAGIC): Make non-palindromic.
(struct gcov_var): Change buffer's type. Add endian flag.
(gcov_open): Remove mode in libgcov.
(gcov_magic): Prototype.
* gcov-io.c (from_file): New.
(gcov_open): Clear endian flag.
(gcov_magic): New.
(gcov_write_bytes, gcov_read_bytes): Return gcov_unsigned_t
pointers.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_write_tag, gcov_write_length, gcov_write_tag_length): Update.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Update.
* gcov-iov.c (main): Correct cast.
* coverage.c (read_counts_file): Use gcov_magic. Remove endianness
conversion.
(gcov_begin_output): Use GCOV_NOTE_MAGIC.
(coverage_init): Use GCOV_NOTE_SUFFIX.
* libgcov.c (gcov_version_mismatch): Remove endianness conversion.
Rename to gcov_version, and return flag.
(gcov_exit): Use gcov_version.
(__gcov_init): Use gcov_version.
* Makefile.in (coverageexts): Update.
* gcov.c (print_version): Remove endianness conversion.
(create_file_names): Use GCOV_NOTE_SUFFIX.
(read_graph_file): Use gcov_magic.
(read_count_file): Likewise.
* gcov-dump.c (dump_file): Remove endianness conversion, use
gcov_magic.
From-SVN: r69137
2003-07-09 14:12:29 +02:00
|
|
|
|
if (!gcov_magic (gcov_read_unsigned (), GCOV_DATA_MAGIC))
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
|
|
|
|
fnotice (stderr, "%s:not a gcov data file\n", da_file_name);
|
|
|
|
|
cleanup:;
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
gcov_close ();
|
2002-12-16 19:23:00 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
version = gcov_read_unsigned ();
|
|
|
|
|
if (version != GCOV_VERSION)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
char v[4], e[4];
|
|
|
|
|
|
|
|
|
|
GCOV_UNSIGNED2STRING (v, version);
|
|
|
|
|
GCOV_UNSIGNED2STRING (e, GCOV_VERSION);
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_GRAPH_SUFFIX, GCOV_GRAPH_MAGIC): Rename to GCOV_NOTE_SUFFIX,
GCOV_NOTE_MAGIC.
(GCOV_DATA_SUFFIX, GCOV_NOTE_SUFFIX): Update.
(GCOV_DATA_MAGIC, GCOV_NOTE_MAGIC): Make non-palindromic.
(struct gcov_var): Change buffer's type. Add endian flag.
(gcov_open): Remove mode in libgcov.
(gcov_magic): Prototype.
* gcov-io.c (from_file): New.
(gcov_open): Clear endian flag.
(gcov_magic): New.
(gcov_write_bytes, gcov_read_bytes): Return gcov_unsigned_t
pointers.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_write_tag, gcov_write_length, gcov_write_tag_length): Update.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Update.
* gcov-iov.c (main): Correct cast.
* coverage.c (read_counts_file): Use gcov_magic. Remove endianness
conversion.
(gcov_begin_output): Use GCOV_NOTE_MAGIC.
(coverage_init): Use GCOV_NOTE_SUFFIX.
* libgcov.c (gcov_version_mismatch): Remove endianness conversion.
Rename to gcov_version, and return flag.
(gcov_exit): Use gcov_version.
(__gcov_init): Use gcov_version.
* Makefile.in (coverageexts): Update.
* gcov.c (print_version): Remove endianness conversion.
(create_file_names): Use GCOV_NOTE_SUFFIX.
(read_graph_file): Use gcov_magic.
(read_count_file): Likewise.
* gcov-dump.c (dump_file): Remove endianness conversion, use
gcov_magic.
From-SVN: r69137
2003-07-09 14:12:29 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stderr, "%s:version `%.4s', prefer version `%.4s'\n",
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
da_file_name, v, e);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2003-07-06 16:51:48 +02:00
|
|
|
|
tag = gcov_read_unsigned ();
|
|
|
|
|
if (tag != bbg_stamp)
|
|
|
|
|
{
|
|
|
|
|
fnotice (stderr, "%s:stamp mismatch with graph file\n", da_file_name);
|
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
while ((tag = gcov_read_unsigned ()))
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
unsigned length = gcov_read_unsigned ();
|
|
|
|
|
unsigned long base = gcov_position ();
|
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (tag == GCOV_TAG_OBJECT_SUMMARY)
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
gcov_read_summary (&object_summary);
|
Makefile.in (LIBGCC_DEPS): Add gcov headers.
* Makefile.in (LIBGCC_DEPS): Add gcov headers.
(libgcov.a): Depends on LIBGCC_DEPS.
* basic-block.h (profile_info): Moved here from coverage.h. Made
a pointer.
* coverage.c (struct function_list): Fixed array of counter types.
(struct counts_entry): Keyed by counter type, contains summary.
(profile_info): Moved to profile.c.
(prg_ctr_mask, prg_n_ctrs, fn_ctr_mask, fn_n_ctrs): New global
vars.
(profiler_label): Remove.
(ctr_labels): New.
(set_purpose, label_for_tag, build_counter_section_fields,
build_counter_section_value, build_counter_section_data_fields,
build_counter_section_data_values, build_function_info_fields,
build_function_info_value, gcov_info_fields, gcov_info_value): Remove.
(build_fn_info_type, build_fn_info_value, build_ctr_info_type,
build_ctr_info_value, build_gcov_info): New.
(htab_counts_entry_hash, htab_counts_entry_eq): Adjust.
(reads_counts_file): Adjust.
(get_coverage_counts): Takes counter number. Add summary
parameter. Adjust.
(coverage_counter_ref): Tkaes counter number. Adjust. Lazily
create counter array labels.
(coverage_end_function): Adjust.
(create_coverage): Adjust.
(find_counters_section): Remove.
* coverage.h (MAX_COUNTER_SECTIONS): Remove.
(struct section_info, struct profile_info): Remove.
(profile_info): Moved to basic-block.h.
(coverage_counter_ref): Takes a counter number.
(get_coverage_counts): Takes a counter number. Added summary
parameter.
(find_counters_section): Remove.
* gcov-dump.c (tag_arc_counts): Rename to ...
(tag_counters): ... here. Adjust.
(tag_table): Move tag_counters to 3rd entry. Remove
PROGRAM_PLACEHOLDER and PROGRAM_INCORRECT entries.
(dump_file): Check for counter tag values here.
(tag_summary): Adjust.
* gcov-io.c (gcov_write_summary, gcov_read_summary): Adjust.
* gcov-io.h (GCOV_LOCKED): New.
(GCOV_TAG_ARC_COUNTS): Rename to ...
(GCOV_TAG_COUNTS_BASE): ... here.
(GCOV_TAG_PLACEHOLDER_SUMMARY, GCOV_TAG_INCORRECT_SUMMARY):
Remove.
(GCOV_COUNTER_ARCS, GCOV_COUNTERS, GCOV_NAMES): New.
(GCOV_TAG_FOR_COUNTER, GCOV_COUNTER_FOR_TAG,
GCOV_TAG_IS_COUNTER): New.
(struct gcov_ctr_summary): New.
(struct gcov_summary): Adjust.
(struct gcov_counter_section): Remove.
struct gcov_counter_section_data): Remove.
(struct gcov_function_info): Rename to ...
(struct gcov_fn_info): ... here. Adjust.
(struct gcov_ctr_info): New.
(struct gcov_info): Adjust.
* gcov.c (read_count_file): Adjust.
(output_lines): Adjust.
* libgcov.c (gcov_exit): Adjust.
(__gcov_flush): Adjust.
* mklibgcc.in (libgcc2_c_dep): Add gcov headers.
* predict.c (maybe_hot_bb_p, probably_cold_bb_p,
probably_never_executed_bb_p, compute_frequency_function): Adjust
profile_info use.
* profile.c (struct counts_entry): Remove.
(profile_info): Define here.
(get_exec_counts): Adjust get_coverage_counts call.
(compute_branch_probablilities): Remove find_counters_section
call.
(gen_edge_profiler): Adjust coverage_counter_ref call.
* tracer.c (tail_duplicate): Adjust profile_info use.
From-SVN: r65990
2003-04-23 16:05:11 +02:00
|
|
|
|
else if (tag == GCOV_TAG_PROGRAM_SUMMARY)
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
program_count++;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
else if (tag == GCOV_TAG_FUNCTION)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2003-04-24 11:46:17 +02:00
|
|
|
|
unsigned ident = gcov_read_unsigned ();
|
2002-12-16 19:23:00 +01:00
|
|
|
|
struct function_info *fn_n = functions;
|
|
|
|
|
|
|
|
|
|
for (fn = fn ? fn->next : NULL; ; fn = fn->next)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (fn)
|
|
|
|
|
;
|
|
|
|
|
else if ((fn = fn_n))
|
|
|
|
|
fn_n = NULL;
|
|
|
|
|
else
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2003-04-24 11:46:17 +02:00
|
|
|
|
fnotice (stderr, "%s:unknown function `%u'\n",
|
|
|
|
|
da_file_name, ident);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
break;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2003-04-24 11:46:17 +02:00
|
|
|
|
if (fn->ident == ident)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
break;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
|
|
|
|
if (!fn)
|
|
|
|
|
;
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
else if (gcov_read_unsigned () != fn->checksum)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
mismatch:;
|
|
|
|
|
fnotice (stderr, "%s:profile mismatch for `%s'\n",
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
da_file_name, fn->name);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
|
|
|
|
}
|
Makefile.in (LIBGCC_DEPS): Add gcov headers.
* Makefile.in (LIBGCC_DEPS): Add gcov headers.
(libgcov.a): Depends on LIBGCC_DEPS.
* basic-block.h (profile_info): Moved here from coverage.h. Made
a pointer.
* coverage.c (struct function_list): Fixed array of counter types.
(struct counts_entry): Keyed by counter type, contains summary.
(profile_info): Moved to profile.c.
(prg_ctr_mask, prg_n_ctrs, fn_ctr_mask, fn_n_ctrs): New global
vars.
(profiler_label): Remove.
(ctr_labels): New.
(set_purpose, label_for_tag, build_counter_section_fields,
build_counter_section_value, build_counter_section_data_fields,
build_counter_section_data_values, build_function_info_fields,
build_function_info_value, gcov_info_fields, gcov_info_value): Remove.
(build_fn_info_type, build_fn_info_value, build_ctr_info_type,
build_ctr_info_value, build_gcov_info): New.
(htab_counts_entry_hash, htab_counts_entry_eq): Adjust.
(reads_counts_file): Adjust.
(get_coverage_counts): Takes counter number. Add summary
parameter. Adjust.
(coverage_counter_ref): Tkaes counter number. Adjust. Lazily
create counter array labels.
(coverage_end_function): Adjust.
(create_coverage): Adjust.
(find_counters_section): Remove.
* coverage.h (MAX_COUNTER_SECTIONS): Remove.
(struct section_info, struct profile_info): Remove.
(profile_info): Moved to basic-block.h.
(coverage_counter_ref): Takes a counter number.
(get_coverage_counts): Takes a counter number. Added summary
parameter.
(find_counters_section): Remove.
* gcov-dump.c (tag_arc_counts): Rename to ...
(tag_counters): ... here. Adjust.
(tag_table): Move tag_counters to 3rd entry. Remove
PROGRAM_PLACEHOLDER and PROGRAM_INCORRECT entries.
(dump_file): Check for counter tag values here.
(tag_summary): Adjust.
* gcov-io.c (gcov_write_summary, gcov_read_summary): Adjust.
* gcov-io.h (GCOV_LOCKED): New.
(GCOV_TAG_ARC_COUNTS): Rename to ...
(GCOV_TAG_COUNTS_BASE): ... here.
(GCOV_TAG_PLACEHOLDER_SUMMARY, GCOV_TAG_INCORRECT_SUMMARY):
Remove.
(GCOV_COUNTER_ARCS, GCOV_COUNTERS, GCOV_NAMES): New.
(GCOV_TAG_FOR_COUNTER, GCOV_COUNTER_FOR_TAG,
GCOV_TAG_IS_COUNTER): New.
(struct gcov_ctr_summary): New.
(struct gcov_summary): Adjust.
(struct gcov_counter_section): Remove.
struct gcov_counter_section_data): Remove.
(struct gcov_function_info): Rename to ...
(struct gcov_fn_info): ... here. Adjust.
(struct gcov_ctr_info): New.
(struct gcov_info): Adjust.
* gcov.c (read_count_file): Adjust.
(output_lines): Adjust.
* libgcov.c (gcov_exit): Adjust.
(__gcov_flush): Adjust.
* mklibgcc.in (libgcc2_c_dep): Add gcov headers.
* predict.c (maybe_hot_bb_p, probably_cold_bb_p,
probably_never_executed_bb_p, compute_frequency_function): Adjust
profile_info use.
* profile.c (struct counts_entry): Remove.
(profile_info): Define here.
(get_exec_counts): Adjust get_coverage_counts call.
(compute_branch_probablilities): Remove find_counters_section
call.
(gen_edge_profiler): Adjust coverage_counter_ref call.
* tracer.c (tail_duplicate): Adjust profile_info use.
From-SVN: r65990
2003-04-23 16:05:11 +02:00
|
|
|
|
else if (tag == GCOV_TAG_FOR_COUNTER (GCOV_COUNTER_ARCS) && fn)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): Adjust.
(GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM,
GCOV_TAG_COUNTER_NUM): New.
(GCOV_BLOCK_SIZE): Number of words.
(gcov_var): Adjust buffer type.
* gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ...
(gcov_write_words, gcov_read_words): ... here. Take a 4-byte word
count, not byte count.
(gcov_open): Adjust overread init.
(gcov_allocate, gcov_write_unsigned, gcov_write_counter,
gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_write_tag_length): Adjust.
(gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_sync, gcov_seek): Adjust.
* gcov-dump.c (print_usage): Show gcc version only.
(dump_file): Use GCOV_UNSIGNED2STRING.
(tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros.
* gcov.c (print_version): Show gcc version only.
(read_graph_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_*_NUM macros.
(read_count_file): Use GCOV_UNSIGNED2STRING. Use
GCOV_TAG_COUNTER_LENGTH.
* coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING.
Use GCOV_TAG_COUNTER_NUM.
* libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING.
(__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK.
From-SVN: r69188
2003-07-10 16:13:01 +02:00
|
|
|
|
if (length != GCOV_TAG_COUNTER_LENGTH (fn->num_counts))
|
2002-12-16 19:23:00 +01:00
|
|
|
|
goto mismatch;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!fn->counts)
|
2003-07-19 16:47:15 +02:00
|
|
|
|
fn->counts = xcalloc (fn->num_counts, sizeof (gcov_type));
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (ix = 0; ix != fn->num_counts; ix++)
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
fn->counts[ix] += gcov_read_counter ();
|
|
|
|
|
}
|
gcov-io.h (GCOV_LOCKED): New #define.
* gcov-io.h (GCOV_LOCKED): New #define.
(GCOV_LINKAGE): Make sure it is #defined.
(gcov_write_string, gcov_write_tag, gcov_write_length,
gcov_read_string, gcov_time): Poison in libgcov.
(gcov_seek_end): Remove.
(gcov_write_tag_length, gcov_sync, gcov_rewrite): New.
(GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH,
GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH,
GCOV_TAG_SUMMARY_LENGTH): New #defines.
(gcov_write_tag, gcov_write_length): Not in libgcov.
* gcov-io.c (gcov_open): Use GCOV_LOCKED.
(gcov_write_tag, gcov_write_length): Not in libgcov.
(gcov_write_tag_length): New.
(gcov_write_summary): Use gcov_write_tag_length.
* libgcov.c: Always #include gcov-io.h.
(IN_LIBGCOV): -1 for inhibit_libc, +1 otherwise.
(GCOV_LINKAGE): Define to nothing for L_gcov.
(gcov_exit): Replace gcov_write_tag, gcov_write_length with
gcov_write_tag_length. Use gcov_rewrite & gcov_seek.
* gcov.c (read_graph_file): Replace gcov_seek by gcov_sync.
(read_count_file): Likewise.
* gcov-dump.c (dump_file): Likewise.
* coverag.c (read_counts_file): Likewise.
From-SVN: r66555
2003-05-07 12:40:09 +02:00
|
|
|
|
gcov_sync (base, length);
|
Makefile.in (loop-init.o): Do not depend on gcov-io.h, gcov-iov.h.
* Makefile.in (loop-init.o): Do not depend on gcov-io.h,
gcov-iov.h.
Simplify interface to gcov reading and writing.
* gcov-io.h (gcov_file, gcov_position, gcov_length, gcov_buffer,
gcov_alloc, gcov_modified, gcov_errored): Move into ...
(struct gcov_var gcov_var): ... this static structure.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string):
Return void.
(gcov_read_unsigned, gcov_read_couter, gcov_read_string): Return
read object.
(gcov_read_bytes, gcov_write_bytes): Set error flag on error.
(gcov_reserve_length): Remove.
(gcov_write_tag): New.
(gcov_write_length): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_eof, gcov_ok): Rename to ...
(gcov_is_eof, gcov_is_error): ... here. Return error code.
(gcov_save_position, gcov_resync): Rename to ...
(gcov_position, gcov_seek): ... here.
(gcov_skip, gcov_skip_string): Remove.
(gcov_error): Remove.
(gcov_open, gcov_close): Adjust.
* gcov.c (find_source): Take const char *, copy it on allocation.
(read_graph_file): Adjust.
(read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
* gcov-dump.c (tag_function, tag_blocks, tag_arcs, tag_lines,
tag_arc_counts, tag_summary): Return void. Adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust gcov calls.
From-SVN: r65464
2003-04-11 12:38:57 +02:00
|
|
|
|
if ((error = gcov_is_error ()))
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
break;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2001-07-16 11:16:04 +02:00
|
|
|
|
|
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
2003-05-14 18:01:20 +02:00
|
|
|
|
if (!gcov_is_eof ())
|
|
|
|
|
{
|
|
|
|
|
fnotice (stderr, error < 0 ? "%s:overflowed\n" : "%s:corrupted\n",
|
|
|
|
|
da_file_name);
|
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
Change gcov file interface to single file at a time.
* gcov-io.h: Replace IN_LIBGCC1 with IN_LIBGCOV. Use IN_GCOV.
Convert to C89 prototypes.
(gcov_file, gcov_length, gcov_position, gcov_buffer, gcov_alloc,
gcov_error, gcov_modified): New static variables.
(gcov_open, gcov_close, gcov_read_bytes, gcov_write_bytes): New
functions.
(gcov_write_unsigned, gcov_write_counter, gcov_write_string,
gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust.
(gcov_read_summary, gcov_write_summary): Adjust.
(gcov_save_position, gcov_reserve_length, gcov_write_length):
Adjust.
(gcov_resync, gcov_skip, gcov_skip_string): Adjust.
(da_file_open, da_file_close, da_file_eof, da_file_error): Remove.
(da_file_position, da_file_seek, da_file_write, da_file_read):
Remove.
(gcov_error, gcov_eof, gcov_ok, gcov_time): New functions.
* gcov.c (gcov_type): Don't typedef here.
(IN_GCOV): #define
(read_graph_file, read_count_file): Adjust.
* gcov-dump.c (gcov_type): Don't typedef here.
(IN_GCOV): #define.
(tag_function, tag_blocks, tag_arcs, tag_lines, tag_arc_counts):
Remove FILE parameter, adjust.
(struct tag_format): Adjust proc member.
(dump_file): Adjust.
* libgcov.c (IN_LIBGCOV): #define.
(gcov_exit): Adjust.
* loop-init.c: Don't #include gcov-io.h
* profile.c (struct counts_entry): New structure to hold counter
values.
(struct section_reference, struct da_index_entry): Remove.
(bbg_file, da_file): Remove.
(htab_counts_index_hash, htab_counts_index_eq,
htab_counts_index_del): Replace with ...
(htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del): ... these.
(cleanup_counts_index, index_counts_file): Remove.
(read_counts_file): New function.
(get_exec_counts): Adjust.
(compute_branch_probabilities): Don't free the exec counts here.
(branch_prob): Adjust.
(init_branch_prob): Adjust.
(end_branch_prob): Adjust.
From-SVN: r65338
2003-04-07 21:37:12 +02:00
|
|
|
|
gcov_close ();
|
2002-12-16 19:23:00 +01:00
|
|
|
|
return 0;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Solve the flow graph. Propagate counts from the instrumented arcs
|
|
|
|
|
to the blocks and the uninstrumented arcs. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
solve_flow_graph (function_t *fn)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned ix;
|
|
|
|
|
arc_t *arc;
|
|
|
|
|
gcov_type *count_ptr = fn->counts;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
block_t *blk;
|
2003-01-18 23:32:06 +01:00
|
|
|
|
block_t *valid_blocks = NULL; /* valid, but unpropagated blocks. */
|
|
|
|
|
block_t *invalid_blocks = NULL; /* invalid, but inferable blocks. */
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (fn->num_blocks < 2)
|
|
|
|
|
fnotice (stderr, "%s:`%s' lacks entry and/or exit blocks\n",
|
|
|
|
|
bbg_file_name, fn->name);
|
|
|
|
|
else
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (fn->blocks[0].num_pred)
|
|
|
|
|
fnotice (stderr, "%s:`%s' has arcs to entry block\n",
|
|
|
|
|
bbg_file_name, fn->name);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
else
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* We can't deduce the entry block counts from the lack of
|
|
|
|
|
predecessors. */
|
|
|
|
|
fn->blocks[0].num_pred = ~(unsigned)0;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (fn->blocks[fn->num_blocks - 1].num_succ)
|
|
|
|
|
fnotice (stderr, "%s:`%s' has arcs from exit block\n",
|
|
|
|
|
bbg_file_name, fn->name);
|
|
|
|
|
else
|
|
|
|
|
/* Likewise, we can't deduce exit block counts from the lack
|
|
|
|
|
of its successors. */
|
|
|
|
|
fn->blocks[fn->num_blocks - 1].num_succ = ~(unsigned)0;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Propagate the measured counts, this must be done in the same
|
|
|
|
|
order as the code in profile.c */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (ix = 0, blk = fn->blocks; ix != fn->num_blocks; ix++, blk++)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
block_t const *prev_dst = NULL;
|
|
|
|
|
int out_of_order = 0;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
int non_fake_succ = 0;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (arc = blk->succ; arc; arc = arc->succ_next)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (!arc->fake)
|
|
|
|
|
non_fake_succ++;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!arc->on_tree)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (count_ptr)
|
|
|
|
|
arc->count = *count_ptr++;
|
|
|
|
|
arc->count_valid = 1;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
blk->num_succ--;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
arc->dst->num_pred--;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (prev_dst && prev_dst > arc->dst)
|
|
|
|
|
out_of_order = 1;
|
|
|
|
|
prev_dst = arc->dst;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (non_fake_succ == 1)
|
|
|
|
|
{
|
|
|
|
|
/* If there is only one non-fake exit, it is an
|
|
|
|
|
unconditional branch. */
|
|
|
|
|
for (arc = blk->succ; arc; arc = arc->succ_next)
|
|
|
|
|
if (!arc->fake)
|
|
|
|
|
{
|
|
|
|
|
arc->is_unconditional = 1;
|
|
|
|
|
/* If this block is instrumenting a call, it might be
|
2003-07-01 14:18:01 +02:00
|
|
|
|
an artificial block. It is not artificial if it has
|
2003-04-06 15:18:41 +02:00
|
|
|
|
a non-fallthrough exit, or the destination of this
|
|
|
|
|
arc has more than one entry. Mark the destination
|
|
|
|
|
block as a return site, if none of those conditions
|
|
|
|
|
hold. */
|
|
|
|
|
if (blk->is_call_site && arc->fall_through
|
|
|
|
|
&& arc->dst->pred == arc && !arc->pred_next)
|
|
|
|
|
arc->dst->is_call_return = 1;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Sort the successor arcs into ascending dst order. profile.c
|
|
|
|
|
normally produces arcs in the right order, but sometimes with
|
|
|
|
|
one or two out of order. We're not using a particularly
|
2003-01-18 23:32:06 +01:00
|
|
|
|
smart sort. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (out_of_order)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
arc_t *start = blk->succ;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned changes = 1;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
while (changes)
|
|
|
|
|
{
|
|
|
|
|
arc_t *arc, *arc_p, *arc_n;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
changes = 0;
|
|
|
|
|
for (arc_p = NULL, arc = start; (arc_n = arc->succ_next);)
|
|
|
|
|
{
|
|
|
|
|
if (arc->dst > arc_n->dst)
|
|
|
|
|
{
|
|
|
|
|
changes = 1;
|
|
|
|
|
if (arc_p)
|
|
|
|
|
arc_p->succ_next = arc_n;
|
|
|
|
|
else
|
|
|
|
|
start = arc_n;
|
|
|
|
|
arc->succ_next = arc_n->succ_next;
|
|
|
|
|
arc_n->succ_next = arc;
|
|
|
|
|
arc_p = arc_n;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
arc_p = arc;
|
|
|
|
|
arc = arc_n;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
blk->succ = start;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Place it on the invalid chain, it will be ignored if that's
|
|
|
|
|
wrong. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
blk->invalid_chain = 1;
|
|
|
|
|
blk->chain = invalid_blocks;
|
|
|
|
|
invalid_blocks = blk;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (invalid_blocks || valid_blocks)
|
|
|
|
|
{
|
|
|
|
|
while ((blk = invalid_blocks))
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
gcov_type total = 0;
|
|
|
|
|
const arc_t *arc;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
invalid_blocks = blk->chain;
|
|
|
|
|
blk->invalid_chain = 0;
|
|
|
|
|
if (!blk->num_succ)
|
|
|
|
|
for (arc = blk->succ; arc; arc = arc->succ_next)
|
|
|
|
|
total += arc->count;
|
|
|
|
|
else if (!blk->num_pred)
|
|
|
|
|
for (arc = blk->pred; arc; arc = arc->pred_next)
|
|
|
|
|
total += arc->count;
|
|
|
|
|
else
|
|
|
|
|
continue;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
blk->count = total;
|
|
|
|
|
blk->count_valid = 1;
|
|
|
|
|
blk->chain = valid_blocks;
|
|
|
|
|
blk->valid_chain = 1;
|
|
|
|
|
valid_blocks = blk;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
while ((blk = valid_blocks))
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
gcov_type total;
|
|
|
|
|
arc_t *arc, *inv_arc;
|
|
|
|
|
|
|
|
|
|
valid_blocks = blk->chain;
|
|
|
|
|
blk->valid_chain = 0;
|
|
|
|
|
if (blk->num_succ == 1)
|
|
|
|
|
{
|
|
|
|
|
block_t *dst;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
total = blk->count;
|
|
|
|
|
inv_arc = NULL;
|
|
|
|
|
for (arc = blk->succ; arc; arc = arc->succ_next)
|
|
|
|
|
{
|
|
|
|
|
total -= arc->count;
|
|
|
|
|
if (!arc->count_valid)
|
|
|
|
|
inv_arc = arc;
|
|
|
|
|
}
|
|
|
|
|
dst = inv_arc->dst;
|
|
|
|
|
inv_arc->count_valid = 1;
|
|
|
|
|
inv_arc->count = total;
|
|
|
|
|
blk->num_succ--;
|
|
|
|
|
dst->num_pred--;
|
|
|
|
|
if (dst->count_valid)
|
|
|
|
|
{
|
|
|
|
|
if (dst->num_pred == 1 && !dst->valid_chain)
|
|
|
|
|
{
|
|
|
|
|
dst->chain = valid_blocks;
|
|
|
|
|
dst->valid_chain = 1;
|
|
|
|
|
valid_blocks = dst;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!dst->num_pred && !dst->invalid_chain)
|
|
|
|
|
{
|
|
|
|
|
dst->chain = invalid_blocks;
|
|
|
|
|
dst->invalid_chain = 1;
|
|
|
|
|
invalid_blocks = dst;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (blk->num_pred == 1)
|
|
|
|
|
{
|
|
|
|
|
block_t *src;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
total = blk->count;
|
|
|
|
|
inv_arc = NULL;
|
|
|
|
|
for (arc = blk->pred; arc; arc = arc->pred_next)
|
|
|
|
|
{
|
|
|
|
|
total -= arc->count;
|
|
|
|
|
if (!arc->count_valid)
|
|
|
|
|
inv_arc = arc;
|
|
|
|
|
}
|
|
|
|
|
src = inv_arc->src;
|
|
|
|
|
inv_arc->count_valid = 1;
|
|
|
|
|
inv_arc->count = total;
|
|
|
|
|
blk->num_pred--;
|
|
|
|
|
src->num_succ--;
|
|
|
|
|
if (src->count_valid)
|
|
|
|
|
{
|
|
|
|
|
if (src->num_succ == 1 && !src->valid_chain)
|
|
|
|
|
{
|
|
|
|
|
src->chain = valid_blocks;
|
|
|
|
|
src->valid_chain = 1;
|
|
|
|
|
valid_blocks = src;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!src->num_succ && !src->invalid_chain)
|
|
|
|
|
{
|
|
|
|
|
src->chain = invalid_blocks;
|
|
|
|
|
src->invalid_chain = 1;
|
|
|
|
|
invalid_blocks = src;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* If the graph has been correctly solved, every block will have a
|
|
|
|
|
valid count. */
|
|
|
|
|
for (ix = 0; ix < fn->num_blocks; ix++)
|
|
|
|
|
if (!fn->blocks[ix].count_valid)
|
|
|
|
|
{
|
|
|
|
|
fnotice (stderr, "%s:graph is unsolvable for `%s'\n",
|
|
|
|
|
bbg_file_name, fn->name);
|
|
|
|
|
break;
|
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Increment totals in COVERAGE according to arc ARC. */
|
2002-08-07 01:18:01 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
add_branch_counts (coverage_t *coverage, const arc_t *arc)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (arc->is_call_non_return)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
coverage->calls++;
|
|
|
|
|
if (arc->src->count)
|
|
|
|
|
coverage->calls_executed++;
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
else if (!arc->is_unconditional)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
coverage->branches++;
|
|
|
|
|
if (arc->src->count)
|
|
|
|
|
coverage->branches_executed++;
|
|
|
|
|
if (arc->count)
|
|
|
|
|
coverage->branches_taken++;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
/* Format a HOST_WIDE_INT as either a percent ratio, or absolute
|
|
|
|
|
count. If dp >= 0, format TOP/BOTTOM * 100 to DP decimal places.
|
|
|
|
|
If DP is zero, no decimal point is printed. Only print 100% when
|
|
|
|
|
TOP==BOTTOM and only print 0% when TOP=0. If dp < 0, then simply
|
|
|
|
|
format TOP. Return pointer to a static string. */
|
|
|
|
|
|
|
|
|
|
static char const *
|
2003-07-06 20:59:38 +02:00
|
|
|
|
format_gcov (gcov_type top, gcov_type bottom, int dp)
|
2002-08-04 19:06:10 +02:00
|
|
|
|
{
|
|
|
|
|
static char buffer[20];
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
if (dp >= 0)
|
|
|
|
|
{
|
|
|
|
|
float ratio = bottom ? (float)top / bottom : 0;
|
|
|
|
|
int ix;
|
|
|
|
|
unsigned limit = 100;
|
|
|
|
|
unsigned percent;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
for (ix = dp; ix--; )
|
|
|
|
|
limit *= 10;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-06 00:16:51 +02:00
|
|
|
|
percent = (unsigned) (ratio * limit + (float)0.5);
|
|
|
|
|
if (percent <= 0 && top)
|
2002-08-04 19:06:10 +02:00
|
|
|
|
percent = 1;
|
2002-08-06 00:16:51 +02:00
|
|
|
|
else if (percent >= limit && top != bottom)
|
2002-08-04 19:06:10 +02:00
|
|
|
|
percent = limit - 1;
|
|
|
|
|
ix = sprintf (buffer, "%.*u%%", dp + 1, percent);
|
|
|
|
|
if (dp)
|
|
|
|
|
{
|
|
|
|
|
dp++;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
buffer[ix+1] = buffer[ix];
|
|
|
|
|
ix--;
|
|
|
|
|
}
|
|
|
|
|
while (dp--);
|
|
|
|
|
buffer[ix + 1] = '.';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-12-16 19:23:00 +01:00
|
|
|
|
sprintf (buffer, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT)top);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
/* Output summary info for a function. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
function_summary (const coverage_t *coverage, const char *title)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stdout, "%s `%s'\n", title, coverage->name);
|
|
|
|
|
|
|
|
|
|
if (coverage->lines)
|
|
|
|
|
fnotice (stdout, "Lines executed:%s of %d\n",
|
|
|
|
|
format_gcov (coverage->lines_executed, coverage->lines, 2),
|
|
|
|
|
coverage->lines);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
else
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stdout, "No executable lines");
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (flag_branches)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (coverage->branches)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stdout, "Branches executed:%s of %d\n",
|
|
|
|
|
format_gcov (coverage->branches_executed,
|
|
|
|
|
coverage->branches, 2),
|
|
|
|
|
coverage->branches);
|
|
|
|
|
fnotice (stdout, "Taken at least once:%s of %d\n",
|
|
|
|
|
format_gcov (coverage->branches_taken,
|
|
|
|
|
coverage->branches, 2),
|
|
|
|
|
coverage->branches);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stdout, "No branches\n");
|
|
|
|
|
if (coverage->calls)
|
|
|
|
|
fnotice (stdout, "Calls executed:%s of %d\n",
|
|
|
|
|
format_gcov (coverage->calls_executed, coverage->calls, 2),
|
|
|
|
|
coverage->calls);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
else
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stdout, "No calls\n");
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Generate an output file name. LONG_OUTPUT_NAMES and PRESERVE_PATHS
|
|
|
|
|
affect name generation. With preserve_paths we create a filename
|
|
|
|
|
from all path components of the source file, replacing '/' with
|
|
|
|
|
'#', without it we simply take the basename component. With
|
|
|
|
|
long_output_names we prepend the processed name of the input file
|
|
|
|
|
to each output name (except when the current source file is the
|
|
|
|
|
input file, so you don't get a double concatenation). The two
|
|
|
|
|
components are separated by '##'. Also '.' filename components are
|
2002-09-08 14:47:27 +02:00
|
|
|
|
removed and '..' components are renamed to '^'. */
|
2002-08-07 01:18:01 +02:00
|
|
|
|
|
|
|
|
|
static char *
|
2003-07-06 20:59:38 +02:00
|
|
|
|
make_gcov_file_name (const char *input_name, const char *src_name)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
|
|
|
|
char *cptr;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
char *name = xmalloc (strlen (src_name) + strlen (input_name) + 10);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
name[0] = 0;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (flag_long_names && strcmp (src_name, input_name))
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
|
|
|
|
/* Generate the input filename part. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
cptr = flag_preserve_paths ? NULL : strrchr (input_name, '/');
|
|
|
|
|
strcat (name, cptr ? cptr + 1 : input_name);
|
2002-08-07 01:18:01 +02:00
|
|
|
|
strcat (name, "##");
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-09-08 14:47:27 +02:00
|
|
|
|
/* Generate the source filename part. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
cptr = flag_preserve_paths ? NULL : strrchr (src_name, '/');
|
|
|
|
|
strcat (name, cptr ? cptr + 1 : src_name);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (flag_preserve_paths)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
|
|
|
|
/* Convert '/' to '#', remove '/./', convert '/../' to '/^/' */
|
|
|
|
|
char *prev;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
for (cptr = name; (cptr = strchr ((prev = cptr), '/'));)
|
2003-07-06 20:59:38 +02:00
|
|
|
|
{
|
|
|
|
|
unsigned shift = 0;
|
|
|
|
|
|
|
|
|
|
if (prev + 1 == cptr && prev[0] == '.')
|
|
|
|
|
{
|
|
|
|
|
/* Remove '.' */
|
|
|
|
|
shift = 2;
|
|
|
|
|
}
|
|
|
|
|
else if (prev + 2 == cptr && prev[0] == '.' && prev[1] == '.')
|
|
|
|
|
{
|
|
|
|
|
/* Convert '..' */
|
|
|
|
|
shift = 1;
|
|
|
|
|
prev[1] = '^';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
*cptr++ = '#';
|
|
|
|
|
if (shift)
|
|
|
|
|
{
|
|
|
|
|
cptr = prev;
|
|
|
|
|
do
|
|
|
|
|
prev[0] = prev[shift];
|
2002-08-07 01:18:01 +02:00
|
|
|
|
while (*prev++);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
strcat (name, ".gcov");
|
|
|
|
|
return name;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
/* Scan through the bb_data for each line in the block, increment
|
2002-08-07 01:18:01 +02:00
|
|
|
|
the line number execution count indicated by the execution count of
|
|
|
|
|
the appropriate basic block. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
add_line_counts (coverage_t *coverage, function_t *fn)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned ix;
|
2003-08-22 08:45:14 +02:00
|
|
|
|
line_t *line = NULL; /* This is propagated from one iteration to the
|
2002-12-16 19:23:00 +01:00
|
|
|
|
next. */
|
|
|
|
|
|
2003-01-18 23:32:06 +01:00
|
|
|
|
/* Scan each basic block. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (ix = 0; ix != fn->num_blocks; ix++)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
block_t *block = &fn->blocks[ix];
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned *encoding;
|
|
|
|
|
const source_t *src = NULL;
|
|
|
|
|
unsigned jx;
|
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (block->count && ix && ix + 1 != fn->num_blocks)
|
|
|
|
|
fn->blocks_executed++;
|
|
|
|
|
for (jx = 0, encoding = block->u.line.encoding;
|
|
|
|
|
jx != block->u.line.num; jx++, encoding++)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!*encoding)
|
|
|
|
|
{
|
|
|
|
|
unsigned src_n = *++encoding;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (src = sources; src->index != src_n; src = src->next)
|
|
|
|
|
continue;
|
|
|
|
|
jx++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
line = &src->lines[*encoding];
|
|
|
|
|
|
|
|
|
|
if (coverage)
|
|
|
|
|
{
|
|
|
|
|
if (!line->exists)
|
|
|
|
|
coverage->lines++;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (!line->count && block->count)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
coverage->lines_executed++;
|
|
|
|
|
}
|
|
|
|
|
line->exists = 1;
|
|
|
|
|
line->count += block->count;
|
|
|
|
|
}
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
free (block->u.line.encoding);
|
2003-04-06 15:18:41 +02:00
|
|
|
|
block->u.cycle.arc = NULL;
|
|
|
|
|
block->u.cycle.ident = ~0U;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (!ix || ix + 1 == fn->num_blocks)
|
|
|
|
|
/* Entry or exit block */;
|
|
|
|
|
else if (flag_all_blocks)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2003-04-06 15:18:41 +02:00
|
|
|
|
line_t *block_line = line ? line : &fn->src->lines[fn->line];
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
block->chain = block_line->u.blocks;
|
|
|
|
|
block_line->u.blocks = block;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
|
|
|
|
else if (flag_branches)
|
|
|
|
|
{
|
|
|
|
|
arc_t *arc;
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (arc = block->succ; arc; arc = arc->succ_next)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
arc->line_next = line->u.branches;
|
|
|
|
|
line->u.branches = arc;
|
|
|
|
|
if (coverage && !arc->is_unconditional)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
add_branch_counts (coverage, arc);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (!line)
|
|
|
|
|
fnotice (stderr, "%s:no lines for `%s'\n", bbg_file_name, fn->name);
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-18 23:32:06 +01:00
|
|
|
|
/* Accumulate the line counts of a file. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
accumulate_line_counts (source_t *src)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
|
|
|
|
line_t *line;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
function_t *fn, *fn_p, *fn_n;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned ix;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
|
|
|
|
|
/* Reverse the function order. */
|
|
|
|
|
for (fn = src->functions, fn_p = NULL; fn;
|
|
|
|
|
fn_p = fn, fn = fn_n)
|
|
|
|
|
{
|
|
|
|
|
fn_n = fn->line_next;
|
|
|
|
|
fn->line_next = fn_p;
|
|
|
|
|
}
|
|
|
|
|
src->functions = fn_p;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (ix = src->num_lines, line = src->lines; ix--; line++)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (!flag_all_blocks)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
arc_t *arc, *arc_p, *arc_n;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
/* Total and reverse the branch information. */
|
|
|
|
|
for (arc = line->u.branches, arc_p = NULL; arc;
|
|
|
|
|
arc_p = arc, arc = arc_n)
|
|
|
|
|
{
|
|
|
|
|
arc_n = arc->line_next;
|
|
|
|
|
arc->line_next = arc_p;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
add_branch_counts (&src->coverage, arc);
|
|
|
|
|
}
|
|
|
|
|
line->u.branches = arc_p;
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
else if (line->u.blocks)
|
|
|
|
|
{
|
|
|
|
|
/* The user expects the line count to be the number of times
|
|
|
|
|
a line has been executed. Simply summing the block count
|
|
|
|
|
will give an artificially high number. The Right Thing
|
2003-04-06 15:18:41 +02:00
|
|
|
|
is to sum the entry counts to the graph of blocks on this
|
|
|
|
|
line, then find the elementary cycles of the local graph
|
|
|
|
|
and add the transition counts of those cycles. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
block_t *block, *block_p, *block_n;
|
|
|
|
|
gcov_type count = 0;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-06-29 15:53:12 +02:00
|
|
|
|
/* Reverse the block information. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (block = line->u.blocks, block_p = NULL; block;
|
|
|
|
|
block_p = block, block = block_n)
|
|
|
|
|
{
|
|
|
|
|
block_n = block->chain;
|
|
|
|
|
block->chain = block_p;
|
2003-04-06 15:18:41 +02:00
|
|
|
|
block->u.cycle.ident = ix;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
|
|
|
|
line->u.blocks = block_p;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Sum the entry arcs. */
|
|
|
|
|
for (block = line->u.blocks; block; block = block->chain)
|
|
|
|
|
{
|
|
|
|
|
arc_t *arc;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
for (arc = block->pred; arc; arc = arc->pred_next)
|
|
|
|
|
{
|
|
|
|
|
if (arc->src->u.cycle.ident != ix)
|
|
|
|
|
count += arc->count;
|
|
|
|
|
if (flag_branches)
|
|
|
|
|
add_branch_counts (&src->coverage, arc);
|
|
|
|
|
}
|
2003-08-27 23:13:17 +02:00
|
|
|
|
|
|
|
|
|
/* Initialize the cs_count. */
|
|
|
|
|
for (arc = block->succ; arc; arc = arc->succ_next)
|
|
|
|
|
arc->cs_count = arc->count;
|
2003-04-06 15:18:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find the loops. This uses the algorithm described in
|
|
|
|
|
Tiernan 'An Efficient Search Algorithm to Find the
|
|
|
|
|
Elementary Circuits of a Graph', CACM Dec 1970. We hold
|
|
|
|
|
the P array by having each block point to the arc that
|
|
|
|
|
connects to the previous block. The H array is implicitly
|
|
|
|
|
held because of the arc ordering, and the block's
|
|
|
|
|
previous arc pointer.
|
|
|
|
|
|
|
|
|
|
Although the algorithm is O(N^3) for highly connected
|
|
|
|
|
graphs, at worst we'll have O(N^2), as most blocks have
|
|
|
|
|
only one or two exits. Most graphs will be small.
|
|
|
|
|
|
|
|
|
|
For each loop we find, locate the arc with the smallest
|
|
|
|
|
transition count, and add that to the cumulative
|
2003-08-27 23:13:17 +02:00
|
|
|
|
count. Decrease flow over the cycle and remove the arc
|
|
|
|
|
from consideration. */
|
2003-04-06 15:18:41 +02:00
|
|
|
|
for (block = line->u.blocks; block; block = block->chain)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
2003-04-06 15:18:41 +02:00
|
|
|
|
block_t *head = block;
|
|
|
|
|
arc_t *arc;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
next_vertex:;
|
|
|
|
|
arc = head->succ;
|
|
|
|
|
current_vertex:;
|
|
|
|
|
while (arc)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
2003-04-06 15:18:41 +02:00
|
|
|
|
block_t *dst = arc->dst;
|
|
|
|
|
if (/* Already used that arc. */
|
|
|
|
|
arc->cycle
|
|
|
|
|
/* Not to same graph, or before first vertex. */
|
|
|
|
|
|| dst->u.cycle.ident != ix
|
|
|
|
|
/* Already in path. */
|
|
|
|
|
|| dst->u.cycle.arc)
|
|
|
|
|
{
|
|
|
|
|
arc = arc->succ_next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
if (dst == block)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Found a closing arc. */
|
2003-08-27 23:13:17 +02:00
|
|
|
|
gcov_type cycle_count = arc->cs_count;
|
2003-04-06 15:18:41 +02:00
|
|
|
|
arc_t *cycle_arc = arc;
|
|
|
|
|
arc_t *probe_arc;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-06-23 17:27:37 +02:00
|
|
|
|
/* Locate the smallest arc count of the loop. */
|
2003-04-06 15:18:41 +02:00
|
|
|
|
for (dst = head; (probe_arc = dst->u.cycle.arc);
|
|
|
|
|
dst = probe_arc->src)
|
2003-08-27 23:13:17 +02:00
|
|
|
|
if (cycle_count > probe_arc->cs_count)
|
2003-04-06 15:18:41 +02:00
|
|
|
|
{
|
2003-08-27 23:13:17 +02:00
|
|
|
|
cycle_count = probe_arc->cs_count;
|
2003-04-06 15:18:41 +02:00
|
|
|
|
cycle_arc = probe_arc;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
count += cycle_count;
|
|
|
|
|
cycle_arc->cycle = 1;
|
2003-08-27 23:13:17 +02:00
|
|
|
|
|
|
|
|
|
/* Remove the flow from the cycle. */
|
|
|
|
|
arc->cs_count -= cycle_count;
|
|
|
|
|
for (dst = head; (probe_arc = dst->u.cycle.arc);
|
|
|
|
|
dst = probe_arc->src)
|
|
|
|
|
probe_arc->cs_count -= cycle_count;
|
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Unwind to the cyclic arc. */
|
|
|
|
|
while (head != cycle_arc->src)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
2003-04-06 15:18:41 +02:00
|
|
|
|
arc = head->u.cycle.arc;
|
2003-08-27 23:13:17 +02:00
|
|
|
|
head->u.cycle.arc = NULL;
|
2003-04-06 15:18:41 +02:00
|
|
|
|
head = arc->src;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Move on. */
|
|
|
|
|
arc = arc->succ_next;
|
|
|
|
|
continue;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Add new block to chain. */
|
|
|
|
|
dst->u.cycle.arc = arc;
|
|
|
|
|
head = dst;
|
|
|
|
|
goto next_vertex;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* We could not add another vertex to the path. Remove
|
|
|
|
|
the last vertex from the list. */
|
|
|
|
|
arc = head->u.cycle.arc;
|
|
|
|
|
if (arc)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
2003-06-23 17:27:37 +02:00
|
|
|
|
/* It was not the first vertex. Move onto next arc. */
|
2003-04-06 15:18:41 +02:00
|
|
|
|
head->u.cycle.arc = NULL;
|
|
|
|
|
head = arc->src;
|
|
|
|
|
arc = arc->succ_next;
|
|
|
|
|
goto current_vertex;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
2003-04-06 15:18:41 +02:00
|
|
|
|
/* Mark this block as unusable. */
|
|
|
|
|
block->u.cycle.ident = ~0U;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
2003-04-06 15:18:41 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
line->count = count;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (line->exists)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
src->coverage.lines++;
|
|
|
|
|
if (line->count)
|
|
|
|
|
src->coverage.lines_executed++;
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2003-06-12 21:01:08 +02:00
|
|
|
|
/* Ouput information about ARC number IX. Returns nonzero if
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
anything is output. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-07-06 20:59:38 +02:00
|
|
|
|
output_branch_count (FILE *gcov_file, int ix, const arc_t *arc)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (arc->is_call_non_return)
|
|
|
|
|
{
|
|
|
|
|
if (arc->src->count)
|
|
|
|
|
{
|
|
|
|
|
fnotice (gcov_file, "call %2d returned %s\n", ix,
|
|
|
|
|
format_gcov (arc->src->count - arc->count,
|
|
|
|
|
arc->src->count, -flag_counts));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fnotice (gcov_file, "call %2d never executed\n", ix);
|
|
|
|
|
}
|
|
|
|
|
else if (!arc->is_unconditional)
|
|
|
|
|
{
|
|
|
|
|
if (arc->src->count)
|
|
|
|
|
fnotice (gcov_file, "branch %2d taken %s%s\n", ix,
|
|
|
|
|
format_gcov (arc->count, arc->src->count, -flag_counts),
|
|
|
|
|
arc->fall_through ? " (fallthrough)" : "");
|
|
|
|
|
else
|
|
|
|
|
fnotice (gcov_file, "branch %2d never executed\n", ix);
|
|
|
|
|
}
|
2003-04-06 15:18:41 +02:00
|
|
|
|
else if (flag_unconditional && !arc->dst->is_call_return)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
{
|
|
|
|
|
if (arc->src->count)
|
|
|
|
|
fnotice (gcov_file, "unconditional %2d taken %s\n", ix,
|
|
|
|
|
format_gcov (arc->count, arc->src->count, -flag_counts));
|
|
|
|
|
else
|
|
|
|
|
fnotice (gcov_file, "unconditional %2d never executed\n", ix);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
return 1;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
/* Read in the source file one line at a time, and output that line to
|
|
|
|
|
the gcov file preceded by its execution count and other
|
|
|
|
|
information. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
static void
|
2003-07-06 20:59:38 +02:00
|
|
|
|
output_lines (FILE *gcov_file, const source_t *src)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
|
|
|
|
FILE *source_file;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
unsigned line_num; /* current line number. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
const line_t *line; /* current line info ptr. */
|
|
|
|
|
char string[STRING_SIZE]; /* line buffer. */
|
|
|
|
|
char const *retval = ""; /* status of source file reading. */
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
function_t *fn = src->functions;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
|
|
|
|
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:Data:%s\n", "-", 0, da_file_name);
|
Makefile.in (LIBGCC_DEPS): Add gcov headers.
* Makefile.in (LIBGCC_DEPS): Add gcov headers.
(libgcov.a): Depends on LIBGCC_DEPS.
* basic-block.h (profile_info): Moved here from coverage.h. Made
a pointer.
* coverage.c (struct function_list): Fixed array of counter types.
(struct counts_entry): Keyed by counter type, contains summary.
(profile_info): Moved to profile.c.
(prg_ctr_mask, prg_n_ctrs, fn_ctr_mask, fn_n_ctrs): New global
vars.
(profiler_label): Remove.
(ctr_labels): New.
(set_purpose, label_for_tag, build_counter_section_fields,
build_counter_section_value, build_counter_section_data_fields,
build_counter_section_data_values, build_function_info_fields,
build_function_info_value, gcov_info_fields, gcov_info_value): Remove.
(build_fn_info_type, build_fn_info_value, build_ctr_info_type,
build_ctr_info_value, build_gcov_info): New.
(htab_counts_entry_hash, htab_counts_entry_eq): Adjust.
(reads_counts_file): Adjust.
(get_coverage_counts): Takes counter number. Add summary
parameter. Adjust.
(coverage_counter_ref): Tkaes counter number. Adjust. Lazily
create counter array labels.
(coverage_end_function): Adjust.
(create_coverage): Adjust.
(find_counters_section): Remove.
* coverage.h (MAX_COUNTER_SECTIONS): Remove.
(struct section_info, struct profile_info): Remove.
(profile_info): Moved to basic-block.h.
(coverage_counter_ref): Takes a counter number.
(get_coverage_counts): Takes a counter number. Added summary
parameter.
(find_counters_section): Remove.
* gcov-dump.c (tag_arc_counts): Rename to ...
(tag_counters): ... here. Adjust.
(tag_table): Move tag_counters to 3rd entry. Remove
PROGRAM_PLACEHOLDER and PROGRAM_INCORRECT entries.
(dump_file): Check for counter tag values here.
(tag_summary): Adjust.
* gcov-io.c (gcov_write_summary, gcov_read_summary): Adjust.
* gcov-io.h (GCOV_LOCKED): New.
(GCOV_TAG_ARC_COUNTS): Rename to ...
(GCOV_TAG_COUNTS_BASE): ... here.
(GCOV_TAG_PLACEHOLDER_SUMMARY, GCOV_TAG_INCORRECT_SUMMARY):
Remove.
(GCOV_COUNTER_ARCS, GCOV_COUNTERS, GCOV_NAMES): New.
(GCOV_TAG_FOR_COUNTER, GCOV_COUNTER_FOR_TAG,
GCOV_TAG_IS_COUNTER): New.
(struct gcov_ctr_summary): New.
(struct gcov_summary): Adjust.
(struct gcov_counter_section): Remove.
struct gcov_counter_section_data): Remove.
(struct gcov_function_info): Rename to ...
(struct gcov_fn_info): ... here. Adjust.
(struct gcov_ctr_info): New.
(struct gcov_info): Adjust.
* gcov.c (read_count_file): Adjust.
(output_lines): Adjust.
* libgcov.c (gcov_exit): Adjust.
(__gcov_flush): Adjust.
* mklibgcc.in (libgcc2_c_dep): Add gcov headers.
* predict.c (maybe_hot_bb_p, probably_cold_bb_p,
probably_never_executed_bb_p, compute_frequency_function): Adjust
profile_info use.
* profile.c (struct counts_entry): Remove.
(profile_info): Define here.
(get_exec_counts): Adjust get_coverage_counts call.
(compute_branch_probablilities): Remove find_counters_section
call.
(gen_edge_profiler): Adjust coverage_counter_ref call.
* tracer.c (tail_duplicate): Adjust profile_info use.
From-SVN: r65990
2003-04-23 16:05:11 +02:00
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Runs:%u\n", "-", 0,
|
|
|
|
|
object_summary.ctrs[GCOV_COUNTER_ARCS].runs);
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Programs:%u\n", "-", 0, program_count);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
source_file = fopen (src->name, "r");
|
2002-08-07 01:18:01 +02:00
|
|
|
|
if (!source_file)
|
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stderr, "%s:cannot open source file\n", src->name);
|
2002-08-07 01:18:01 +02:00
|
|
|
|
retval = NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
struct stat status;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
if (!fstat (fileno (source_file), &status)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
&& status.st_mtime > bbg_file_time)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stderr, "%s:source file is newer than graph file `%s'\n",
|
|
|
|
|
src->name, bbg_file_name);
|
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Source is newer than graph\n",
|
2002-08-07 01:18:01 +02:00
|
|
|
|
"-", 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (line_num = 1, line = &src->lines[line_num];
|
|
|
|
|
line_num < src->num_lines; line_num++, line++)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (; fn && fn->line == line_num; fn = fn->line_next)
|
|
|
|
|
{
|
|
|
|
|
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;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fprintf (gcov_file, "function %s", fn->name);
|
|
|
|
|
fprintf (gcov_file, " called %s",
|
|
|
|
|
format_gcov (fn->blocks[0].count, 0, -1));
|
|
|
|
|
fprintf (gcov_file, " returned %s",
|
|
|
|
|
format_gcov (return_count, fn->blocks[0].count, 0));
|
|
|
|
|
fprintf (gcov_file, " blocks executed %s",
|
|
|
|
|
format_gcov (fn->blocks_executed, fn->num_blocks - 2, 0));
|
|
|
|
|
fprintf (gcov_file, "\n");
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
/* For lines which don't exist in the .bb file, print '-' before
|
2003-07-06 20:59:38 +02:00
|
|
|
|
the source line. For lines which exist but were never
|
|
|
|
|
executed, print '#####' before the source line. Otherwise,
|
|
|
|
|
print the execution count before the source line. There are
|
|
|
|
|
16 spaces of indentation added before the source line so that
|
|
|
|
|
tabs won't be messed up. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fprintf (gcov_file, "%9s:%5u:",
|
|
|
|
|
!line->exists ? "-" : !line->count ? "#####"
|
|
|
|
|
: format_gcov (line->count, 0, -1), line_num);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
if (retval)
|
|
|
|
|
{
|
|
|
|
|
/* Copy source line. */
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
retval = fgets (string, STRING_SIZE, source_file);
|
|
|
|
|
if (!retval)
|
2003-04-20 13:57:38 +02:00
|
|
|
|
break;
|
2002-08-07 01:18:01 +02:00
|
|
|
|
fputs (retval, gcov_file);
|
2002-08-04 19:06:10 +02:00
|
|
|
|
}
|
2002-08-07 01:18:01 +02:00
|
|
|
|
while (!retval[0] || retval[strlen (retval) - 1] != '\n');
|
|
|
|
|
}
|
|
|
|
|
if (!retval)
|
2003-04-20 13:57:38 +02:00
|
|
|
|
fputs ("/*EOF*/\n", gcov_file);
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
|
|
|
|
|
if (flag_all_blocks)
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
block_t *block;
|
2003-04-06 15:18:41 +02:00
|
|
|
|
arc_t *arc;
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
int ix, jx;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (ix = jx = 0, block = line->u.blocks; block;
|
|
|
|
|
block = block->chain)
|
2002-08-04 19:06:10 +02:00
|
|
|
|
{
|
2003-04-06 15:18:41 +02:00
|
|
|
|
if (!block->is_call_return)
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
fprintf (gcov_file, "%9s:%5u-block %2d\n",
|
|
|
|
|
!line->exists ? "-" : !block->count ? "$$$$$"
|
2003-04-06 15:18:41 +02:00
|
|
|
|
: format_gcov (block->count, 0, -1),
|
|
|
|
|
line_num, ix++);
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
if (flag_branches)
|
|
|
|
|
for (arc = block->succ; arc; arc = arc->succ_next)
|
|
|
|
|
jx += output_branch_count (gcov_file, jx, arc);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
else if (flag_branches)
|
|
|
|
|
{
|
|
|
|
|
int ix;
|
|
|
|
|
arc_t *arc;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
gcov.c: Add -a & -u options.
* 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.
From-SVN: r65090
2003-03-31 17:18:24 +02:00
|
|
|
|
for (ix = 0, arc = line->u.branches; arc; arc = arc->line_next)
|
|
|
|
|
ix += output_branch_count (gcov_file, ix, arc);
|
|
|
|
|
}
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
/* Handle all remaining source lines. There may be lines after the
|
|
|
|
|
last line of code. */
|
|
|
|
|
if (retval)
|
|
|
|
|
{
|
|
|
|
|
for (; (retval = fgets (string, STRING_SIZE, source_file)); line_num++)
|
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fprintf (gcov_file, "%9s:%5u:%s", "-", line_num, retval);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
while (!retval[0] || retval[strlen (retval) - 1] != '\n')
|
2002-08-04 19:06:10 +02:00
|
|
|
|
{
|
2002-08-07 01:18:01 +02:00
|
|
|
|
retval = fgets (string, STRING_SIZE, source_file);
|
|
|
|
|
if (!retval)
|
|
|
|
|
break;
|
|
|
|
|
fputs (retval, gcov_file);
|
2002-08-04 19:06:10 +02:00
|
|
|
|
}
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-07 01:18:01 +02:00
|
|
|
|
if (source_file)
|
|
|
|
|
fclose (source_file);
|
|
|
|
|
}
|