Commit eeabee0a by Nathan Sidwell Committed by Nathan Sidwell

gcov.c (struct name_map): New.

	* gcov.c (struct name_map): New.
	(names, n_names, a_names): New global vars.
	(print_usage): Adjust usage.
	(generate_results): Canonicalize main file name.
	(release_structures): Adjust.
	(name_search, name_sort): New callbacks.
	(find_source): Look for and create a canonical name.
	(canonicalize_name): New.
	(make_gcov_file_name): Reimplement and fix mangling.
	(mangle_name): New.
	* doc/gcov.texi: Update documentation about path preservation.

	testsuite/
	* gcc.misc-tests/gcov-15.c: New.

From-SVN: r181309
parent 926706f8
2011-11-12 Nathan Sidwell <nathan@acm.org>
* gcov.c (struct name_map): New.
(names, n_names, a_names): New global vars.
(print_usage): Adjust usage.
(generate_results): Canonicalize main file name.
(release_structures): Adjust.
(name_search, name_sort): New callbacks.
(find_source): Look for and create a canonical name.
(canonicalize_name): New.
(make_gcov_file_name): Reimplement and fix mangling.
(mangle_name): New.
* doc/gcov.texi: Update documentation about path preservation.
2011-11-11 David S. Miller <davem@davemloft.net>
* config/sparc/linux.h (ASM_GENERATE_INTERNAL_LABEL): Delete.
......@@ -113,7 +113,7 @@ compatible with any other profiling or test coverage mechanism.
@section Invoking @command{gcov}
@smallexample
gcov @r{[}@var{options}@r{]} @var{sourcefiles}
gcov @r{[}@var{options}@r{]} @var{files}
@end smallexample
@command{gcov} accepts the following options:
......@@ -176,11 +176,12 @@ Do not create the @command{gcov} output file.
@itemx --long-file-names
Create long file names for included source files. For example, if the
header file @file{x.h} contains code, and was included in the file
@file{a.c}, then running @command{gcov} on the file @file{a.c} will produce
an output file called @file{a.c##x.h.gcov} instead of @file{x.h.gcov}.
This can be useful if @file{x.h} is included in multiple source
files. If you use the @samp{-p} option, both the including and
included file names will be complete path names.
@file{a.c}, then running @command{gcov} on the file @file{a.c} will
produce an output file called @file{a.c##x.h.gcov} instead of
@file{x.h.gcov}. This can be useful if @file{x.h} is included in
multiple source files and you want to see the individual
contributions. If you use the @samp{-p} option, both the including
and included file names will be complete path names.
@item -p
@itemx --preserve-paths
......@@ -188,9 +189,9 @@ Preserve complete path information in the names of generated
@file{.gcov} files. Without this option, just the filename component is
used. With this option, all directories are used, with @samp{/} characters
translated to @samp{#} characters, @file{.} directory components
removed and @file{..}
removed and unremoveable @file{..}
components renamed to @samp{^}. This is useful if sourcefiles are in several
different directories. It also affects the @samp{-l} option.
different directories.
@item -f
@itemx --function-summaries
......@@ -203,9 +204,8 @@ Specify either the directory containing the gcov data files, or the
object path name. The @file{.gcno}, and
@file{.gcda} data files are searched for using this option. If a directory
is specified, the data files are in that directory and named after the
source file name, without its extension. If a file is specified here,
the data files are named after that file, without its extension. If this
option is not supplied, it defaults to the current directory.
input file name, without its extension. If a file is specified here,
the data files are named after that file, without its extension.
@item -u
@itemx --unconditional-branches
......@@ -223,12 +223,17 @@ when you invoked the compiler. Otherwise it will not be able to locate
the source files. @command{gcov} produces files called
@file{@var{mangledname}.gcov} in the current directory. These contain
the coverage information of the source file they correspond to.
One @file{.gcov} file is produced for each source file containing code,
One @file{.gcov} file is produced for each source (or header) file
containing code,
which was compiled to produce the data files. The @var{mangledname} part
of the output file name is usually simply the source file name, but can
be something more complicated if the @samp{-l} or @samp{-p} options are
given. Refer to those options for details.
If you invoke @command{gcov} with multiple input files, the
contributions from each input file are summed. Typically you would
invoke it with the same list of files as the final link of your executable.
The @file{.gcov} files contain the @samp{:} separated fields along with
program source code. The format is
......
2011-11-12 Nathan Sidwell <nathan@acm.org>
* gcc.misc-tests/gcov-15.c: New.
2011-11-11 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/51058
......
/* Test gcov multiple paths to file. */
/* { dg-options "-fprofile-arcs -ftest-coverage" } */
/* { dg-do run { target native } } */
#if !RECURSIVE
#define RECURSIVE 1
#include "./gcov-15.c"
#undef RECURSIVE
#endif
static void __attribute__ ((noinline)) Recursive (void);
#if RECURSIVE
static void __attribute__ ((noinline))
Recursive ()
{
return; /* count(1) */
}
#else
int main ()
{
Recursive (); /* count(1) */
return 0;
}
#endif
/* { dg-final { run-gcov { -a gcov-15.c } } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment