1997-03-28 23:43:13 +01:00
|
|
|
|
/* Gcov.c: prepend line execution counts and branch probabilities to a
|
|
|
|
|
source file.
|
2017-01-01 13:07:43 +01:00
|
|
|
|
Copyright (C) 1990-2017 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
|
2007-07-26 10:37:01 +02:00
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
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
|
2007-07-26 10:37:01 +02:00
|
|
|
|
along with Gcov; see the file COPYING3. If not see
|
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
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
|
|
|
|
/* 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"
|
2017-01-22 16:48:21 +01:00
|
|
|
|
#define INCLUDE_ALGORITHM
|
|
|
|
|
#define INCLUDE_VECTOR
|
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"
|
Makefile.in (LIBDEPS): Add libcommon.a.
* Makefile.in (LIBDEPS): Add libcommon.a.
(LIBS): Likewise.
(GCC_OBJS): Remove diagnostic.o, pretty-print.o and input.o.
(OBJS-common): Remove diagnostic.o, input.o, intl.o,
pretty-print.o and version.o.
(OBJS-libcommon): New.
(ALL_HOST_BACKEND_OBJS): Add $(OBJS-libcommon).
(BACKEND): Add libcommon.a.
(MOSTLYCLEANFILES): Likewise.
(libcommon.a): New.
(xgcc$(exeext)): Don't explicitly use version.o and intl.o.
(cpp$(exeext)): Likewise.
(COLLECT2_OBJS): Remove intl.o, version.o, diagnostic.o,
pretty-print.o and input.o.
(lto-wrapper$(exeext)): Don't explicitly use intl.o.
(lto-wrapper.o): Depend on $(DIAGNOSTIC_H).
(errors.o): Remove.
(mips-tfile): Don't explicitly use version.o.
(mips-tdump): Likewise.
(gcov.o): Depend on $(DIAGNOSTIC_H).
(gcov-dump.o): Depend on intl.h and $(DIAGNOSTIC_H).
(GCOV_OBJS): Remove intl.o, version.o and errors.o.
(GCOV_DUMP_OBJS): Remove version.o and errors.o.
* gcov-dump.c: Include intl.h and diagnostic.h.
(main): Initialize diagnostics.
* gcov.c: Include diagnostic.h.
(fnotice): Remove.
(main): Initialize diagnostics.
* lto-wrapper.c: Include diagnostic.h.
(main): Initialize diagnostics.
ada:
* gcc-interface/Make-lang.in (EXTRA_GNATBIND_OBJS): Remove
version.o.
* gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Use
libcommon.a instead of version.o.
cp:
* Make-lang.in (GXX_OBJS): Remove intl.o and version.o.
fortran:
* Make-lang.in (GFORTRAN_D_OBJS): Remove version.o and intl.o.
go:
* Make-lang.in (GCCGO_OBJS): Remove intl.o and version.o.
java:
* Make-lang.in ($(XGCJ)$(exeext)): Don't explicitly use intl.o and
version.o.
(JCFDUMP_OBJS): Remove errors.o, version.o and intl.o.
(JVGENMAIN_OBJS): Remove errors.o and intl.o.
(java/jcf-dump.o, java/jvgenmain.o): Depend in $(DIAGNOSTIC_H).
* jcf-dump.c: Include diagnostic.h.
(main): Initialize diagnostics.
* jvgenmain.c: Include diagnostic.h.
(main): Initialize diagnostics.
From-SVN: r173958
2011-05-20 17:19:05 +02:00
|
|
|
|
#include "diagnostic.h"
|
2001-11-01 22:48:49 +01:00
|
|
|
|
#include "version.h"
|
2013-06-20 07:20:09 +02:00
|
|
|
|
#include "demangle.h"
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2001-11-01 22:48:49 +01:00
|
|
|
|
#include <getopt.h>
|
|
|
|
|
|
2016-08-16 16:14:18 +02:00
|
|
|
|
#include "md5.h"
|
2016-08-05 15:50:49 +02:00
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
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
|
|
|
|
|
2007-06-12 17:39:15 +02:00
|
|
|
|
/* The gcno file is generated by -ftest-coverage option. The gcda file is
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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
|
|
|
|
|
2011-04-29 02:19:35 +02:00
|
|
|
|
/* The code validates that the profile information read in corresponds
|
|
|
|
|
to the code currently being compiled. Rather than checking for
|
2012-07-23 11:24:21 +02:00
|
|
|
|
identical files, the code below compares a checksum on the CFG
|
2011-04-29 02:19:35 +02:00
|
|
|
|
(based on the order of basic blocks and the arcs in the CFG). If
|
2012-07-23 11:24:21 +02:00
|
|
|
|
the CFG checksum in the gcda file match the CFG checksum in the
|
|
|
|
|
gcno file, the profile data will be used. */
|
2011-04-29 02:19:35 +02:00
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
/* This is the size of the buffer used to read in source file lines. */
|
|
|
|
|
|
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;
|
|
|
|
|
|
2011-12-02 21:32:40 +01:00
|
|
|
|
/* Arc to a catch handler. */
|
|
|
|
|
unsigned int is_throw : 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;
|
|
|
|
|
|
2008-06-06 07:42:00 +02:00
|
|
|
|
/* Arc is for catch/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
|
|
|
|
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;
|
2011-12-02 21:32:40 +01:00
|
|
|
|
unsigned flags : 12;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
unsigned count_valid : 1;
|
|
|
|
|
unsigned valid_chain : 1;
|
|
|
|
|
unsigned invalid_chain : 1;
|
2011-12-02 21:32:40 +01:00
|
|
|
|
unsigned exceptional : 1;
|
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 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;
|
2013-06-20 07:20:09 +02:00
|
|
|
|
char *demangled_name;
|
2003-04-24 11:46:17 +02:00
|
|
|
|
unsigned ident;
|
2011-04-29 02:19:35 +02:00
|
|
|
|
unsigned lineno_checksum;
|
|
|
|
|
unsigned cfg_checksum;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2011-12-02 21:32:40 +01:00
|
|
|
|
/* The graph contains at least one fake incoming edge. */
|
|
|
|
|
unsigned has_catch : 1;
|
|
|
|
|
|
2012-07-23 11:24:21 +02:00
|
|
|
|
/* Array of basic blocks. Like in GCC, the entry block is
|
|
|
|
|
at blocks[0] and the exit block is at blocks[1]. */
|
|
|
|
|
#define ENTRY_BLOCK (0)
|
|
|
|
|
#define EXIT_BLOCK (1)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
/* First line number & 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
|
|
|
|
unsigned line;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
unsigned 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
|
|
|
|
|
|
|
|
|
/* Next function in same source file. */
|
2016-08-05 15:50:02 +02:00
|
|
|
|
struct function_info *next_file_fn;
|
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
|
|
|
|
|
{
|
2016-08-05 15:50:49 +02:00
|
|
|
|
/* Return true when NEEDLE is one of basic blocks the line belongs to. */
|
|
|
|
|
bool has_block (block_t *needle);
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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;
|
2011-12-02 21:32:40 +01:00
|
|
|
|
unsigned unexceptional : 1;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
} line_t;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2016-08-05 15:50:49 +02:00
|
|
|
|
bool
|
|
|
|
|
line_t::has_block (block_t *needle)
|
|
|
|
|
{
|
|
|
|
|
for (block_t *n = u.blocks; n; n = n->chain)
|
|
|
|
|
if (n == needle)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Canonical name of source file. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
char *name;
|
2007-06-12 17:39:15 +02:00
|
|
|
|
time_t file_time;
|
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;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
} source_t;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
typedef struct name_map
|
|
|
|
|
{
|
|
|
|
|
char *name; /* Source file name */
|
|
|
|
|
unsigned src; /* Source file */
|
|
|
|
|
} name_map_t;
|
|
|
|
|
|
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;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
static function_t **fn_end = &functions;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
static source_t *sources; /* Array of source files */
|
|
|
|
|
static unsigned n_sources; /* Number of sources */
|
|
|
|
|
static unsigned a_sources; /* Allocated sources */
|
2007-06-12 17:39:15 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
static name_map_t *names; /* Mapping of file names to sources */
|
|
|
|
|
static unsigned n_names; /* Number of names */
|
|
|
|
|
static unsigned a_names; /* Allocated names */
|
|
|
|
|
|
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. */
|
|
|
|
|
|
2011-11-07 19:14:46 +01:00
|
|
|
|
static unsigned object_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
|
|
|
|
static unsigned program_count;
|
|
|
|
|
|
2011-12-30 19:22:16 +01:00
|
|
|
|
static unsigned total_lines;
|
|
|
|
|
static unsigned total_executed;
|
|
|
|
|
|
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
|
|
|
|
|
2012-07-23 13:59:15 +02:00
|
|
|
|
/* Name of the notes (gcno) output file. The "bbg" prefix is for
|
|
|
|
|
historical reasons, when the notes file contained only the
|
|
|
|
|
basic block graph notes. */
|
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;
|
|
|
|
|
|
2012-07-23 13:59:15 +02:00
|
|
|
|
/* Name and file pointer of the input file for the count data (gcda). */
|
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
|
|
|
|
|
2006-08-09 21:09:06 +02:00
|
|
|
|
/* Data file is missing. */
|
|
|
|
|
|
|
|
|
|
static int no_data_file;
|
|
|
|
|
|
2007-06-12 17:39:15 +02:00
|
|
|
|
/* If there is several input files, compute and display results after
|
|
|
|
|
reading all data files. This way if two or more gcda file refer to
|
|
|
|
|
the same source file (eg inline subprograms in a .h file), the
|
|
|
|
|
counts are added. */
|
|
|
|
|
|
|
|
|
|
static int multiple_files = 0;
|
|
|
|
|
|
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
|
|
|
|
|
2010-08-05 17:21:13 +02:00
|
|
|
|
/* Output progress indication if this is true. This is off by default
|
|
|
|
|
and can be turned on by the -d option. */
|
|
|
|
|
|
|
|
|
|
static int flag_display_progress = 0;
|
|
|
|
|
|
2013-06-20 07:20:09 +02:00
|
|
|
|
/* Output *.gcov file in intermediate format used by 'lcov'. */
|
|
|
|
|
|
|
|
|
|
static int flag_intermediate_format = 0;
|
|
|
|
|
|
|
|
|
|
/* Output demangled function names. */
|
|
|
|
|
|
|
|
|
|
static int flag_demangled_names = 0;
|
|
|
|
|
|
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
|
|
|
|
|
2016-08-16 16:14:18 +02:00
|
|
|
|
/* For situations when a long name can potentially hit filesystem path limit,
|
|
|
|
|
let's calculate md5sum of the path and append it to a file name. */
|
|
|
|
|
|
|
|
|
|
static int flag_hash_filenames = 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
|
|
|
|
/* 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;
|
|
|
|
|
|
2011-11-13 11:26:23 +01:00
|
|
|
|
/* Source directory prefix. This is removed from source pathnames
|
|
|
|
|
that match, when generating the output file name. */
|
|
|
|
|
|
|
|
|
|
static char *source_prefix = 0;
|
|
|
|
|
static size_t source_length = 0;
|
|
|
|
|
|
|
|
|
|
/* Only show data for sources with relative pathnames. Absolute ones
|
|
|
|
|
usually indicate a system header file, which although it may
|
|
|
|
|
contain inline functions, is usually uninteresting. */
|
|
|
|
|
static int flag_relative_only = 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 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 *);
|
2007-06-12 17:39:15 +02:00
|
|
|
|
static void generate_results (const char *);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
static void create_file_names (const char *);
|
2011-11-12 12:35:42 +01:00
|
|
|
|
static int name_search (const void *, const void *);
|
|
|
|
|
static int name_sort (const void *, const void *);
|
|
|
|
|
static char *canonicalize_name (const char *);
|
2011-11-10 20:17:13 +01:00
|
|
|
|
static unsigned find_source (const char *);
|
|
|
|
|
static function_t *read_graph_file (void);
|
|
|
|
|
static int read_count_file (function_t *);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
static void solve_flow_graph (function_t *);
|
2011-12-02 21:32:40 +01:00
|
|
|
|
static void find_exception_blocks (function_t *);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
static void add_branch_counts (coverage_t *, const arc_t *);
|
|
|
|
|
static void add_line_counts (coverage_t *, function_t *);
|
2011-12-30 19:22:16 +01:00
|
|
|
|
static void executed_summary (unsigned, unsigned);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
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 *);
|
alloc-pool.c, [...]: Add missing whitespace before "(".
gcc/
* alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
gimple.h, godump.c, graphite-clast-to-gimple.c,
graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
whitespace before "(".
From-SVN: r203004
2013-09-28 10:42:34 +02:00
|
|
|
|
static void output_gcov_file (const char *, source_t *);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
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 *);
|
2011-11-12 12:35:42 +01:00
|
|
|
|
static char *mangle_name (const char *, char *);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
static void release_structures (void);
|
2011-11-07 19:14:46 +01:00
|
|
|
|
static void release_function (function_t *);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
extern int main (int, char **);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2016-08-05 15:50:49 +02:00
|
|
|
|
/* Cycle detection!
|
|
|
|
|
There are a bajillion algorithms that do this. Boost's function is named
|
|
|
|
|
hawick_cycles, so I used the algorithm by K. A. Hawick and H. A. James in
|
|
|
|
|
"Enumerating Circuits and Loops in Graphs with Self-Arcs and Multiple-Arcs"
|
|
|
|
|
(url at <http://complexity.massey.ac.nz/cstn/013/cstn-013.pdf>).
|
|
|
|
|
|
|
|
|
|
The basic algorithm is simple: effectively, we're finding all simple paths
|
|
|
|
|
in a subgraph (that shrinks every iteration). Duplicates are filtered by
|
|
|
|
|
"blocking" a path when a node is added to the path (this also prevents non-
|
|
|
|
|
simple paths)--the node is unblocked only when it participates in a cycle.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
typedef vector<arc_t *> arc_vector_t;
|
|
|
|
|
typedef vector<const block_t *> block_vector_t;
|
|
|
|
|
|
|
|
|
|
/* Enum with types of loop in CFG. */
|
|
|
|
|
|
|
|
|
|
enum loop_type
|
|
|
|
|
{
|
|
|
|
|
NO_LOOP = 0,
|
|
|
|
|
LOOP = 1,
|
|
|
|
|
NEGATIVE_LOOP = 3
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Loop_type operator that merges two values: A and B. */
|
|
|
|
|
|
|
|
|
|
inline loop_type& operator |= (loop_type& a, loop_type b)
|
|
|
|
|
{
|
|
|
|
|
return a = static_cast<loop_type> (a | b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle cycle identified by EDGES, where the function finds minimum cs_count
|
|
|
|
|
and subtract the value from all counts. The subtracted value is added
|
|
|
|
|
to COUNT. Returns type of loop. */
|
|
|
|
|
|
|
|
|
|
static loop_type
|
|
|
|
|
handle_cycle (const arc_vector_t &edges, int64_t &count)
|
|
|
|
|
{
|
|
|
|
|
/* Find the minimum edge of the cycle, and reduce all nodes in the cycle by
|
|
|
|
|
that amount. */
|
2016-08-06 12:30:49 +02:00
|
|
|
|
int64_t cycle_count = INTTYPE_MAXIMUM (int64_t);
|
2016-08-05 15:50:49 +02:00
|
|
|
|
for (unsigned i = 0; i < edges.size (); i++)
|
|
|
|
|
{
|
|
|
|
|
int64_t ecount = edges[i]->cs_count;
|
|
|
|
|
if (cycle_count > ecount)
|
|
|
|
|
cycle_count = ecount;
|
|
|
|
|
}
|
|
|
|
|
count += cycle_count;
|
|
|
|
|
for (unsigned i = 0; i < edges.size (); i++)
|
|
|
|
|
edges[i]->cs_count -= cycle_count;
|
|
|
|
|
|
|
|
|
|
return cycle_count < 0 ? NEGATIVE_LOOP : LOOP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Unblock a block U from BLOCKED. Apart from that, iterate all blocks
|
|
|
|
|
blocked by U in BLOCK_LISTS. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
unblock (const block_t *u, block_vector_t &blocked,
|
|
|
|
|
vector<block_vector_t > &block_lists)
|
|
|
|
|
{
|
|
|
|
|
block_vector_t::iterator it = find (blocked.begin (), blocked.end (), u);
|
|
|
|
|
if (it == blocked.end ())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
unsigned index = it - blocked.begin ();
|
|
|
|
|
blocked.erase (it);
|
|
|
|
|
|
2017-08-01 16:49:54 +02:00
|
|
|
|
block_vector_t to_unblock (block_lists[index]);
|
2016-08-05 15:50:49 +02:00
|
|
|
|
|
|
|
|
|
block_lists.erase (block_lists.begin () + index);
|
2017-08-01 16:49:54 +02:00
|
|
|
|
|
|
|
|
|
for (block_vector_t::iterator it = to_unblock.begin ();
|
|
|
|
|
it != to_unblock.end (); it++)
|
|
|
|
|
unblock (*it, blocked, block_lists);
|
2016-08-05 15:50:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find circuit going to block V, PATH is provisional seen cycle.
|
|
|
|
|
BLOCKED is vector of blocked vertices, BLOCK_LISTS contains vertices
|
|
|
|
|
blocked by a block. COUNT is accumulated count of the current LINE.
|
|
|
|
|
Returns what type of loop it contains. */
|
|
|
|
|
|
|
|
|
|
static loop_type
|
|
|
|
|
circuit (block_t *v, arc_vector_t &path, block_t *start,
|
|
|
|
|
block_vector_t &blocked, vector<block_vector_t> &block_lists,
|
|
|
|
|
line_t &linfo, int64_t &count)
|
|
|
|
|
{
|
|
|
|
|
loop_type result = NO_LOOP;
|
|
|
|
|
|
|
|
|
|
/* Add v to the block list. */
|
|
|
|
|
gcc_assert (find (blocked.begin (), blocked.end (), v) == blocked.end ());
|
|
|
|
|
blocked.push_back (v);
|
|
|
|
|
block_lists.push_back (block_vector_t ());
|
|
|
|
|
|
|
|
|
|
for (arc_t *arc = v->succ; arc; arc = arc->succ_next)
|
|
|
|
|
{
|
|
|
|
|
block_t *w = arc->dst;
|
|
|
|
|
if (w < start || !linfo.has_block (w))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
path.push_back (arc);
|
|
|
|
|
if (w == start)
|
|
|
|
|
/* Cycle has been found. */
|
|
|
|
|
result |= handle_cycle (path, count);
|
|
|
|
|
else if (find (blocked.begin (), blocked.end (), w) == blocked.end ())
|
|
|
|
|
result |= circuit (w, path, start, blocked, block_lists, linfo, count);
|
|
|
|
|
|
|
|
|
|
path.pop_back ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result != NO_LOOP)
|
|
|
|
|
unblock (v, blocked, block_lists);
|
|
|
|
|
else
|
|
|
|
|
for (arc_t *arc = v->succ; arc; arc = arc->succ_next)
|
|
|
|
|
{
|
|
|
|
|
block_t *w = arc->dst;
|
|
|
|
|
if (w < start || !linfo.has_block (w))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
size_t index
|
|
|
|
|
= find (blocked.begin (), blocked.end (), w) - blocked.begin ();
|
|
|
|
|
gcc_assert (index < blocked.size ());
|
|
|
|
|
block_vector_t &list = block_lists[index];
|
|
|
|
|
if (find (list.begin (), list.end (), v) == list.end ())
|
|
|
|
|
list.push_back (v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find cycles for a LINFO. If HANDLE_NEGATIVE_CYCLES is set and the line
|
|
|
|
|
contains a negative loop, then perform the same function once again. */
|
|
|
|
|
|
|
|
|
|
static gcov_type
|
|
|
|
|
get_cycles_count (line_t &linfo, bool handle_negative_cycles = true)
|
|
|
|
|
{
|
|
|
|
|
/* Note that this algorithm works even if blocks aren't in sorted order.
|
|
|
|
|
Each iteration of the circuit detection is completely independent
|
|
|
|
|
(except for reducing counts, but that shouldn't matter anyways).
|
|
|
|
|
Therefore, operating on a permuted order (i.e., non-sorted) only
|
|
|
|
|
has the effect of permuting the output cycles. */
|
|
|
|
|
|
|
|
|
|
loop_type result = NO_LOOP;
|
|
|
|
|
gcov_type count = 0;
|
|
|
|
|
for (block_t *block = linfo.u.blocks; block; block = block->chain)
|
|
|
|
|
{
|
|
|
|
|
arc_vector_t path;
|
|
|
|
|
block_vector_t blocked;
|
|
|
|
|
vector<block_vector_t > block_lists;
|
|
|
|
|
result |= circuit (block, path, block, blocked, block_lists, linfo,
|
|
|
|
|
count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we have a negative cycle, repeat the find_cycles routine. */
|
|
|
|
|
if (result == NEGATIVE_LOOP && handle_negative_cycles)
|
|
|
|
|
count += get_cycles_count (linfo, false);
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
2010-08-05 17:21:13 +02:00
|
|
|
|
int first_arg;
|
Makefile.in (LIBDEPS): Add libcommon.a.
* Makefile.in (LIBDEPS): Add libcommon.a.
(LIBS): Likewise.
(GCC_OBJS): Remove diagnostic.o, pretty-print.o and input.o.
(OBJS-common): Remove diagnostic.o, input.o, intl.o,
pretty-print.o and version.o.
(OBJS-libcommon): New.
(ALL_HOST_BACKEND_OBJS): Add $(OBJS-libcommon).
(BACKEND): Add libcommon.a.
(MOSTLYCLEANFILES): Likewise.
(libcommon.a): New.
(xgcc$(exeext)): Don't explicitly use version.o and intl.o.
(cpp$(exeext)): Likewise.
(COLLECT2_OBJS): Remove intl.o, version.o, diagnostic.o,
pretty-print.o and input.o.
(lto-wrapper$(exeext)): Don't explicitly use intl.o.
(lto-wrapper.o): Depend on $(DIAGNOSTIC_H).
(errors.o): Remove.
(mips-tfile): Don't explicitly use version.o.
(mips-tdump): Likewise.
(gcov.o): Depend on $(DIAGNOSTIC_H).
(gcov-dump.o): Depend on intl.h and $(DIAGNOSTIC_H).
(GCOV_OBJS): Remove intl.o, version.o and errors.o.
(GCOV_DUMP_OBJS): Remove version.o and errors.o.
* gcov-dump.c: Include intl.h and diagnostic.h.
(main): Initialize diagnostics.
* gcov.c: Include diagnostic.h.
(fnotice): Remove.
(main): Initialize diagnostics.
* lto-wrapper.c: Include diagnostic.h.
(main): Initialize diagnostics.
ada:
* gcc-interface/Make-lang.in (EXTRA_GNATBIND_OBJS): Remove
version.o.
* gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Use
libcommon.a instead of version.o.
cp:
* Make-lang.in (GXX_OBJS): Remove intl.o and version.o.
fortran:
* Make-lang.in (GFORTRAN_D_OBJS): Remove version.o and intl.o.
go:
* Make-lang.in (GCCGO_OBJS): Remove intl.o and version.o.
java:
* Make-lang.in ($(XGCJ)$(exeext)): Don't explicitly use intl.o and
version.o.
(JCFDUMP_OBJS): Remove errors.o, version.o and intl.o.
(JVGENMAIN_OBJS): Remove errors.o and intl.o.
(java/jcf-dump.o, java/jvgenmain.o): Depend in $(DIAGNOSTIC_H).
* jcf-dump.c: Include diagnostic.h.
(main): Initialize diagnostics.
* jvgenmain.c: Include diagnostic.h.
(main): Initialize diagnostics.
From-SVN: r173958
2011-05-20 17:19:05 +02:00
|
|
|
|
const char *p;
|
|
|
|
|
|
|
|
|
|
p = argv[0] + strlen (argv[0]);
|
|
|
|
|
while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
|
|
|
|
|
--p;
|
|
|
|
|
progname = p;
|
|
|
|
|
|
|
|
|
|
xmalloc_set_program_name (progname);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2005-04-25 00:11:55 +02:00
|
|
|
|
/* Unlock the stdio streams. */
|
collect2.c, [...]: Replace calls to `unlock_stream' with `unlock_std_streams'.
* collect2.c, gcc.c, gcov-dump.c, gcov.c, gen-protos.c,
gensupport.c, protoize.c, toplev.c: Replace calls to
`unlock_stream' with `unlock_std_streams'.
java:
* gjavah.c, jcf-dump.c, jv-scan.c, jvgenmain.c: Replace calls
to `unlock_stream' with `unlock_std_streams'.
From-SVN: r98753
2005-04-26 02:24:02 +02:00
|
|
|
|
unlock_std_streams ();
|
2005-04-25 00:11:55 +02:00
|
|
|
|
|
2001-10-19 17:17:39 +02:00
|
|
|
|
gcc_init_libintl ();
|
1999-01-27 02:43:17 +01:00
|
|
|
|
|
Makefile.in (LIBDEPS): Add libcommon.a.
* Makefile.in (LIBDEPS): Add libcommon.a.
(LIBS): Likewise.
(GCC_OBJS): Remove diagnostic.o, pretty-print.o and input.o.
(OBJS-common): Remove diagnostic.o, input.o, intl.o,
pretty-print.o and version.o.
(OBJS-libcommon): New.
(ALL_HOST_BACKEND_OBJS): Add $(OBJS-libcommon).
(BACKEND): Add libcommon.a.
(MOSTLYCLEANFILES): Likewise.
(libcommon.a): New.
(xgcc$(exeext)): Don't explicitly use version.o and intl.o.
(cpp$(exeext)): Likewise.
(COLLECT2_OBJS): Remove intl.o, version.o, diagnostic.o,
pretty-print.o and input.o.
(lto-wrapper$(exeext)): Don't explicitly use intl.o.
(lto-wrapper.o): Depend on $(DIAGNOSTIC_H).
(errors.o): Remove.
(mips-tfile): Don't explicitly use version.o.
(mips-tdump): Likewise.
(gcov.o): Depend on $(DIAGNOSTIC_H).
(gcov-dump.o): Depend on intl.h and $(DIAGNOSTIC_H).
(GCOV_OBJS): Remove intl.o, version.o and errors.o.
(GCOV_DUMP_OBJS): Remove version.o and errors.o.
* gcov-dump.c: Include intl.h and diagnostic.h.
(main): Initialize diagnostics.
* gcov.c: Include diagnostic.h.
(fnotice): Remove.
(main): Initialize diagnostics.
* lto-wrapper.c: Include diagnostic.h.
(main): Initialize diagnostics.
ada:
* gcc-interface/Make-lang.in (EXTRA_GNATBIND_OBJS): Remove
version.o.
* gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Use
libcommon.a instead of version.o.
cp:
* Make-lang.in (GXX_OBJS): Remove intl.o and version.o.
fortran:
* Make-lang.in (GFORTRAN_D_OBJS): Remove version.o and intl.o.
go:
* Make-lang.in (GCCGO_OBJS): Remove intl.o and version.o.
java:
* Make-lang.in ($(XGCJ)$(exeext)): Don't explicitly use intl.o and
version.o.
(JCFDUMP_OBJS): Remove errors.o, version.o and intl.o.
(JVGENMAIN_OBJS): Remove errors.o and intl.o.
(java/jcf-dump.o, java/jvgenmain.o): Depend in $(DIAGNOSTIC_H).
* jcf-dump.c: Include diagnostic.h.
(main): Initialize diagnostics.
* jvgenmain.c: Include diagnostic.h.
(main): Initialize diagnostics.
From-SVN: r173958
2011-05-20 17:19:05 +02:00
|
|
|
|
diagnostic_initialize (global_dc, 0);
|
|
|
|
|
|
2008-08-29 12:07:23 +02:00
|
|
|
|
/* Handle response files. */
|
|
|
|
|
expandargv (&argc, &argv);
|
|
|
|
|
|
2011-11-26 22:44:24 +01:00
|
|
|
|
a_names = 10;
|
|
|
|
|
names = XNEWVEC (name_map_t, a_names);
|
|
|
|
|
a_sources = 10;
|
|
|
|
|
sources = XNEWVEC (source_t, a_sources);
|
2016-08-04 17:05:35 +02: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
|
|
|
|
|
2007-06-12 17:39:15 +02:00
|
|
|
|
if (argc - argno > 1)
|
|
|
|
|
multiple_files = 1;
|
|
|
|
|
|
2010-08-05 17:21:13 +02:00
|
|
|
|
first_arg = argno;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
for (; argno != argc; argno++)
|
2010-08-05 17:21:13 +02:00
|
|
|
|
{
|
|
|
|
|
if (flag_display_progress)
|
2016-08-04 17:05:35 +02:00
|
|
|
|
printf ("Processing file %d out of %d\n", argno - first_arg + 1,
|
|
|
|
|
argc - first_arg);
|
2010-08-05 17:21:13 +02:00
|
|
|
|
process_file (argv[argno]);
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2007-06-12 17:39:15 +02:00
|
|
|
|
generate_results (multiple_files ? NULL : argv[argc - 1]);
|
|
|
|
|
|
|
|
|
|
release_structures ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
1997-03-28 23:43:13 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
2017-04-10 13:37:14 +02:00
|
|
|
|
fnotice (file, "Usage: gcov [OPTION...] SOURCE|OBJ...\n\n");
|
2001-11-01 22:48:49 +01:00
|
|
|
|
fnotice (file, "Print code coverage information.\n\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");
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fnotice (file, " -c, --branch-counts Output counts of branches taken\n\
|
2001-11-01 22:48:49 +01:00
|
|
|
|
rather than percentages\n");
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fnotice (file, " -d, --display-progress Display progress information\n");
|
|
|
|
|
fnotice (file, " -f, --function-summaries Output summaries for each function\n");
|
2017-06-22 13:37:38 +02:00
|
|
|
|
fnotice (file, " -h, --help Print this help, then exit\n");
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fnotice (file, " -i, --intermediate-format Output .gcov file in intermediate text format\n");
|
2001-11-01 22:48:49 +01:00
|
|
|
|
fnotice (file, " -l, --long-file-names Use long output file names for included\n\
|
|
|
|
|
source files\n");
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fnotice (file, " -m, --demangled-names Output demangled function names\n");
|
|
|
|
|
fnotice (file, " -n, --no-output Do not create an output file\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");
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fnotice (file, " -r, --relative-only Only show data for relative sources\n");
|
|
|
|
|
fnotice (file, " -s, --source-prefix DIR Source prefix to elide\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");
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fnotice (file, " -v, --version Print version number, then exit\n");
|
2016-08-16 16:14:18 +02:00
|
|
|
|
fnotice (file, " -x, --hash-filenames Hash long pathnames\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
|
|
|
|
{
|
2007-08-21 17:35:30 +02:00
|
|
|
|
fnotice (stdout, "gcov %s%s\n", pkgversion_string, version_string);
|
2017-01-01 12:31:28 +01:00
|
|
|
|
fprintf (stdout, "Copyright %s 2017 Free Software Foundation, Inc.\n",
|
2004-02-20 07:46:42 +01:00
|
|
|
|
_("(C)"));
|
2001-11-01 22:48:49 +01:00
|
|
|
|
fnotice (stdout,
|
2004-02-20 07:46:42 +01: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' },
|
2013-06-20 07:20:09 +02:00
|
|
|
|
{ "intermediate-format", no_argument, NULL, 'i' },
|
2001-11-01 22:48:49 +01:00
|
|
|
|
{ "no-output", no_argument, NULL, 'n' },
|
|
|
|
|
{ "long-file-names", no_argument, NULL, 'l' },
|
|
|
|
|
{ "function-summaries", no_argument, NULL, 'f' },
|
2013-06-20 07:20:09 +02:00
|
|
|
|
{ "demangled-names", no_argument, NULL, 'm' },
|
2002-08-04 19:06:10 +02:00
|
|
|
|
{ "preserve-paths", no_argument, NULL, 'p' },
|
2011-11-13 11:26:23 +01:00
|
|
|
|
{ "relative-only", no_argument, NULL, 'r' },
|
2002-08-04 19:06:10 +02:00
|
|
|
|
{ "object-directory", required_argument, NULL, 'o' },
|
|
|
|
|
{ "object-file", required_argument, NULL, 'o' },
|
2011-11-13 11:26:23 +01:00
|
|
|
|
{ "source-prefix", required_argument, NULL, 's' },
|
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' },
|
2010-08-05 17:21:13 +02:00
|
|
|
|
{ "display-progress", no_argument, NULL, 'd' },
|
2016-08-16 16:14:18 +02:00
|
|
|
|
{ "hash-filenames", no_argument, NULL, 'x' },
|
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
|
|
|
|
|
2016-08-16 16:14:18 +02:00
|
|
|
|
const char *opts = "abcdfhilmno:prs:uvx";
|
|
|
|
|
while ((opt = getopt_long (argc, argv, opts, 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;
|
2013-06-20 07:20:09 +02:00
|
|
|
|
case 'm':
|
|
|
|
|
flag_demangled_names = 1;
|
|
|
|
|
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;
|
2011-11-13 11:26:23 +01:00
|
|
|
|
case 's':
|
|
|
|
|
source_prefix = optarg;
|
|
|
|
|
source_length = strlen (source_prefix);
|
|
|
|
|
break;
|
|
|
|
|
case 'r':
|
|
|
|
|
flag_relative_only = 1;
|
|
|
|
|
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;
|
2013-06-20 07:20:09 +02:00
|
|
|
|
case 'i':
|
|
|
|
|
flag_intermediate_format = 1;
|
|
|
|
|
flag_gcov_file = 1;
|
|
|
|
|
break;
|
2010-08-05 17:21:13 +02:00
|
|
|
|
case 'd':
|
|
|
|
|
flag_display_progress = 1;
|
|
|
|
|
break;
|
2016-08-16 16:14:18 +02:00
|
|
|
|
case 'x':
|
|
|
|
|
flag_hash_filenames = 1;
|
|
|
|
|
break;
|
2017-03-07 15:13:10 +01:00
|
|
|
|
case 'v':
|
|
|
|
|
print_version ();
|
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
|
|
|
|
/* 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;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-20 07:20:09 +02:00
|
|
|
|
/* Output the result in intermediate format used by 'lcov'.
|
|
|
|
|
|
|
|
|
|
The intermediate format contains a single file named 'foo.cc.gcov',
|
|
|
|
|
with no source code included. A sample output is
|
|
|
|
|
|
|
|
|
|
file:foo.cc
|
|
|
|
|
function:5,1,_Z3foov
|
|
|
|
|
function:13,1,main
|
|
|
|
|
function:19,1,_GLOBAL__sub_I__Z3foov
|
|
|
|
|
function:19,1,_Z41__static_initialization_and_destruction_0ii
|
|
|
|
|
lcount:5,1
|
|
|
|
|
lcount:7,9
|
|
|
|
|
lcount:9,8
|
|
|
|
|
lcount:11,1
|
|
|
|
|
file:/.../iostream
|
|
|
|
|
lcount:74,1
|
|
|
|
|
file:/.../basic_ios.h
|
|
|
|
|
file:/.../ostream
|
|
|
|
|
file:/.../ios_base.h
|
|
|
|
|
function:157,0,_ZStorSt12_Ios_IostateS_
|
|
|
|
|
lcount:157,0
|
|
|
|
|
file:/.../char_traits.h
|
|
|
|
|
function:258,0,_ZNSt11char_traitsIcE6lengthEPKc
|
|
|
|
|
lcount:258,0
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
The default gcov outputs multiple files: 'foo.cc.gcov',
|
|
|
|
|
'iostream.gcov', 'ios_base.h.gcov', etc. with source code
|
|
|
|
|
included. Instead the intermediate format here outputs only a single
|
|
|
|
|
file 'foo.cc.gcov' similar to the above example. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
output_intermediate_file (FILE *gcov_file, source_t *src)
|
|
|
|
|
{
|
|
|
|
|
unsigned line_num; /* current line number. */
|
|
|
|
|
const line_t *line; /* current line info ptr. */
|
|
|
|
|
function_t *fn; /* current function info ptr. */
|
|
|
|
|
|
|
|
|
|
fprintf (gcov_file, "file:%s\n", src->name); /* source file name */
|
|
|
|
|
|
2016-08-05 15:50:02 +02:00
|
|
|
|
for (fn = src->functions; fn; fn = fn->next_file_fn)
|
2013-06-20 07:20:09 +02:00
|
|
|
|
{
|
|
|
|
|
/* function:<name>,<line_number>,<execution_count> */
|
|
|
|
|
fprintf (gcov_file, "function:%d,%s,%s\n", fn->line,
|
2016-08-04 17:05:35 +02:00
|
|
|
|
format_gcov (fn->blocks[0].count, 0, -1),
|
|
|
|
|
flag_demangled_names ? fn->demangled_name : fn->name);
|
2013-06-20 07:20:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (line_num = 1, line = &src->lines[line_num];
|
|
|
|
|
line_num < src->num_lines;
|
|
|
|
|
line_num++, line++)
|
|
|
|
|
{
|
|
|
|
|
arc_t *arc;
|
|
|
|
|
if (line->exists)
|
2016-08-04 17:05:35 +02:00
|
|
|
|
fprintf (gcov_file, "lcount:%u,%s\n", line_num,
|
|
|
|
|
format_gcov (line->count, 0, -1));
|
2013-06-20 07:20:09 +02:00
|
|
|
|
if (flag_branches)
|
|
|
|
|
for (arc = line->u.branches; arc; arc = arc->line_next)
|
|
|
|
|
{
|
|
|
|
|
if (!arc->is_unconditional && !arc->is_call_non_return)
|
|
|
|
|
{
|
|
|
|
|
const char *branch_type;
|
|
|
|
|
/* branch:<line_num>,<branch_coverage_type>
|
|
|
|
|
branch_coverage_type
|
|
|
|
|
: notexec (Branch not executed)
|
|
|
|
|
: taken (Branch executed and taken)
|
|
|
|
|
: nottaken (Branch executed, but not taken)
|
|
|
|
|
*/
|
|
|
|
|
if (arc->src->count)
|
|
|
|
|
branch_type = (arc->count > 0) ? "taken" : "nottaken";
|
|
|
|
|
else
|
|
|
|
|
branch_type = "notexec";
|
alloc-pool.c, [...]: Add missing whitespace before "(".
gcc/
* alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
gimple.h, godump.c, graphite-clast-to-gimple.c,
graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
whitespace before "(".
From-SVN: r203004
2013-09-28 10:42:34 +02:00
|
|
|
|
fprintf (gcov_file, "branch:%d,%s\n", line_num, branch_type);
|
2013-06-20 07:20:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Process a single input 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
|
|
|
|
{
|
2011-11-10 20:17:13 +01:00
|
|
|
|
function_t *fns;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
create_file_names (file_name);
|
2011-11-10 20:17:13 +01:00
|
|
|
|
fns = read_graph_file ();
|
|
|
|
|
if (!fns)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
return;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
read_count_file (fns);
|
|
|
|
|
while (fns)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
2011-11-10 20:17:13 +01:00
|
|
|
|
function_t *fn = fns;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
fns = fn->next;
|
|
|
|
|
fn->next = NULL;
|
2016-08-12 14:23:32 +02:00
|
|
|
|
if (fn->counts || no_data_file)
|
2011-11-07 19:14:46 +01:00
|
|
|
|
{
|
2011-11-10 20:17:13 +01:00
|
|
|
|
unsigned src = fn->src;
|
|
|
|
|
unsigned line = fn->line;
|
|
|
|
|
unsigned block_no;
|
|
|
|
|
function_t *probe, **prev;
|
|
|
|
|
|
|
|
|
|
/* 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. Note we're
|
|
|
|
|
building this list in reverse order. */
|
|
|
|
|
for (prev = &sources[src].functions;
|
2016-08-05 15:50:02 +02:00
|
|
|
|
(probe = *prev); prev = &probe->next_file_fn)
|
2011-11-10 20:17:13 +01:00
|
|
|
|
if (probe->line <= line)
|
|
|
|
|
break;
|
2016-08-05 15:50:02 +02:00
|
|
|
|
fn->next_file_fn = probe;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
*prev = fn;
|
|
|
|
|
|
|
|
|
|
/* Mark last line in files touched by function. */
|
|
|
|
|
for (block_no = 0; block_no != fn->num_blocks; block_no++)
|
|
|
|
|
{
|
|
|
|
|
unsigned *enc = fn->blocks[block_no].u.line.encoding;
|
|
|
|
|
unsigned num = fn->blocks[block_no].u.line.num;
|
|
|
|
|
|
|
|
|
|
for (; num--; enc++)
|
|
|
|
|
if (!*enc)
|
|
|
|
|
{
|
|
|
|
|
if (enc[1] != src)
|
|
|
|
|
{
|
|
|
|
|
if (line >= sources[src].num_lines)
|
|
|
|
|
sources[src].num_lines = line + 1;
|
|
|
|
|
line = 0;
|
|
|
|
|
src = enc[1];
|
|
|
|
|
}
|
|
|
|
|
enc++;
|
|
|
|
|
num--;
|
|
|
|
|
}
|
|
|
|
|
else if (*enc > line)
|
|
|
|
|
line = *enc;
|
|
|
|
|
}
|
|
|
|
|
if (line >= sources[src].num_lines)
|
|
|
|
|
sources[src].num_lines = line + 1;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-07 19:14:46 +01:00
|
|
|
|
solve_flow_graph (fn);
|
2011-12-02 21:32:40 +01:00
|
|
|
|
if (fn->has_catch)
|
|
|
|
|
find_exception_blocks (fn);
|
2011-11-10 20:17:13 +01:00
|
|
|
|
*fn_end = fn;
|
|
|
|
|
fn_end = &fn->next;
|
2011-11-07 19:14:46 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2011-11-10 20:17:13 +01:00
|
|
|
|
/* The function was not in the executable -- some other
|
|
|
|
|
instance must have been selected. */
|
|
|
|
|
release_function (fn);
|
2011-11-07 19:14:46 +01:00
|
|
|
|
}
|
2007-06-12 17:39:15 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-20 07:20:09 +02:00
|
|
|
|
static void
|
alloc-pool.c, [...]: Add missing whitespace before "(".
gcc/
* alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
gimple.h, godump.c, graphite-clast-to-gimple.c,
graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
whitespace before "(".
From-SVN: r203004
2013-09-28 10:42:34 +02:00
|
|
|
|
output_gcov_file (const char *file_name, source_t *src)
|
2013-06-20 07:20:09 +02:00
|
|
|
|
{
|
|
|
|
|
char *gcov_file_name = make_gcov_file_name (file_name, src->coverage.name);
|
|
|
|
|
|
|
|
|
|
if (src->coverage.lines)
|
|
|
|
|
{
|
|
|
|
|
FILE *gcov_file = fopen (gcov_file_name, "w");
|
|
|
|
|
if (gcov_file)
|
|
|
|
|
{
|
|
|
|
|
fnotice (stdout, "Creating '%s'\n", gcov_file_name);
|
2017-04-10 13:37:14 +02:00
|
|
|
|
|
|
|
|
|
if (flag_intermediate_format)
|
|
|
|
|
output_intermediate_file (gcov_file, src);
|
|
|
|
|
else
|
|
|
|
|
output_lines (gcov_file, src);
|
2013-06-20 07:20:09 +02:00
|
|
|
|
if (ferror (gcov_file))
|
|
|
|
|
fnotice (stderr, "Error writing output file '%s'\n", gcov_file_name);
|
|
|
|
|
fclose (gcov_file);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fnotice (stderr, "Could not open output file '%s'\n", gcov_file_name);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unlink (gcov_file_name);
|
|
|
|
|
fnotice (stdout, "Removing '%s'\n", gcov_file_name);
|
|
|
|
|
}
|
|
|
|
|
free (gcov_file_name);
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-12 17:39:15 +02:00
|
|
|
|
static void
|
|
|
|
|
generate_results (const char *file_name)
|
|
|
|
|
{
|
2011-11-10 20:17:13 +01:00
|
|
|
|
unsigned ix;
|
2007-06-12 17:39:15 +02:00
|
|
|
|
source_t *src;
|
|
|
|
|
function_t *fn;
|
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
for (ix = n_sources, src = sources; ix--; src++)
|
|
|
|
|
if (src->num_lines)
|
|
|
|
|
src->lines = XCNEWVEC (line_t, src->num_lines);
|
|
|
|
|
|
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));
|
2013-06-20 07:20:09 +02:00
|
|
|
|
coverage.name = flag_demangled_names ? fn->demangled_name : fn->name;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
if (file_name)
|
|
|
|
|
{
|
|
|
|
|
name_map_t *name_map = (name_map_t *)bsearch
|
|
|
|
|
(file_name, names, n_names, sizeof (*names), name_search);
|
|
|
|
|
if (name_map)
|
2011-11-13 11:26:23 +01:00
|
|
|
|
file_name = sources[name_map->src].coverage.name;
|
2011-11-12 12:35:42 +01:00
|
|
|
|
else
|
|
|
|
|
file_name = canonicalize_name (file_name);
|
|
|
|
|
}
|
2013-06-20 07:20:09 +02:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
for (ix = n_sources, src = sources; ix--; src++)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
2011-11-13 11:26:23 +01:00
|
|
|
|
if (flag_relative_only)
|
|
|
|
|
{
|
|
|
|
|
/* Ignore this source, if it is an absolute path (after
|
|
|
|
|
source prefix removal). */
|
|
|
|
|
char first = src->coverage.name[0];
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-13 11:26:23 +01:00
|
|
|
|
#if HAVE_DOS_BASED_FILE_SYSTEM
|
|
|
|
|
if (first && src->coverage.name[1] == ':')
|
2011-11-14 17:38:23 +01:00
|
|
|
|
first = src->coverage.name[2];
|
2011-11-13 11:26:23 +01:00
|
|
|
|
#endif
|
2011-11-14 17:38:23 +01:00
|
|
|
|
if (IS_DIR_SEPARATOR (first))
|
|
|
|
|
continue;
|
2011-11-13 11:26:23 +01:00
|
|
|
|
}
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
accumulate_line_counts (src);
|
|
|
|
|
function_summary (&src->coverage, "File");
|
2011-12-30 19:22:16 +01:00
|
|
|
|
total_lines += src->coverage.lines;
|
|
|
|
|
total_executed += src->coverage.lines_executed;
|
2012-01-11 19:58:30 +01:00
|
|
|
|
if (flag_gcov_file)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
2017-04-10 13:37:14 +02:00
|
|
|
|
output_gcov_file (file_name, src);
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fnotice (stdout, "\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-01-11 19:58:30 +01:00
|
|
|
|
|
2011-12-30 19:22:16 +01:00
|
|
|
|
if (!file_name)
|
|
|
|
|
executed_summary (total_lines, total_executed);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-07 19:14:46 +01:00
|
|
|
|
/* Release a function structure */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
release_function (function_t *fn)
|
|
|
|
|
{
|
|
|
|
|
unsigned ix;
|
|
|
|
|
block_t *block;
|
|
|
|
|
|
|
|
|
|
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);
|
2013-06-20 07:20:09 +02:00
|
|
|
|
if (flag_demangled_names && fn->demangled_name != fn->name)
|
|
|
|
|
free (fn->demangled_name);
|
|
|
|
|
free (fn->name);
|
2011-11-07 19:14:46 +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
|
|
|
|
{
|
2011-11-10 20:17:13 +01:00
|
|
|
|
unsigned ix;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
function_t *fn;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
for (ix = n_sources; ix--;)
|
2011-11-12 12:35:42 +01:00
|
|
|
|
free (sources[ix].lines);
|
|
|
|
|
free (sources);
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
for (ix = n_names; ix--;)
|
|
|
|
|
free (names[ix].name);
|
|
|
|
|
free (names);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
while ((fn = functions))
|
|
|
|
|
{
|
|
|
|
|
functions = fn->next;
|
2011-11-07 19:14:46 +01:00
|
|
|
|
release_function (fn);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-23 12:20:01 +02:00
|
|
|
|
/* Generate the names of the graph and data files. If OBJECT_DIRECTORY
|
|
|
|
|
is not specified, these are named from FILE_NAME sans extension. If
|
|
|
|
|
OBJECT_DIRECTORY is specified and is a directory, the files are in 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
|
|
|
|
|
2007-06-12 17:39:15 +02:00
|
|
|
|
/* Free previous file names. */
|
2011-04-20 20:19:03 +02:00
|
|
|
|
free (bbg_file_name);
|
|
|
|
|
free (da_file_name);
|
2007-06-12 17:39:15 +02:00
|
|
|
|
da_file_name = bbg_file_name = NULL;
|
|
|
|
|
bbg_file_time = 0;
|
|
|
|
|
bbg_stamp = 0;
|
|
|
|
|
|
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;
|
2006-01-31 20:56:55 +01:00
|
|
|
|
name = XNEWVEC (char, length);
|
2002-08-04 19:06:10 +02:00
|
|
|
|
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);
|
2016-08-04 17:05:35 +02:00
|
|
|
|
if (base && (!IS_DIR_SEPARATOR (name[strlen (name) - 1])))
|
2002-08-04 19:06:10 +02:00
|
|
|
|
strcat (name, "/");
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-01-31 20:56:55 +01:00
|
|
|
|
name = XNEWVEC (char, length + 1);
|
2011-05-23 12:20:01 +02:00
|
|
|
|
strcpy (name, file_name);
|
|
|
|
|
base = 0;
|
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. */
|
2008-10-03 14:49:38 +02:00
|
|
|
|
const char *cptr = lbasename (file_name);
|
|
|
|
|
strcat (name, cptr ? cptr : 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. */
|
2012-10-13 20:41:08 +02:00
|
|
|
|
cptr = strrchr (CONST_CAST (char *, lbasename (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);
|
2009-11-25 11:55:54 +01:00
|
|
|
|
|
2006-01-31 20:56:55 +01:00
|
|
|
|
bbg_file_name = XNEWVEC (char, 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
|
|
|
|
|
2006-01-31 20:56:55 +01:00
|
|
|
|
da_file_name = XNEWVEC (char, length + strlen (GCOV_DATA_SUFFIX) + 1);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
strcpy (da_file_name, name);
|
|
|
|
|
strcpy (da_file_name + length, GCOV_DATA_SUFFIX);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2006-03-14 01:24:54 +01:00
|
|
|
|
free (name);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
return;
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* A is a string and B is a pointer to name_map_t. Compare for file
|
|
|
|
|
name orderability. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
name_search (const void *a_, const void *b_)
|
|
|
|
|
{
|
|
|
|
|
const char *a = (const char *)a_;
|
|
|
|
|
const name_map_t *b = (const name_map_t *)b_;
|
|
|
|
|
|
|
|
|
|
#if HAVE_DOS_BASED_FILE_SYSTEM
|
|
|
|
|
return strcasecmp (a, b->name);
|
|
|
|
|
#else
|
|
|
|
|
return strcmp (a, b->name);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A and B are a pointer to name_map_t. Compare for file name
|
|
|
|
|
orderability. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
name_sort (const void *a_, const void *b_)
|
|
|
|
|
{
|
|
|
|
|
const name_map_t *a = (const name_map_t *)a_;
|
|
|
|
|
return name_search (a->name, b_);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
static unsigned
|
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
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
name_map_t *name_map;
|
|
|
|
|
char *canon;
|
|
|
|
|
unsigned idx;
|
2007-06-12 17:39:15 +02:00
|
|
|
|
struct stat status;
|
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>";
|
2011-11-12 12:35:42 +01:00
|
|
|
|
name_map = (name_map_t *)bsearch
|
|
|
|
|
(file_name, names, n_names, sizeof (*names), name_search);
|
|
|
|
|
if (name_map)
|
|
|
|
|
{
|
|
|
|
|
idx = name_map->src;
|
|
|
|
|
goto check_date;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
if (n_names + 2 > a_names)
|
2007-06-12 17:39:15 +02:00
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Extend the name map array -- we'll be inserting one or two
|
|
|
|
|
entries. */
|
|
|
|
|
a_names *= 2;
|
|
|
|
|
name_map = XNEWVEC (name_map_t, a_names);
|
|
|
|
|
memcpy (name_map, names, n_names * sizeof (*names));
|
|
|
|
|
free (names);
|
|
|
|
|
names = name_map;
|
|
|
|
|
}
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Not found, try the canonical name. */
|
|
|
|
|
canon = canonicalize_name (file_name);
|
2016-08-04 17:05:35 +02:00
|
|
|
|
name_map = (name_map_t *) bsearch (canon, names, n_names, sizeof (*names),
|
|
|
|
|
name_search);
|
2011-11-12 12:35:42 +01:00
|
|
|
|
if (!name_map)
|
|
|
|
|
{
|
|
|
|
|
/* Not found with canonical name, create a new source. */
|
|
|
|
|
source_t *src;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
if (n_sources == a_sources)
|
|
|
|
|
{
|
|
|
|
|
a_sources *= 2;
|
|
|
|
|
src = XNEWVEC (source_t, a_sources);
|
|
|
|
|
memcpy (src, sources, n_sources * sizeof (*sources));
|
|
|
|
|
free (sources);
|
|
|
|
|
sources = src;
|
|
|
|
|
}
|
2011-11-12 12:35:42 +01:00
|
|
|
|
|
|
|
|
|
idx = n_sources;
|
|
|
|
|
|
|
|
|
|
name_map = &names[n_names++];
|
|
|
|
|
name_map->name = canon;
|
|
|
|
|
name_map->src = idx;
|
|
|
|
|
|
|
|
|
|
src = &sources[n_sources++];
|
|
|
|
|
memset (src, 0, sizeof (*src));
|
|
|
|
|
src->name = canon;
|
2007-06-12 17:39:15 +02:00
|
|
|
|
src->coverage.name = src->name;
|
2011-11-13 11:26:23 +01:00
|
|
|
|
if (source_length
|
|
|
|
|
#if HAVE_DOS_BASED_FILE_SYSTEM
|
|
|
|
|
/* You lose if separators don't match exactly in the
|
|
|
|
|
prefix. */
|
|
|
|
|
&& !strncasecmp (source_prefix, src->coverage.name, source_length)
|
|
|
|
|
#else
|
|
|
|
|
&& !strncmp (source_prefix, src->coverage.name, source_length)
|
|
|
|
|
#endif
|
|
|
|
|
&& IS_DIR_SEPARATOR (src->coverage.name[source_length]))
|
|
|
|
|
src->coverage.name += source_length + 1;
|
2011-11-12 12:35:42 +01:00
|
|
|
|
if (!stat (src->name, &status))
|
2007-06-12 17:39:15 +02:00
|
|
|
|
src->file_time = status.st_mtime;
|
|
|
|
|
}
|
2011-11-12 12:35:42 +01:00
|
|
|
|
else
|
|
|
|
|
idx = name_map->src;
|
|
|
|
|
|
|
|
|
|
if (name_search (file_name, name_map))
|
|
|
|
|
{
|
|
|
|
|
/* Append the non-canonical name. */
|
|
|
|
|
name_map = &names[n_names++];
|
|
|
|
|
name_map->name = xstrdup (file_name);
|
|
|
|
|
name_map->src = idx;
|
|
|
|
|
}
|
2007-06-12 17:39:15 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Resort the name map. */
|
|
|
|
|
qsort (names, n_names, sizeof (*names), name_sort);
|
|
|
|
|
|
|
|
|
|
check_date:
|
|
|
|
|
if (sources[idx].file_time > bbg_file_time)
|
2007-06-12 17:39:15 +02:00
|
|
|
|
{
|
|
|
|
|
static int info_emitted;
|
|
|
|
|
|
2012-07-23 13:59:15 +02:00
|
|
|
|
fnotice (stderr, "%s:source file is newer than notes file '%s'\n",
|
2011-11-12 12:35:42 +01:00
|
|
|
|
file_name, bbg_file_name);
|
2007-06-12 17:39:15 +02:00
|
|
|
|
if (!info_emitted)
|
|
|
|
|
{
|
|
|
|
|
fnotice (stderr,
|
2015-04-11 14:08:26 +02:00
|
|
|
|
"(the message is displayed only once per source file)\n");
|
2007-06-12 17:39:15 +02:00
|
|
|
|
info_emitted = 1;
|
|
|
|
|
}
|
2011-11-12 12:35:42 +01:00
|
|
|
|
sources[idx].file_time = 0;
|
2007-06-12 17:39:15 +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
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
return idx;
|
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
|
|
|
|
}
|
|
|
|
|
|
2012-07-23 13:59:15 +02:00
|
|
|
|
/* Read the notes file. Return list of functions read -- in reverse order. */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
static function_t *
|
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;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
function_t *fn = NULL;
|
|
|
|
|
function_t *fns = NULL;
|
|
|
|
|
function_t **fns_end = &fns;
|
|
|
|
|
unsigned src_idx = 0;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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
|
|
|
|
{
|
2012-07-23 13:59:15 +02:00
|
|
|
|
fnotice (stderr, "%s:cannot open notes file\n", bbg_file_name);
|
2011-11-10 20:17:13 +01:00
|
|
|
|
return fns;
|
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
|
|
|
|
{
|
2012-07-23 13:59:15 +02:00
|
|
|
|
fnotice (stderr, "%s:not a gcov notes 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 ();
|
2011-11-10 20:17:13 +01:00
|
|
|
|
return fns;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
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);
|
|
|
|
|
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
fnotice (stderr, "%s:version '%.4s', prefer '%.4s'\n",
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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;
|
2011-04-29 02:19:35 +02:00
|
|
|
|
unsigned ident, lineno;
|
|
|
|
|
unsigned lineno_checksum, cfg_checksum;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
2003-04-24 11:46:17 +02:00
|
|
|
|
ident = gcov_read_unsigned ();
|
2011-04-29 02:19:35 +02:00
|
|
|
|
lineno_checksum = gcov_read_unsigned ();
|
|
|
|
|
cfg_checksum = gcov_read_unsigned ();
|
2003-04-24 11:46:17 +02:00
|
|
|
|
function_name = xstrdup (gcov_read_string ());
|
2011-11-10 20:17:13 +01:00
|
|
|
|
src_idx = find_source (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
|
|
|
|
lineno = gcov_read_unsigned ();
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2006-01-31 20:56:55 +01:00
|
|
|
|
fn = XCNEW (function_t);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fn->name = function_name;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
if (flag_demangled_names)
|
|
|
|
|
{
|
|
|
|
|
fn->demangled_name = cplus_demangle (fn->name, DMGL_PARAMS);
|
|
|
|
|
if (!fn->demangled_name)
|
|
|
|
|
fn->demangled_name = fn->name;
|
|
|
|
|
}
|
2003-04-24 11:46:17 +02:00
|
|
|
|
fn->ident = ident;
|
2011-04-29 02:19:35 +02:00
|
|
|
|
fn->lineno_checksum = lineno_checksum;
|
|
|
|
|
fn->cfg_checksum = cfg_checksum;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
fn->src = src_idx;
|
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->line = lineno;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
2016-08-05 15:50:02 +02:00
|
|
|
|
fn->next_file_fn = NULL;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
fn->next = NULL;
|
|
|
|
|
*fns_end = fn;
|
|
|
|
|
fns_end = &fn->next;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
current_tag = tag;
|
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)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
fnotice (stderr, "%s:already seen blocks for '%s'\n",
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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
|
|
|
|
|
2006-01-31 20:56:55 +01:00
|
|
|
|
fn->blocks = XCNEWVEC (block_t, fn->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
|
|
|
|
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);
|
2011-12-02 21:32:40 +01:00
|
|
|
|
block_t *src_blk = &fn->blocks[src];
|
|
|
|
|
unsigned mark_catches = 0;
|
|
|
|
|
struct arc_info *arc;
|
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
|
|
|
|
{
|
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;
|
2006-01-31 20:56:55 +01:00
|
|
|
|
arc = XCNEW (arc_t);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
arc->dst = &fn->blocks[dest];
|
2011-12-02 21:32:40 +01:00
|
|
|
|
arc->src = src_blk;
|
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
|
|
|
|
|
2011-12-02 21:32:40 +01:00
|
|
|
|
arc->succ_next = src_blk->succ;
|
|
|
|
|
src_blk->succ = arc;
|
|
|
|
|
src_blk->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;
|
2011-12-02 21:32:40 +01:00
|
|
|
|
mark_catches = 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
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Non-local return from a callee of this
|
2016-08-04 17:05:35 +02:00
|
|
|
|
function. The destination block is a 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
|
|
|
|
}
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-12-02 21:32:40 +01:00
|
|
|
|
if (mark_catches)
|
|
|
|
|
{
|
|
|
|
|
/* We have a fake exit from this block. The other
|
|
|
|
|
non-fall through exits must be to catch handlers.
|
|
|
|
|
Mark them as catch arcs. */
|
|
|
|
|
|
|
|
|
|
for (arc = src_blk->succ; arc; arc = arc->succ_next)
|
|
|
|
|
if (!arc->fake && !arc->fall_through)
|
|
|
|
|
{
|
|
|
|
|
arc->is_throw = 1;
|
|
|
|
|
fn->has_catch = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
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 ();
|
2006-01-31 20:56:55 +01:00
|
|
|
|
unsigned *line_nos = XCNEWVEC (unsigned, length - 1);
|
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;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
line_nos[ix++] = src_idx;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
line_nos[ix++] = lineno;
|
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;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
src_idx = find_source (file_name);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
line_nos[ix++] = 0;
|
2011-11-10 20:17:13 +01:00
|
|
|
|
line_nos[ix++] = src_idx;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
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 ())
|
2004-07-29 10:58:59 +02:00
|
|
|
|
{
|
|
|
|
|
corrupt:;
|
|
|
|
|
fnotice (stderr, "%s:corrupted\n", bbg_file_name);
|
2011-11-10 20:17:13 +01:00
|
|
|
|
break;
|
2004-07-29 10:58:59 +02:00
|
|
|
|
}
|
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
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
if (!fns)
|
|
|
|
|
fnotice (stderr, "%s:no functions found\n", bbg_file_name);
|
2002-05-09 14:54:19 +02:00
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
return fns;
|
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
|
2011-11-10 20:17:13 +01:00
|
|
|
|
read_count_file (function_t *fns)
|
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
|
|
|
|
{
|
2006-08-09 21:09:06 +02:00
|
|
|
|
fnotice (stderr, "%s:cannot open data file, assuming not executed\n",
|
|
|
|
|
da_file_name);
|
|
|
|
|
no_data_file = 1;
|
|
|
|
|
return 0;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
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);
|
2009-11-25 11:55:54 +01:00
|
|
|
|
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +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)
|
|
|
|
|
{
|
2012-07-23 13:59:15 +02:00
|
|
|
|
fnotice (stderr, "%s:stamp mismatch with notes file\n", da_file_name);
|
2003-07-06 16:51:48 +02:00
|
|
|
|
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 ();
|
|
|
|
|
|
2011-11-07 19:14:46 +01:00
|
|
|
|
if (tag == GCOV_TAG_PROGRAM_SUMMARY)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2011-11-07 19:14:46 +01:00
|
|
|
|
struct gcov_summary summary;
|
|
|
|
|
gcov_read_summary (&summary);
|
|
|
|
|
object_runs += summary.ctrs[GCOV_COUNTER_ARCS].runs;
|
|
|
|
|
program_count++;
|
|
|
|
|
}
|
|
|
|
|
else if (tag == GCOV_TAG_FUNCTION && !length)
|
|
|
|
|
; /* placeholder */
|
|
|
|
|
else if (tag == GCOV_TAG_FUNCTION && length == GCOV_TAG_FUNCTION_LENGTH)
|
|
|
|
|
{
|
|
|
|
|
unsigned ident;
|
|
|
|
|
struct function_info *fn_n;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
2011-11-07 19:14:46 +01:00
|
|
|
|
/* Try to find the function in the list. To speed up the
|
|
|
|
|
search, first start from the last function found. */
|
|
|
|
|
ident = gcov_read_unsigned ();
|
2011-11-10 20:17:13 +01:00
|
|
|
|
fn_n = fns;
|
2011-11-07 19:14:46 +01:00
|
|
|
|
for (fn = fn ? fn->next : NULL; ; fn = fn->next)
|
|
|
|
|
{
|
|
|
|
|
if (fn)
|
|
|
|
|
;
|
|
|
|
|
else if ((fn = fn_n))
|
|
|
|
|
fn_n = NULL;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fnotice (stderr, "%s:unknown function '%u'\n",
|
|
|
|
|
da_file_name, ident);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
break;
|
2011-11-07 19:14:46 +01:00
|
|
|
|
}
|
|
|
|
|
if (fn->ident == ident)
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
|
|
|
|
if (!fn)
|
|
|
|
|
;
|
2011-04-29 02:19:35 +02:00
|
|
|
|
else if (gcov_read_unsigned () != fn->lineno_checksum
|
|
|
|
|
|| gcov_read_unsigned () != fn->cfg_checksum)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
mismatch:;
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
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)
|
2006-01-31 20:56:55 +01:00
|
|
|
|
fn->counts = XCNEWVEC (gcov_type, fn->num_counts);
|
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 ()))
|
2004-07-29 10:58:59 +02:00
|
|
|
|
{
|
2017-02-28 16:25:19 +01:00
|
|
|
|
fnotice (stderr,
|
|
|
|
|
error < 0
|
|
|
|
|
? N_("%s:overflowed\n")
|
|
|
|
|
: N_("%s:corrupted\n"),
|
2004-07-29 10:58:59 +02:00
|
|
|
|
da_file_name);
|
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
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
|
|
|
|
}
|
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
|
|
|
|
|
2011-11-10 20:17:13 +01:00
|
|
|
|
/* The arcs were built in reverse order. Fix that now. */
|
|
|
|
|
for (ix = fn->num_blocks; ix--;)
|
|
|
|
|
{
|
|
|
|
|
arc_t *arc_p, *arc_n;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (fn->num_blocks < 2)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
fnotice (stderr, "%s:'%s' lacks entry and/or exit blocks\n",
|
2002-12-16 19:23:00 +01:00
|
|
|
|
bbg_file_name, fn->name);
|
|
|
|
|
else
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2012-07-23 11:24:21 +02:00
|
|
|
|
if (fn->blocks[ENTRY_BLOCK].num_pred)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
fnotice (stderr, "%s:'%s' has arcs to entry block\n",
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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. */
|
2012-07-23 11:24:21 +02:00
|
|
|
|
fn->blocks[ENTRY_BLOCK].num_pred = ~(unsigned)0;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2012-07-23 11:24:21 +02:00
|
|
|
|
if (fn->blocks[EXIT_BLOCK].num_succ)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
fnotice (stderr, "%s:'%s' has arcs from exit block\n",
|
2002-12-16 19:23:00 +01:00
|
|
|
|
bbg_file_name, fn->name);
|
|
|
|
|
else
|
|
|
|
|
/* Likewise, we can't deduce exit block counts from the lack
|
|
|
|
|
of its successors. */
|
2012-07-23 11:24:21 +02:00
|
|
|
|
fn->blocks[EXIT_BLOCK].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)
|
|
|
|
|
{
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
fnotice (stderr, "%s:graph is unsolvable for '%s'\n",
|
2002-12-16 19:23:00 +01:00
|
|
|
|
bbg_file_name, fn->name);
|
|
|
|
|
break;
|
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
2011-12-02 21:32:40 +01:00
|
|
|
|
/* Mark all the blocks only reachable via an incoming catch. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
find_exception_blocks (function_t *fn)
|
|
|
|
|
{
|
|
|
|
|
unsigned ix;
|
|
|
|
|
block_t **queue = XALLOCAVEC (block_t *, fn->num_blocks);
|
|
|
|
|
|
|
|
|
|
/* First mark all blocks as exceptional. */
|
|
|
|
|
for (ix = fn->num_blocks; ix--;)
|
|
|
|
|
fn->blocks[ix].exceptional = 1;
|
|
|
|
|
|
|
|
|
|
/* Now mark all the blocks reachable via non-fake edges */
|
|
|
|
|
queue[0] = fn->blocks;
|
|
|
|
|
queue[0]->exceptional = 0;
|
|
|
|
|
for (ix = 1; ix;)
|
|
|
|
|
{
|
|
|
|
|
block_t *block = queue[--ix];
|
|
|
|
|
const arc_t *arc;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-12-02 21:32:40 +01:00
|
|
|
|
for (arc = block->succ; arc; arc = arc->succ_next)
|
|
|
|
|
if (!arc->fake && !arc->is_throw && arc->dst->exceptional)
|
|
|
|
|
{
|
|
|
|
|
arc->dst->exceptional = 0;
|
|
|
|
|
queue[ix++] = arc->dst;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-23 11:24:21 +02:00
|
|
|
|
/* Format a GCOV_TYPE integer as either a percent ratio, or absolute
|
2002-08-04 19:06:10 +02:00
|
|
|
|
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
|
|
|
|
|
2017-06-22 13:37:13 +02:00
|
|
|
|
/* Handle invalid values that would result in a misleading value. */
|
|
|
|
|
if (bottom != 0 && top > bottom && dp >= 0)
|
|
|
|
|
{
|
|
|
|
|
sprintf (buffer, "NAN %%");
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
bitmap.c, [...]: Add space between string literal and macro name.
* bitmap.c, c/c-aux-info.c, cfg.c, cfghooks.c, cgraph.c,
config/aarch64/aarch64.md config/alpha/vms.h, config/darwin.c,
config/darwin.h, config/darwin9.h, config/elfos.h,
config/i386/bsd.h, config/ia64/ia64.c, config/lm32/lm32.h,
config/microblaze/microblaze.h, config/mips/mips.h,
config/mmix/mmix.c, config/msp430/msp430.c, config/nios2/nios2.h,
config/nvptx/nvptx.c, config/nvptx/nvptx.h, config/pa/pa.c,
config/pa/pa.h, config/rs6000/rs6000.c, config/rs6000/sysv4.h,
config/rs6000/xcoff.h, config/rx/rx.h, config/s390/s390.h,
config/sparc/sol2.h, config/sparc/sparc.h, config/visium/visium.h,
cppbuiltin.c, defaults.h, doc/invoke.texi, dwarf2cfi.c,
dwarf2out.c, final.c, gcc.c, gcov-dump.c, gcov.c, ipa-cp.c,
ipa-inline.c, ipa-polymorphic-call.c, ipa-profile.c, ipa-prop.c,
ira-color.c, ira.c, loop-doloop.c, loop-iv.c, mcf.c,
modulo-sched.c, predict.c, profile.c, stor-layout.c, toplev.c,
tree-ssa-reassoc.c, value-prof.c, wide-int-print.cc: Add space
between string literal and macro name.
From-SVN: r222960
2015-05-09 06:50:05 +02:00
|
|
|
|
sprintf (buffer, "%" PRId64, (int64_t)top);
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2002-08-04 19:06:10 +02:00
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-30 19:22:16 +01:00
|
|
|
|
/* Summary of execution */
|
1997-03-28 23:43:13 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2011-12-30 19:22:16 +01:00
|
|
|
|
executed_summary (unsigned lines, unsigned executed)
|
1997-03-28 23:43:13 +01:00
|
|
|
|
{
|
2011-12-30 19:22:16 +01:00
|
|
|
|
if (lines)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
fnotice (stdout, "Lines executed:%s of %d\n",
|
2011-12-30 19:22:16 +01:00
|
|
|
|
format_gcov (executed, lines, 2), lines);
|
1997-03-28 23:43:13 +01:00
|
|
|
|
else
|
2004-07-28 11:57:38 +02:00
|
|
|
|
fnotice (stdout, "No executable lines\n");
|
2011-12-30 19:22:16 +01:00
|
|
|
|
}
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-12-30 19:22:16 +01:00
|
|
|
|
/* Output summary info for a function or file. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
function_summary (const coverage_t *coverage, const char *title)
|
|
|
|
|
{
|
|
|
|
|
fnotice (stdout, "%s '%s'\n", title, coverage->name);
|
|
|
|
|
executed_summary (coverage->lines, coverage->lines_executed);
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Canonicalize the filename NAME by canonicalizing directory
|
|
|
|
|
separators, eliding . components and resolving .. components
|
|
|
|
|
appropriately. Always returns a unique string. */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
canonicalize_name (const char *name)
|
|
|
|
|
{
|
|
|
|
|
/* The canonical name cannot be longer than the incoming name. */
|
|
|
|
|
char *result = XNEWVEC (char, strlen (name) + 1);
|
|
|
|
|
const char *base = name, *probe;
|
|
|
|
|
char *ptr = result;
|
|
|
|
|
char *dd_base;
|
|
|
|
|
int slash = 0;
|
|
|
|
|
|
|
|
|
|
#if HAVE_DOS_BASED_FILE_SYSTEM
|
|
|
|
|
if (base[0] && base[1] == ':')
|
|
|
|
|
{
|
|
|
|
|
result[0] = base[0];
|
|
|
|
|
result[1] = ':';
|
|
|
|
|
base += 2;
|
|
|
|
|
ptr += 2;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
for (dd_base = ptr; *base; base = probe)
|
|
|
|
|
{
|
|
|
|
|
size_t len;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
for (probe = base; *probe; probe++)
|
|
|
|
|
if (IS_DIR_SEPARATOR (*probe))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
len = probe - base;
|
|
|
|
|
if (len == 1 && base[0] == '.')
|
|
|
|
|
/* Elide a '.' directory */
|
|
|
|
|
;
|
|
|
|
|
else if (len == 2 && base[0] == '.' && base[1] == '.')
|
|
|
|
|
{
|
|
|
|
|
/* '..', we can only elide it and the previous directory, if
|
|
|
|
|
we're not a symlink. */
|
2011-11-14 22:44:01 +01:00
|
|
|
|
struct stat ATTRIBUTE_UNUSED buf;
|
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
*ptr = 0;
|
2011-11-14 22:44:01 +01:00
|
|
|
|
if (dd_base == ptr
|
|
|
|
|
#if defined (S_ISLNK)
|
|
|
|
|
/* S_ISLNK is not POSIX.1-1996. */
|
|
|
|
|
|| stat (result, &buf) || S_ISLNK (buf.st_mode)
|
|
|
|
|
#endif
|
2016-08-04 17:05:35 +02:00
|
|
|
|
)
|
2011-11-12 12:35:42 +01:00
|
|
|
|
{
|
|
|
|
|
/* Cannot elide, or unreadable or a symlink. */
|
|
|
|
|
dd_base = ptr + 2 + slash;
|
|
|
|
|
goto regular;
|
|
|
|
|
}
|
|
|
|
|
while (ptr != dd_base && *ptr != '/')
|
|
|
|
|
ptr--;
|
|
|
|
|
slash = ptr != result;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
regular:
|
|
|
|
|
/* Regular pathname component. */
|
|
|
|
|
if (slash)
|
|
|
|
|
*ptr++ = '/';
|
|
|
|
|
memcpy (ptr, base, len);
|
|
|
|
|
ptr += len;
|
|
|
|
|
slash = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (; IS_DIR_SEPARATOR (*probe); probe++)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
*ptr = 0;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-16 16:14:18 +02:00
|
|
|
|
/* Print hex representation of 16 bytes from SUM and write it to BUFFER. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
md5sum_to_hex (const char *sum, char *buffer)
|
|
|
|
|
{
|
|
|
|
|
for (unsigned i = 0; i < 16; i++)
|
2017-03-31 04:52:39 +02:00
|
|
|
|
sprintf (buffer + (2 * i), "%02x", (unsigned char)sum[i]);
|
2016-08-16 16:14:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Generate an output file name. INPUT_NAME is the canonicalized main
|
|
|
|
|
input file and SRC_NAME is the canonicalized file name.
|
|
|
|
|
LONG_OUTPUT_NAMES and PRESERVE_PATHS affect name generation. With
|
2002-08-07 01:18:01 +02:00
|
|
|
|
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
|
2011-11-12 12:35:42 +01:00
|
|
|
|
components are separated by '##'. With preserve_paths we create a
|
|
|
|
|
filename from all path components of the source file, replacing '/'
|
|
|
|
|
with '#', and .. with '^', without it we simply take the basename
|
|
|
|
|
component. (Remember, the canonicalized name will already have
|
|
|
|
|
elided '.' components and converted \\ separators.) */
|
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
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
char *ptr;
|
|
|
|
|
char *result;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2007-06-12 17:39:15 +02:00
|
|
|
|
if (flag_long_names && input_name && strcmp (src_name, input_name))
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
|
|
|
|
/* Generate the input filename part. */
|
2011-11-12 12:35:42 +01:00
|
|
|
|
result = XNEWVEC (char, strlen (input_name) + strlen (src_name) + 10);
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
ptr = result;
|
|
|
|
|
ptr = mangle_name (input_name, ptr);
|
|
|
|
|
ptr[0] = ptr[1] = '#';
|
|
|
|
|
ptr += 2;
|
2002-08-07 01:18:01 +02:00
|
|
|
|
}
|
2007-06-12 17:39:15 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
result = XNEWVEC (char, strlen (src_name) + 10);
|
|
|
|
|
ptr = result;
|
2007-06-12 17:39:15 +02:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
ptr = mangle_name (src_name, ptr);
|
|
|
|
|
strcpy (ptr, ".gcov");
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2016-08-16 16:14:18 +02:00
|
|
|
|
/* When hashing filenames, we shorten them by only using the filename
|
|
|
|
|
component and appending a hash of the full (mangled) pathname. */
|
|
|
|
|
if (flag_hash_filenames)
|
|
|
|
|
{
|
|
|
|
|
md5_ctx ctx;
|
|
|
|
|
char md5sum[16];
|
|
|
|
|
char md5sum_hex[33];
|
|
|
|
|
|
|
|
|
|
md5_init_ctx (&ctx);
|
2017-03-31 04:52:39 +02:00
|
|
|
|
md5_process_bytes (src_name, strlen (src_name), &ctx);
|
2016-08-16 16:14:18 +02:00
|
|
|
|
md5_finish_ctx (&ctx, md5sum);
|
|
|
|
|
md5sum_to_hex (md5sum, md5sum_hex);
|
|
|
|
|
free (result);
|
|
|
|
|
|
|
|
|
|
result = XNEWVEC (char, strlen (src_name) + 50);
|
|
|
|
|
ptr = result;
|
|
|
|
|
ptr = mangle_name (src_name, ptr);
|
|
|
|
|
ptr[0] = ptr[1] = '#';
|
|
|
|
|
ptr += 2;
|
|
|
|
|
memcpy (ptr, md5sum_hex, 32);
|
|
|
|
|
ptr += 32;
|
|
|
|
|
strcpy (ptr, ".gcov");
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
return result;
|
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
static char *
|
|
|
|
|
mangle_name (char const *base, char *ptr)
|
|
|
|
|
{
|
|
|
|
|
size_t len;
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Generate the source filename part. */
|
|
|
|
|
if (!flag_preserve_paths)
|
|
|
|
|
{
|
|
|
|
|
base = lbasename (base);
|
|
|
|
|
len = strlen (base);
|
|
|
|
|
memcpy (ptr, base, len);
|
|
|
|
|
ptr += len;
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-08-07 01:18:01 +02:00
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
/* Convert '/' to '#', convert '..' to '^',
|
2008-10-03 14:49:38 +02:00
|
|
|
|
convert ':' to '~' on DOS based file system. */
|
2011-11-12 12:35:42 +01:00
|
|
|
|
const char *probe;
|
2003-07-06 20:59:38 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
#if HAVE_DOS_BASED_FILE_SYSTEM
|
|
|
|
|
if (base[0] && base[1] == ':')
|
2008-10-03 14:49:38 +02:00
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
ptr[0] = base[0];
|
|
|
|
|
ptr[1] = '~';
|
|
|
|
|
ptr += 2;
|
|
|
|
|
base += 2;
|
|
|
|
|
}
|
2008-10-03 14:49:38 +02:00
|
|
|
|
#endif
|
2011-11-12 12:35:42 +01:00
|
|
|
|
for (; *base; base = probe)
|
|
|
|
|
{
|
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
|
|
for (probe = base; *probe; probe++)
|
|
|
|
|
if (*probe == '/')
|
|
|
|
|
break;
|
|
|
|
|
len = probe - base;
|
|
|
|
|
if (len == 2 && base[0] == '.' && base[1] == '.')
|
|
|
|
|
*ptr++ = '^';
|
|
|
|
|
else
|
2008-10-03 14:49:38 +02:00
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
memcpy (ptr, base, len);
|
|
|
|
|
ptr += len;
|
2008-10-03 14:49:38 +02:00
|
|
|
|
}
|
2011-11-12 12:35:42 +01:00
|
|
|
|
if (*probe)
|
2011-03-25 20:20:52 +01:00
|
|
|
|
{
|
2011-11-12 12:35:42 +01:00
|
|
|
|
*ptr++ = '#';
|
|
|
|
|
probe++;
|
2011-03-25 20:20:52 +01:00
|
|
|
|
}
|
2003-07-06 20:59:38 +02:00
|
|
|
|
}
|
1997-03-28 23:43:13 +01:00
|
|
|
|
}
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2011-11-12 12:35:42 +01:00
|
|
|
|
return ptr;
|
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)
|
|
|
|
|
{
|
2011-11-10 20:17:13 +01:00
|
|
|
|
src = &sources[*++encoding];
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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;
|
2011-12-02 21:32:40 +01:00
|
|
|
|
if (!block->exceptional)
|
|
|
|
|
line->unexceptional = 1;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
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
|
|
|
|
{
|
2011-11-10 20:17:13 +01:00
|
|
|
|
line_t *block_line = line;
|
|
|
|
|
|
|
|
|
|
if (!block_line)
|
|
|
|
|
block_line = &sources[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)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
config/iq2000/iq2000.c, config/m32r/m32r.c,
config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
config/sh/symbian.c, config/stormy16/stormy16.c,
config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
and %> as appropriate. Use %' as apostrophe in diagnostics where
applicable. Use %< and %> in place of '' quotes where applicable.
Use %qs in place of %<%s%>. Consistently quote __builtin function
names.
ada:
* misc.c (gnat_handle_option): Use %< and %> for quoting in
warning message.
cp:
* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
quoting in diagnostics.
* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
quoting in printf format.
* decl.c (duplicate_decls, start_decl): Use %qD instead of
unquoted %D.
objc:
* objc-act.c: Use %q, %< and %> for quoting in diagnostics.
testsuite:
* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.
From-SVN: r90337
2004-11-09 11:13:30 +01:00
|
|
|
|
fnotice (stderr, "%s:no lines for '%s'\n", bbg_file_name, fn->name);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
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. */
|
2016-08-04 17:05:35 +02:00
|
|
|
|
for (fn = src->functions, fn_p = NULL; fn; fn_p = fn, fn = fn_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
|
|
|
|
{
|
2016-08-05 15:50:02 +02:00
|
|
|
|
fn_n = fn->next_file_fn;
|
|
|
|
|
fn->next_file_fn = fn_p;
|
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->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)
|
2016-08-05 15:50:49 +02:00
|
|
|
|
if (flag_branches)
|
|
|
|
|
add_branch_counts (&src->coverage, arc);
|
2003-04-06 15:18:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 15:50:49 +02:00
|
|
|
|
/* Cycle detection. */
|
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
|
|
|
|
{
|
2016-08-05 15:50:49 +02:00
|
|
|
|
for (arc_t *arc = block->pred; arc; arc = arc->pred_next)
|
|
|
|
|
if (!line->has_block (arc->src))
|
|
|
|
|
count += arc->count;
|
|
|
|
|
for (arc_t *arc = block->succ; arc; arc = arc->succ_next)
|
|
|
|
|
arc->cs_count = arc->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
|
|
|
|
}
|
2003-04-06 15:18:41 +02:00
|
|
|
|
|
2016-08-05 15:50:49 +02:00
|
|
|
|
/* Now, add the count of loops entirely on this line. */
|
|
|
|
|
count += get_cycles_count (*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
|
|
|
|
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
|
|
|
|
|
c-typeck.c, [...]: Fix comment typos.
* c-typeck.c, cfgexpand.c, ddg.c, ddg.h, df.c, fold-const.c,
gcov.c, gimplify.c, modulo-sched.c, passes.c, tree-cfg.c,
tree-mudflap.c, tree-nrv.c, tree-outof-ssa.c, tree-ssa-dom.c,
tree-ssa-dse.c, tree-ssa-operands.c, tree-ssa-pre.c,
tree-tailcall.c: Fix comment typos. Follow spelling
conventions.
From-SVN: r83703
2004-06-26 07:03:55 +02:00
|
|
|
|
/* Output 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
|
|
|
|
{
|
|
|
|
|
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),
|
2011-12-02 21:32:40 +01:00
|
|
|
|
arc->fall_through ? " (fallthrough)"
|
|
|
|
|
: arc->is_throw ? " (throw)" : "");
|
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
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-11 19:58:30 +01:00
|
|
|
|
static const char *
|
|
|
|
|
read_line (FILE *file)
|
|
|
|
|
{
|
|
|
|
|
static char *string;
|
|
|
|
|
static size_t string_len;
|
|
|
|
|
size_t pos = 0;
|
|
|
|
|
char *ptr;
|
|
|
|
|
|
|
|
|
|
if (!string_len)
|
|
|
|
|
{
|
|
|
|
|
string_len = 200;
|
|
|
|
|
string = XNEWVEC (char, string_len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while ((ptr = fgets (string + pos, string_len - pos, file)))
|
|
|
|
|
{
|
|
|
|
|
size_t len = strlen (string + pos);
|
|
|
|
|
|
2017-03-31 04:52:39 +02:00
|
|
|
|
if (len && string[pos + len - 1] == '\n')
|
2012-01-11 19:58:30 +01:00
|
|
|
|
{
|
|
|
|
|
string[pos + len - 1] = 0;
|
|
|
|
|
return string;
|
|
|
|
|
}
|
|
|
|
|
pos += len;
|
2017-03-31 04:52:39 +02:00
|
|
|
|
/* If the file contains NUL characters or an incomplete
|
|
|
|
|
last line, which can happen more than once in one run,
|
|
|
|
|
we have to avoid doubling the STRING_LEN unnecessarily. */
|
|
|
|
|
if (pos > string_len / 2)
|
|
|
|
|
{
|
|
|
|
|
string_len *= 2;
|
|
|
|
|
string = XRESIZEVEC (char, string, string_len);
|
|
|
|
|
}
|
2012-01-11 19:58:30 +01:00
|
|
|
|
}
|
2016-08-04 17:05:35 +02:00
|
|
|
|
|
2012-01-11 19:58:30 +01:00
|
|
|
|
return pos ? string : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
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. */
|
2012-01-11 19:58:30 +01:00
|
|
|
|
const char *retval = ""; /* status of source file reading. */
|
2005-03-21 13:31:10 +01:00
|
|
|
|
function_t *fn = NULL;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
2011-11-13 11:26:23 +01:00
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Source:%s\n", "-", 0, src->coverage.name);
|
2007-06-12 17:39:15 +02:00
|
|
|
|
if (!multiple_files)
|
|
|
|
|
{
|
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Graph:%s\n", "-", 0, bbg_file_name);
|
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Data:%s\n", "-", 0,
|
|
|
|
|
no_data_file ? "-" : da_file_name);
|
2011-11-07 19:14:46 +01:00
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Runs:%u\n", "-", 0, object_runs);
|
2007-06-12 17:39:15 +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, "%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)
|
|
|
|
|
{
|
2011-11-13 11:26:23 +01:00
|
|
|
|
fnotice (stderr, "Cannot open source file %s\n", src->name);
|
2002-08-07 01:18:01 +02:00
|
|
|
|
retval = NULL;
|
|
|
|
|
}
|
2007-06-12 17:39:15 +02:00
|
|
|
|
else if (src->file_time == 0)
|
|
|
|
|
fprintf (gcov_file, "%9s:%5d:Source is newer than graph\n", "-", 0);
|
2002-08-07 01:18:01 +02:00
|
|
|
|
|
2005-03-21 13:31:10 +01:00
|
|
|
|
if (flag_branches)
|
|
|
|
|
fn = src->functions;
|
|
|
|
|
|
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
|
|
|
|
{
|
2016-08-05 15:50:02 +02:00
|
|
|
|
for (; fn && fn->line == line_num; fn = fn->next_file_fn)
|
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
|
|
|
|
{
|
2012-07-23 11:24:21 +02:00
|
|
|
|
arc_t *arc = fn->blocks[EXIT_BLOCK].pred;
|
|
|
|
|
gcov_type return_count = fn->blocks[EXIT_BLOCK].count;
|
|
|
|
|
gcov_type called_count = fn->blocks[ENTRY_BLOCK].count;
|
2009-11-25 11:55:54 +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
|
|
|
|
for (; arc; arc = arc->pred_next)
|
|
|
|
|
if (arc->fake)
|
|
|
|
|
return_count -= arc->count;
|
2009-11-25 11:55:54 +01:00
|
|
|
|
|
2013-06-20 07:20:09 +02:00
|
|
|
|
fprintf (gcov_file, "function %s", flag_demangled_names ?
|
|
|
|
|
fn->demangled_name : fn->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
|
|
|
|
fprintf (gcov_file, " called %s",
|
2012-07-23 11:24:21 +02:00
|
|
|
|
format_gcov (called_count, 0, -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
|
|
|
|
fprintf (gcov_file, " returned %s",
|
2012-07-23 11:24:21 +02:00
|
|
|
|
format_gcov (return_count, called_count, 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
|
|
|
|
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
|
|
|
|
|
2012-01-11 19:58:30 +01:00
|
|
|
|
if (retval)
|
|
|
|
|
retval = read_line (source_file);
|
|
|
|
|
|
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
|
2012-01-11 19:58:30 +01:00
|
|
|
|
executed, print '#####' or '=====' 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. */
|
|
|
|
|
fprintf (gcov_file, "%9s:%5u:%s\n",
|
2011-12-02 21:32:40 +01:00
|
|
|
|
!line->exists ? "-" : line->count
|
|
|
|
|
? format_gcov (line->count, 0, -1)
|
2012-01-11 19:58:30 +01:00
|
|
|
|
: line->unexceptional ? "#####" : "=====", line_num,
|
|
|
|
|
retval ? retval : "/*EOF*/");
|
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",
|
2011-12-02 21:32:40 +01:00
|
|
|
|
!line->exists ? "-" : block->count
|
|
|
|
|
? format_gcov (block->count, 0, -1)
|
|
|
|
|
: block->exceptional ? "%%%%%" : "$$$$$",
|
2003-04-06 15:18:41 +02:00
|
|
|
|
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)
|
|
|
|
|
{
|
2012-01-11 19:58:30 +01:00
|
|
|
|
for (; (retval = read_line (source_file)); line_num++)
|
|
|
|
|
fprintf (gcov_file, "%9s:%5u:%s\n", "-", line_num, retval);
|
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);
|
|
|
|
|
}
|