* [PATCH] Force use of absolute path names for gcov
@ 2017-04-21 18:51 Bernd Edlinger
2017-04-21 20:27 ` Joseph Myers
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-04-21 18:51 UTC (permalink / raw)
To: gcc-patches, Nathan Sidwell, Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 583 bytes --]
Hi!
If gcov is used in projects where gcc is invoked in different
directories, it may happen that the same source is compiled
with different relative names, and the gcov tool is thus unable
to find out, if it is the same source file or not, or to dump the
source at all, which is a limitation of the gcov tool.
So I would like to add a -fprofile-abs-path option that
forces absolute path names in gcno files, which allows gcov
to get the true canonicalized source name.
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?
Thanks
Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: changelog-gcov-abs-path.diff --]
[-- Type: text/x-patch; name="changelog-gcov-abs-path.diff", Size: 498 bytes --]
gcc:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.texi: Document the -fprofile-abs-path option.
* common.opt (fprofile-abs-path): New option.
* gcov-io.h (gcov_write_filename): Declare.
* gcov-io.c (gcov_write_filename): New function.
* coverage.c (coverage_begin_function): Use gcov_write_filename.
* profile.c (output_location): Likewise.
gcc/testsuite:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc.misc-tests/gcov-1a.c: New test.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch-gcov-abs-path.diff --]
[-- Type: text/x-patch; name="patch-gcov-abs-path.diff", Size: 4925 bytes --]
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 246571)
+++ gcc/common.opt (working copy)
@@ -1965,6 +1965,10 @@ fprofile
Common Report Var(profile_flag)
Enable basic program profiling code.
+fprofile-abs-path
+Common Report Var(profile_abs_path_flag)
+Generate absolute source path names for gcov.
+
fprofile-arcs
Common Report Var(profile_arc_flag)
Insert arc-based program profiling code.
Index: gcc/coverage.c
===================================================================
--- gcc/coverage.c (revision 246571)
+++ gcc/coverage.c (working copy)
@@ -663,7 +663,7 @@ coverage_begin_function (unsigned lineno_checksum,
gcov_write_unsigned (cfg_checksum);
gcov_write_string (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (current_function_decl)));
- gcov_write_string (xloc.file);
+ gcov_write_filename (xloc.file);
gcov_write_unsigned (xloc.line);
gcov_write_length (offset);
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 246571)
+++ gcc/doc/invoke.texi (working copy)
@@ -441,6 +441,7 @@ Objective-C and Objective-C++ Dialects}.
@item Program Instrumentation Options
@xref{Instrumentation Options,,Program Instrumentation Options}.
@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
+-fprofile-abs-path @gol
-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
@@ -10639,6 +10640,12 @@ additional @option{-ftest-coverage} option. You d
every source file in a program.
@item
+Compile the source files additionally with @option{-fprofile-abs-path}
+to create absolute path names in the @file{.gcno} files. This allows
+@command{gcov} to find the correct sources in projects with multiple
+directories.
+
+@item
Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
(the latter implies the former).
Index: gcc/gcov-io.c
===================================================================
--- gcc/gcov-io.c (revision 246571)
+++ gcc/gcov-io.c (working copy)
@@ -353,6 +353,37 @@ gcov_write_string (const char *string)
#endif
#if !IN_LIBGCOV
+/* Write FILENAME to coverage file. Sets error flag on file
+ error, overflow flag on overflow */
+
+GCOV_LINKAGE void
+gcov_write_filename (const char *filename)
+{
+ char buf[1024];
+ size_t len;
+
+ if (profile_abs_path_flag && filename && filename[0]
+ && !(IS_DIR_SEPARATOR (filename[0])
+#if HAVE_DOS_BASED_FILE_SYSTEM
+ || filename[1] == ':'
+#endif
+ )
+ && (len = strlen (filename)) < sizeof (buf) - 1)
+ {
+ if (getcwd (buf, sizeof (buf) - len - 1) != NULL)
+ {
+ if (buf[0] && !IS_DIR_SEPARATOR (buf[strlen (buf) - 1]))
+ strcat (buf, "/");
+ strcat (buf, filename);
+ filename = buf;
+ }
+ }
+
+ return gcov_write_string (filename);
+}
+#endif
+
+#if !IN_LIBGCOV
/* Write a tag TAG and reserve space for the record length. Return a
value to be used for gcov_write_length. */
Index: gcc/gcov-io.h
===================================================================
--- gcc/gcov-io.h (revision 246571)
+++ gcc/gcov-io.h (working copy)
@@ -388,6 +388,7 @@ GCOV_LINKAGE void gcov_write_unsigned (gcov_unsign
/* Available only in compiler */
GCOV_LINKAGE unsigned gcov_histo_index (gcov_type value);
GCOV_LINKAGE void gcov_write_string (const char *);
+GCOV_LINKAGE void gcov_write_filename (const char *);
GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t);
GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/);
#endif
Index: gcc/profile.c
===================================================================
--- gcc/profile.c (revision 246571)
+++ gcc/profile.c (working copy)
@@ -956,7 +956,7 @@ output_location (char const *file_name, int line,
{
prev_file_name = file_name;
gcov_write_unsigned (0);
- gcov_write_string (prev_file_name);
+ gcov_write_filename (prev_file_name);
}
if (line_differs)
{
Index: gcc/testsuite/gcc.misc-tests/gcov-1a.c
===================================================================
--- gcc/testsuite/gcc.misc-tests/gcov-1a.c (revision 0)
+++ gcc/testsuite/gcc.misc-tests/gcov-1a.c (working copy)
@@ -0,0 +1,20 @@
+/* Test Gcov basics. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage -fprofile-abs-path" } */
+/* { dg-do run { target native } } */
+
+void noop ()
+{
+}
+
+int main ()
+{
+ int i;
+
+ for (i = 0; i < 10; i++) /* count(11) */
+ noop (); /* count(10) */
+
+ return 0; /* count(1) */
+}
+
+/* { dg-final { run-gcov gcov-1a.c } } */
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Force use of absolute path names for gcov
2017-04-21 18:51 [PATCH] Force use of absolute path names for gcov Bernd Edlinger
@ 2017-04-21 20:27 ` Joseph Myers
2017-04-21 20:57 ` Bernd Edlinger
0 siblings, 1 reply; 13+ messages in thread
From: Joseph Myers @ 2017-04-21 20:27 UTC (permalink / raw)
To: Bernd Edlinger; +Cc: gcc-patches, Nathan Sidwell, Jan Hubicka
On Fri, 21 Apr 2017, Bernd Edlinger wrote:
> So I would like to add a -fprofile-abs-path option that
> forces absolute path names in gcno files, which allows gcov
> to get the true canonicalized source name.
I don't see any actual documentation of this option in the patch (you add
it to the summary list of options, and mention it in text under the
documentation of --coverage, but don't have any actual @item
-fprofile-abs-path / @opindex fprofile-abs-path paragraph with text
describing what the option does).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Force use of absolute path names for gcov
2017-04-21 20:27 ` Joseph Myers
@ 2017-04-21 20:57 ` Bernd Edlinger
2017-04-28 18:14 ` [PING] " Bernd Edlinger
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-04-21 20:57 UTC (permalink / raw)
To: Joseph Myers; +Cc: gcc-patches, Nathan Sidwell, Jan Hubicka
On 04/21/17 21:50, Joseph Myers wrote:
> On Fri, 21 Apr 2017, Bernd Edlinger wrote:
>
>> So I would like to add a -fprofile-abs-path option that
>> forces absolute path names in gcno files, which allows gcov
>> to get the true canonicalized source name.
>
> I don't see any actual documentation of this option in the patch (you add
> it to the summary list of options, and mention it in text under the
> documentation of --coverage, but don't have any actual @item
> -fprofile-abs-path / @opindex fprofile-abs-path paragraph with text
> describing what the option does).
>
Ah yes, thanks.
So I'll add one more sentence to invoke.texi:
@@ -10696,6 +10713,12 @@
generate test coverage data. Coverage data matches the source files
more closely if you do not optimize.
+@item -fprofile-abs-path
+@opindex fprofile-abs-path
+Automatically convert relative source file names to absolute path names
+in the @file{.gcno} files. This allows @command{gcov} to find the correct
+sources in projects with multiple directories.
+
@item -fprofile-dir=@var{path}
@opindex fprofile-dir
Bernd.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PING] [PATCH] Force use of absolute path names for gcov
2017-04-21 20:57 ` Bernd Edlinger
@ 2017-04-28 18:14 ` Bernd Edlinger
2017-05-12 16:48 ` [PING**2] " Bernd Edlinger
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-04-28 18:14 UTC (permalink / raw)
To: Joseph Myers; +Cc: gcc-patches, Nathan Sidwell, Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]
Ping...
I attached a rebased patch file, with the doc changes and
merge conflicts with trunk of today fixed, but otherwise
identical.
Thanks
Bernd.
On 04/21/17 22:26, Bernd Edlinger wrote:
>
>
> On 04/21/17 21:50, Joseph Myers wrote:
>> On Fri, 21 Apr 2017, Bernd Edlinger wrote:
>>
>>> So I would like to add a -fprofile-abs-path option that
>>> forces absolute path names in gcno files, which allows gcov
>>> to get the true canonicalized source name.
>>
>> I don't see any actual documentation of this option in the patch (you add
>> it to the summary list of options, and mention it in text under the
>> documentation of --coverage, but don't have any actual @item
>> -fprofile-abs-path / @opindex fprofile-abs-path paragraph with text
>> describing what the option does).
>>
>
> Ah yes, thanks.
>
> So I'll add one more sentence to invoke.texi:
>
> @@ -10696,6 +10713,12 @@
> generate test coverage data. Coverage data matches the source files
> more closely if you do not optimize.
>
> +@item -fprofile-abs-path
> +@opindex fprofile-abs-path
> +Automatically convert relative source file names to absolute path names
> +in the @file{.gcno} files. This allows @command{gcov} to find the correct
> +sources in projects with multiple directories.
> +
> @item -fprofile-dir=@var{path}
> @opindex fprofile-dir
>
>
>
>
> Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: changelog-gcov-abs-path.diff --]
[-- Type: text/x-patch; name="changelog-gcov-abs-path.diff", Size: 498 bytes --]
gcc:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.texi: Document the -fprofile-abs-path option.
* common.opt (fprofile-abs-path): New option.
* gcov-io.h (gcov_write_filename): Declare.
* gcov-io.c (gcov_write_filename): New function.
* coverage.c (coverage_begin_function): Use gcov_write_filename.
* profile.c (output_location): Likewise.
gcc/testsuite:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc.misc-tests/gcov-1a.c: New test.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch-gcov-abs-path.diff --]
[-- Type: text/x-patch; name="patch-gcov-abs-path.diff", Size: 5383 bytes --]
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 246571)
+++ gcc/common.opt (working copy)
@@ -1965,6 +1965,10 @@ fprofile
Common Report Var(profile_flag)
Enable basic program profiling code.
+fprofile-abs-path
+Common Report Var(profile_abs_path_flag)
+Generate absolute source path names for gcov.
+
fprofile-arcs
Common Report Var(profile_arc_flag)
Insert arc-based program profiling code.
Index: gcc/coverage.c
===================================================================
--- gcc/coverage.c (revision 246571)
+++ gcc/coverage.c (working copy)
@@ -663,7 +663,7 @@ coverage_begin_function (unsigned lineno_checksum,
gcov_write_unsigned (cfg_checksum);
gcov_write_string (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (current_function_decl)));
- gcov_write_string (xloc.file);
+ gcov_write_filename (xloc.file);
gcov_write_unsigned (xloc.line);
gcov_write_length (offset);
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 246571)
+++ gcc/doc/invoke.texi (working copy)
@@ -441,6 +441,7 @@ Objective-C and Objective-C++ Dialects}.
@item Program Instrumentation Options
@xref{Instrumentation Options,,Program Instrumentation Options}.
@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
+-fprofile-abs-path @gol
-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
@@ -10639,6 +10640,12 @@ additional @option{-ftest-coverage} option. You d
every source file in a program.
@item
+Compile the source files additionally with @option{-fprofile-abs-path}
+to create absolute path names in the @file{.gcno} files. This allows
+@command{gcov} to find the correct sources in projects with multiple
+directories.
+
+@item
Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
(the latter implies the former).
@@ -10696,6 +10713,12 @@
generate test coverage data. Coverage data matches the source files
more closely if you do not optimize.
+@item -fprofile-abs-path
+@opindex fprofile-abs-path
+Automatically convert relative source file names to absolute path names
+in the @file{.gcno} files. This allows @command{gcov} to find the correct
+sources in projects with multiple directories.
+
@item -fprofile-dir=@var{path}
@opindex fprofile-dir
Index: gcc/gcov-io.c
===================================================================
--- gcc/gcov-io.c (revision 246571)
+++ gcc/gcov-io.c (working copy)
@@ -353,6 +353,37 @@ gcov_write_string (const char *string)
#endif
#if !IN_LIBGCOV
+/* Write FILENAME to coverage file. Sets error flag on file
+ error, overflow flag on overflow */
+
+GCOV_LINKAGE void
+gcov_write_filename (const char *filename)
+{
+ char buf[1024];
+ size_t len;
+
+ if (profile_abs_path_flag && filename && filename[0]
+ && !(IS_DIR_SEPARATOR (filename[0])
+#if HAVE_DOS_BASED_FILE_SYSTEM
+ || filename[1] == ':'
+#endif
+ )
+ && (len = strlen (filename)) < sizeof (buf) - 1)
+ {
+ if (getcwd (buf, sizeof (buf) - len - 1) != NULL)
+ {
+ if (buf[0] && !IS_DIR_SEPARATOR (buf[strlen (buf) - 1]))
+ strcat (buf, "/");
+ strcat (buf, filename);
+ filename = buf;
+ }
+ }
+
+ return gcov_write_string (filename);
+}
+#endif
+
+#if !IN_LIBGCOV
/* Write a tag TAG and reserve space for the record length. Return a
value to be used for gcov_write_length. */
Index: gcc/gcov-io.h
===================================================================
--- gcc/gcov-io.h (revision 246571)
+++ gcc/gcov-io.h (working copy)
@@ -388,6 +388,7 @@ GCOV_LINKAGE void gcov_write_unsigned (gcov_unsign
/* Available only in compiler */
GCOV_LINKAGE unsigned gcov_histo_index (gcov_type value);
GCOV_LINKAGE void gcov_write_string (const char *);
+GCOV_LINKAGE void gcov_write_filename (const char *);
GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t);
GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/);
#endif
Index: gcc/profile.c
===================================================================
--- gcc/profile.c (revision 246571)
+++ gcc/profile.c (working copy)
@@ -956,7 +956,7 @@ output_location (char const *file_name, int line,
{
prev_file_name = file_name;
gcov_write_unsigned (0);
- gcov_write_string (prev_file_name);
+ gcov_write_filename (prev_file_name);
}
if (line_differs)
{
Index: gcc/testsuite/gcc.misc-tests/gcov-1a.c
===================================================================
--- gcc/testsuite/gcc.misc-tests/gcov-1a.c (revision 0)
+++ gcc/testsuite/gcc.misc-tests/gcov-1a.c (working copy)
@@ -0,0 +1,20 @@
+/* Test Gcov basics. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage -fprofile-abs-path" } */
+/* { dg-do run { target native } } */
+
+void noop ()
+{
+}
+
+int main ()
+{
+ int i;
+
+ for (i = 0; i < 10; i++) /* count(11) */
+ noop (); /* count(10) */
+
+ return 0; /* count(1) */
+}
+
+/* { dg-final { run-gcov gcov-1a.c } } */
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PING**2] [PATCH] Force use of absolute path names for gcov
2017-04-28 18:14 ` [PING] " Bernd Edlinger
@ 2017-05-12 16:48 ` Bernd Edlinger
2017-06-01 15:59 ` [PING**3] " Bernd Edlinger
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-05-12 16:48 UTC (permalink / raw)
To: Joseph Myers; +Cc: gcc-patches, Nathan Sidwell, Jan Hubicka
Ping...
On 04/28/17 19:41, Bernd Edlinger wrote:
> Ping...
>
> I attached a rebased patch file, with the doc changes and
> merge conflicts with trunk of today fixed, but otherwise
> identical.
>
>
> Thanks
> Bernd.
>
> On 04/21/17 22:26, Bernd Edlinger wrote:
>>
>>
>> On 04/21/17 21:50, Joseph Myers wrote:
>>> On Fri, 21 Apr 2017, Bernd Edlinger wrote:
>>>
>>>> So I would like to add a -fprofile-abs-path option that
>>>> forces absolute path names in gcno files, which allows gcov
>>>> to get the true canonicalized source name.
>>>
>>> I don't see any actual documentation of this option in the patch (you
>>> add
>>> it to the summary list of options, and mention it in text under the
>>> documentation of --coverage, but don't have any actual @item
>>> -fprofile-abs-path / @opindex fprofile-abs-path paragraph with text
>>> describing what the option does).
>>>
>>
>> Ah yes, thanks.
>>
>> So I'll add one more sentence to invoke.texi:
>>
>> @@ -10696,6 +10713,12 @@
>> generate test coverage data. Coverage data matches the source files
>> more closely if you do not optimize.
>>
>> +@item -fprofile-abs-path
>> +@opindex fprofile-abs-path
>> +Automatically convert relative source file names to absolute path names
>> +in the @file{.gcno} files. This allows @command{gcov} to find the
>> correct
>> +sources in projects with multiple directories.
>> +
>> @item -fprofile-dir=@var{path}
>> @opindex fprofile-dir
>>
>>
>>
>>
>> Bernd.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PING**3] [PATCH] Force use of absolute path names for gcov
2017-05-12 16:48 ` [PING**2] " Bernd Edlinger
@ 2017-06-01 15:59 ` Bernd Edlinger
2017-06-01 17:52 ` Nathan Sidwell
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-06-01 15:59 UTC (permalink / raw)
To: Joseph Myers; +Cc: gcc-patches, Nathan Sidwell, Jan Hubicka
Ping...
On 05/12/17 18:47, Bernd Edlinger wrote:
> Ping...
>
> On 04/28/17 19:41, Bernd Edlinger wrote:
>> Ping...
>>
>> I attached a rebased patch file, with the doc changes and
>> merge conflicts with trunk of today fixed, but otherwise
>> identical.
>>
>>
>> Thanks
>> Bernd.
>>
>> On 04/21/17 22:26, Bernd Edlinger wrote:
>>>
>>>
>>> On 04/21/17 21:50, Joseph Myers wrote:
>>>> On Fri, 21 Apr 2017, Bernd Edlinger wrote:
>>>>
>>>>> So I would like to add a -fprofile-abs-path option that
>>>>> forces absolute path names in gcno files, which allows gcov
>>>>> to get the true canonicalized source name.
>>>>
>>>> I don't see any actual documentation of this option in the patch (you
>>>> add
>>>> it to the summary list of options, and mention it in text under the
>>>> documentation of --coverage, but don't have any actual @item
>>>> -fprofile-abs-path / @opindex fprofile-abs-path paragraph with text
>>>> describing what the option does).
>>>>
>>>
>>> Ah yes, thanks.
>>>
>>> So I'll add one more sentence to invoke.texi:
>>>
>>> @@ -10696,6 +10713,12 @@
>>> generate test coverage data. Coverage data matches the source files
>>> more closely if you do not optimize.
>>>
>>> +@item -fprofile-abs-path
>>> +@opindex fprofile-abs-path
>>> +Automatically convert relative source file names to absolute path names
>>> +in the @file{.gcno} files. This allows @command{gcov} to find the
>>> correct
>>> +sources in projects with multiple directories.
>>> +
>>> @item -fprofile-dir=@var{path}
>>> @opindex fprofile-dir
>>>
>>>
>>>
>>>
>>> Bernd.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PING**3] [PATCH] Force use of absolute path names for gcov
2017-06-01 15:59 ` [PING**3] " Bernd Edlinger
@ 2017-06-01 17:52 ` Nathan Sidwell
2017-06-01 19:24 ` Bernd Edlinger
0 siblings, 1 reply; 13+ messages in thread
From: Nathan Sidwell @ 2017-06-01 17:52 UTC (permalink / raw)
To: Bernd Edlinger, Joseph Myers; +Cc: gcc-patches, Jan Hubicka
On 06/01/2017 11:59 AM, Bernd Edlinger wrote:
> Ping...
What are you asking to be reviewed by who?
nathan
--
Nathan Sidwell
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PING**3] [PATCH] Force use of absolute path names for gcov
2017-06-01 17:52 ` Nathan Sidwell
@ 2017-06-01 19:24 ` Bernd Edlinger
2017-06-02 11:35 ` Nathan Sidwell
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-06-01 19:24 UTC (permalink / raw)
To: Nathan Sidwell, Joseph Myers; +Cc: gcc-patches, Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 528 bytes --]
On 06/01/17 19:52, Nathan Sidwell wrote:
> On 06/01/2017 11:59 AM, Bernd Edlinger wrote:
>> Ping...
>
> What are you asking to be reviewed by who?
>
> nathan
>
Aehm, sorry.
This is a gcc option that converts relative
path names to absolute ones, so that gcov can
properly merge the line numbers in projects
where different relative path names may refer
to the same source file.
I would like a review from one of gcov maintainers.
I attached the patch again for your convenience.
Thanks
Bernd.
[-- Attachment #2: changelog-gcov-abs-path.txt --]
[-- Type: text/plain, Size: 498 bytes --]
gcc:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.texi: Document the -fprofile-abs-path option.
* common.opt (fprofile-abs-path): New option.
* gcov-io.h (gcov_write_filename): Declare.
* gcov-io.c (gcov_write_filename): New function.
* coverage.c (coverage_begin_function): Use gcov_write_filename.
* profile.c (output_location): Likewise.
gcc/testsuite:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc.misc-tests/gcov-1a.c: New test.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch-gcov-abs-path.diff --]
[-- Type: text/x-patch; name="patch-gcov-abs-path.diff", Size: 5383 bytes --]
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 246571)
+++ gcc/common.opt (working copy)
@@ -1965,6 +1965,10 @@ fprofile
Common Report Var(profile_flag)
Enable basic program profiling code.
+fprofile-abs-path
+Common Report Var(profile_abs_path_flag)
+Generate absolute source path names for gcov.
+
fprofile-arcs
Common Report Var(profile_arc_flag)
Insert arc-based program profiling code.
Index: gcc/coverage.c
===================================================================
--- gcc/coverage.c (revision 246571)
+++ gcc/coverage.c (working copy)
@@ -663,7 +663,7 @@ coverage_begin_function (unsigned lineno_checksum,
gcov_write_unsigned (cfg_checksum);
gcov_write_string (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (current_function_decl)));
- gcov_write_string (xloc.file);
+ gcov_write_filename (xloc.file);
gcov_write_unsigned (xloc.line);
gcov_write_length (offset);
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 246571)
+++ gcc/doc/invoke.texi (working copy)
@@ -441,6 +441,7 @@ Objective-C and Objective-C++ Dialects}.
@item Program Instrumentation Options
@xref{Instrumentation Options,,Program Instrumentation Options}.
@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
+-fprofile-abs-path @gol
-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
@@ -10639,6 +10640,12 @@ additional @option{-ftest-coverage} option. You d
every source file in a program.
@item
+Compile the source files additionally with @option{-fprofile-abs-path}
+to create absolute path names in the @file{.gcno} files. This allows
+@command{gcov} to find the correct sources in projects with multiple
+directories.
+
+@item
Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
(the latter implies the former).
@@ -10696,6 +10713,12 @@
generate test coverage data. Coverage data matches the source files
more closely if you do not optimize.
+@item -fprofile-abs-path
+@opindex fprofile-abs-path
+Automatically convert relative source file names to absolute path names
+in the @file{.gcno} files. This allows @command{gcov} to find the correct
+sources in projects with multiple directories.
+
@item -fprofile-dir=@var{path}
@opindex fprofile-dir
Index: gcc/gcov-io.c
===================================================================
--- gcc/gcov-io.c (revision 246571)
+++ gcc/gcov-io.c (working copy)
@@ -353,6 +353,37 @@ gcov_write_string (const char *string)
#endif
#if !IN_LIBGCOV
+/* Write FILENAME to coverage file. Sets error flag on file
+ error, overflow flag on overflow */
+
+GCOV_LINKAGE void
+gcov_write_filename (const char *filename)
+{
+ char buf[1024];
+ size_t len;
+
+ if (profile_abs_path_flag && filename && filename[0]
+ && !(IS_DIR_SEPARATOR (filename[0])
+#if HAVE_DOS_BASED_FILE_SYSTEM
+ || filename[1] == ':'
+#endif
+ )
+ && (len = strlen (filename)) < sizeof (buf) - 1)
+ {
+ if (getcwd (buf, sizeof (buf) - len - 1) != NULL)
+ {
+ if (buf[0] && !IS_DIR_SEPARATOR (buf[strlen (buf) - 1]))
+ strcat (buf, "/");
+ strcat (buf, filename);
+ filename = buf;
+ }
+ }
+
+ return gcov_write_string (filename);
+}
+#endif
+
+#if !IN_LIBGCOV
/* Write a tag TAG and reserve space for the record length. Return a
value to be used for gcov_write_length. */
Index: gcc/gcov-io.h
===================================================================
--- gcc/gcov-io.h (revision 246571)
+++ gcc/gcov-io.h (working copy)
@@ -388,6 +388,7 @@ GCOV_LINKAGE void gcov_write_unsigned (gcov_unsign
/* Available only in compiler */
GCOV_LINKAGE unsigned gcov_histo_index (gcov_type value);
GCOV_LINKAGE void gcov_write_string (const char *);
+GCOV_LINKAGE void gcov_write_filename (const char *);
GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t);
GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/);
#endif
Index: gcc/profile.c
===================================================================
--- gcc/profile.c (revision 246571)
+++ gcc/profile.c (working copy)
@@ -956,7 +956,7 @@ output_location (char const *file_name, int line,
{
prev_file_name = file_name;
gcov_write_unsigned (0);
- gcov_write_string (prev_file_name);
+ gcov_write_filename (prev_file_name);
}
if (line_differs)
{
Index: gcc/testsuite/gcc.misc-tests/gcov-1a.c
===================================================================
--- gcc/testsuite/gcc.misc-tests/gcov-1a.c (revision 0)
+++ gcc/testsuite/gcc.misc-tests/gcov-1a.c (working copy)
@@ -0,0 +1,20 @@
+/* Test Gcov basics. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage -fprofile-abs-path" } */
+/* { dg-do run { target native } } */
+
+void noop ()
+{
+}
+
+int main ()
+{
+ int i;
+
+ for (i = 0; i < 10; i++) /* count(11) */
+ noop (); /* count(10) */
+
+ return 0; /* count(1) */
+}
+
+/* { dg-final { run-gcov gcov-1a.c } } */
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PING**3] [PATCH] Force use of absolute path names for gcov
2017-06-01 19:24 ` Bernd Edlinger
@ 2017-06-02 11:35 ` Nathan Sidwell
2017-06-02 14:43 ` Bernd Edlinger
0 siblings, 1 reply; 13+ messages in thread
From: Nathan Sidwell @ 2017-06-02 11:35 UTC (permalink / raw)
To: Bernd Edlinger, Joseph Myers; +Cc: gcc-patches, Jan Hubicka
On 06/01/2017 03:24 PM, Bernd Edlinger wrote:
> This is a gcc option that converts relative
> path names to absolute ones, so that gcov can
> properly merge the line numbers in projects
> where different relative path names may refer
> to the same source file.
Thanks. From reading the patch though, I didn't grok that intent. The
patch itself suggests gcov simply fails with relative paths and
directories. What you're really trying to do is find the canonical
path, which happens to be absolute. But you're not doing that either --
you're concatenating the relative path to cwd. How is that helping? Is
it when you have a mixture of absolute and relative paths?
Some other cases:
1) 'bob/../foo.c' and 'baz/../foo.c'?
2) 'bob/foo.c' and 'baz/foo.c' where baz is a symlink to bob?
3) combinations of #2 and #3 such that textual elision of .. gets you to
a different place than resolving symlinks.
Given all that complexity, wouldn't it be better to tell gcov where
relative paths should start? (perhaps encoding in the file?). It does
need access to the source directories.
note libiberty has lrealpath to do (much of?) what you want.
nathan
--
Nathan Sidwell
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PING**3] [PATCH] Force use of absolute path names for gcov
2017-06-02 11:35 ` Nathan Sidwell
@ 2017-06-02 14:43 ` Bernd Edlinger
2017-06-05 11:11 ` Nathan Sidwell
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-06-02 14:43 UTC (permalink / raw)
To: Nathan Sidwell, Joseph Myers; +Cc: gcc-patches, Jan Hubicka
On 06/02/17 13:35, Nathan Sidwell wrote:
> On 06/01/2017 03:24 PM, Bernd Edlinger wrote:
>
>> This is a gcc option that converts relative
>> path names to absolute ones, so that gcov can
>> properly merge the line numbers in projects
>> where different relative path names may refer
>> to the same source file.
>
> Thanks. From reading the patch though, I didn't grok that intent. The
> patch itself suggests gcov simply fails with relative paths and
> directories. What you're really trying to do is find the canonical
> path, which happens to be absolute. But you're not doing that either --
> you're concatenating the relative path to cwd. How is that helping? Is
> it when you have a mixture of absolute and relative paths?
>
Yes, let me explain why I need that.
Recently I wanted to get the line-coverage of an application
I work with. The problem I faced is, that different modules
invoke gcc in different working directories, and there are
things like -I ../include in one place, and -I ../../Core/include
in other places, so ../include/test.h and ../../Core/include/test.h
may or may not refer to the same file. Also several module tests
use a separate folder, and a file like "./Test1.cpp" may actually
exist in several directories, but gcov does not find the sources,
in this scenario and copying everything to a single directory is
not a good solution either.
So in the end I want to run the different module tests etc.
and let gcov collect and merge all the coverage data, and of course
find the right source files for the report, without substantially
changing the application's original make files.
> Some other cases:
> 1) 'bob/../foo.c' and 'baz/../foo.c'?
> 2) 'bob/foo.c' and 'baz/foo.c' where baz is a symlink to bob?
> 3) combinations of #2 and #3 such that textual elision of .. gets you to
> a different place than resolving symlinks.
>
> Given all that complexity, wouldn't it be better to tell gcov where
> relative paths should start? (perhaps encoding in the file?). It does
> need access to the source directories.
>
gcov.c already has a function named canonicalize_name that does exactly
what I need, i.e. elide /./ and collapse ../bob/../foo.c
to ../foo.c and even do something with symbolic links, however my app
does not use any sym-links so I did not really test that part.
But this function works only under the assumption that relative file
names start always from the current working directory.
So what my patch does, is leave absolute file names untouched and
prepend the current working directory to all file names that do
not look like absolute file names. Thus it does not claim to
canonicalize the file name, but only to make it an absolute file
name. But now gcov's canonicalize_name is actually able to
do the rest.
At least in my real-word application this did the trick.
But I must admit the test case does not prove more than that
the option is not causing an error, especially because the
test suite uses absolute path names.
Is it now clear?
Thanks
Bernd.
> note libiberty has lrealpath to do (much of?) what you want.
>
> nathan
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PING**3] [PATCH] Force use of absolute path names for gcov
2017-06-02 14:43 ` Bernd Edlinger
@ 2017-06-05 11:11 ` Nathan Sidwell
2017-06-05 16:31 ` Bernd Edlinger
0 siblings, 1 reply; 13+ messages in thread
From: Nathan Sidwell @ 2017-06-05 11:11 UTC (permalink / raw)
To: Bernd Edlinger, Joseph Myers; +Cc: gcc-patches, Jan Hubicka
On 06/02/2017 10:43 AM, Bernd Edlinger wrote:
> On 06/02/17 13:35, Nathan Sidwell wrote:
>> On 06/01/2017 03:24 PM, Bernd Edlinger wrote:
>>
>>> This is a gcc option that converts relative
>>> path names to absolute ones, so that gcov can
>>> properly merge the line numbers in projects
>>> where different relative path names may refer
>>> to the same source file.
>>
>> Thanks. From reading the patch though, I didn't grok that intent. The
>> patch itself suggests gcov simply fails with relative paths and
>> directories. What you're really trying to do is find the canonical
>> path, which happens to be absolute. But you're not doing that either --
>> you're concatenating the relative path to cwd. How is that helping? Is
>> it when you have a mixture of absolute and relative paths?
>>
>
> Yes, let me explain why I need that.
>
> Recently I wanted to get the line-coverage of an application
> I work with. The problem I faced is, that different modules
> invoke gcc in different working directories, and there are
> things like -I ../include in one place, and -I ../../Core/include
> in other places, so ../include/test.h and ../../Core/include/test.h
> may or may not refer to the same file. Also several module tests
> use a separate folder, and a file like "./Test1.cpp" may actually
> exist in several directories, but gcov does not find the sources,
> in this scenario and copying everything to a single directory is
> not a good solution either.
>
> So in the end I want to run the different module tests etc.
> and let gcov collect and merge all the coverage data, and of course
> find the right source files for the report, without substantially
> changing the application's original make files.
>
>> Some other cases:
>> 1) 'bob/../foo.c' and 'baz/../foo.c'?
>> 2) 'bob/foo.c' and 'baz/foo.c' where baz is a symlink to bob?
>> 3) combinations of #2 and #3 such that textual elision of .. gets you to
>> a different place than resolving symlinks.
>>
>> Given all that complexity, wouldn't it be better to tell gcov where
>> relative paths should start? (perhaps encoding in the file?). It does
>> need access to the source directories.
>>
>
> gcov.c already has a function named canonicalize_name that does exactly
> what I need, i.e. elide /./ and collapse ../bob/../foo.c
> to ../foo.c and even do something with symbolic links, however my app
> does not use any sym-links so I did not really test that part.
>
> But this function works only under the assumption that relative file
> names start always from the current working directory.
>
> So what my patch does, is leave absolute file names untouched and
> prepend the current working directory to all file names that do
> not look like absolute file names. Thus it does not claim to
> canonicalize the file name, but only to make it an absolute file
> name. But now gcov's canonicalize_name is actually able to
> do the rest.
Ok, that makes sense, thanks for the explanation.
+Compile the source files additionally with @option{-fprofile-abs-path}
+to create absolute path names in the @file{.gcno} files. This allows
+@command{gcov} to find the correct sources in projects with multiple
+directories.
I think the second sentence could be better. It's not that the sources
are in different directories, it's that the compiler is invoked with
different working directories. How about
'This allows @command{gcov} to find the correct sources in projects
where compilations occur with different working directories.'
modify as you see fit.
gcov_write_filename (const char *filename)
+{
+ char buf[1024];
+ size_t len;
Ew. (a) bad fixed length (b) bad stack frame bloat. Please use malloc
& MAX_PATH_LEN (or whatever the right #define is).
+ if (profile_abs_path_flag && filename && filename[0]
Can filename ever be null here? Can it ever be the empty string?
+ if (getcwd (buf, sizeof (buf) - len - 1) != NULL)
This is going to getcwd on every file (most likely). Isn't this already
available somewhere?
nathan
--
Nathan Sidwell
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PING**3] [PATCH] Force use of absolute path names for gcov
2017-06-05 11:11 ` Nathan Sidwell
@ 2017-06-05 16:31 ` Bernd Edlinger
2017-06-05 19:00 ` Nathan Sidwell
0 siblings, 1 reply; 13+ messages in thread
From: Bernd Edlinger @ 2017-06-05 16:31 UTC (permalink / raw)
To: Nathan Sidwell, Joseph Myers; +Cc: gcc-patches, Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
On 06/05/17 13:11, Nathan Sidwell wrote:
> +Compile the source files additionally with @option{-fprofile-abs-path}
> +to create absolute path names in the @file{.gcno} files. This allows
> +@command{gcov} to find the correct sources in projects with multiple
> +directories.
>
> I think the second sentence could be better. It's not that the sources
> are in different directories, it's that the compiler is invoked with
> different working directories. How about
> 'This allows @command{gcov} to find the correct sources in projects
> where compilations occur with different working directories.'
>
> modify as you see fit.
>
done.
> gcov_write_filename (const char *filename)
> +{
> + char buf[1024];
> + size_t len;
>
> Ew. (a) bad fixed length (b) bad stack frame bloat. Please use malloc
> & MAX_PATH_LEN (or whatever the right #define is).
>
MAX_PATH is just a portability nightmare and may or may not be
defined or sometimes is called PATH_MAX etc.
But I see getcwd (NULL, 0) is used in gcov-tools already,
and although that is a posix extension, it seems to be safe to use,
because libiberty provides a fall-back.
So I would go for getcwd(NULL, 0) and xrealloc the result buffer
as needed.
> + if (profile_abs_path_flag && filename && filename[0]
>
> Can filename ever be null here? Can it ever be the empty string?
>
I am unable to prove that, if the call from coverage.c where
filename comes directly from expand_location and there are
numerous places like:
if (xloc.file)
chksum = coverage_checksum_string (chksum, xloc.file);
which tells me that xloc.file might be NULL, typically in
case of UNKNOWN_LOCATION.
I am anxious about empty string here because of the code in
#ifdef HAVE_DOS_BASED_FILE_SYSTEM does not work with empty string,
while the original gcov_write_string works fine with NULL string
and empty string.
> + if (getcwd (buf, sizeof (buf) - len - 1) != NULL)
>
> This is going to getcwd on every file (most likely). Isn't this already
> available somewhere?
>
>
No, at least grep does not see any other place, except in gcov-tool.c :(
So how about this new patch?
Is it OK for trunk?
Bernd.
[-- Attachment #2: changelog-gcov-abs-path.txt --]
[-- Type: text/plain, Size: 498 bytes --]
gcc:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.texi: Document the -fprofile-abs-path option.
* common.opt (fprofile-abs-path): New option.
* gcov-io.h (gcov_write_filename): Declare.
* gcov-io.c (gcov_write_filename): New function.
* coverage.c (coverage_begin_function): Use gcov_write_filename.
* profile.c (output_location): Likewise.
gcc/testsuite:
2017-04-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc.misc-tests/gcov-1a.c: New test.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch-gcov-abs-path.diff --]
[-- Type: text/x-patch; name="patch-gcov-abs-path.diff", Size: 5549 bytes --]
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 248852)
+++ gcc/common.opt (working copy)
@@ -1969,6 +1969,10 @@ fprofile
Common Report Var(profile_flag)
Enable basic program profiling code.
+fprofile-abs-path
+Common Report Var(profile_abs_path_flag)
+Generate absolute source path names for gcov.
+
fprofile-arcs
Common Report Var(profile_arc_flag)
Insert arc-based program profiling code.
Index: gcc/coverage.c
===================================================================
--- gcc/coverage.c (revision 248852)
+++ gcc/coverage.c (working copy)
@@ -663,7 +663,7 @@ coverage_begin_function (unsigned lineno_checksum,
gcov_write_unsigned (cfg_checksum);
gcov_write_string (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (current_function_decl)));
- gcov_write_string (xloc.file);
+ gcov_write_filename (xloc.file);
gcov_write_unsigned (xloc.line);
gcov_write_length (offset);
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 248852)
+++ gcc/doc/invoke.texi (working copy)
@@ -443,6 +443,7 @@ Objective-C and Objective-C++ Dialects}.
@item Program Instrumentation Options
@xref{Instrumentation Options,,Program Instrumentation Options}.
@gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
+-fprofile-abs-path @gol
-fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
-fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
@@ -10694,6 +10695,12 @@ additional @option{-ftest-coverage} option. You d
every source file in a program.
@item
+Compile the source files additionally with @option{-fprofile-abs-path}
+to create absolute path names in the @file{.gcno} files. This allows
+@command{gcov} to find the correct sources in projects where compilations
+occur with different working directories.
+
+@item
Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
(the latter implies the former).
@@ -10737,6 +10744,13 @@ above for a description of @var{auxname} and instr
generate test coverage data. Coverage data matches the source files
more closely if you do not optimize.
+@item -fprofile-abs-path
+@opindex fprofile-abs-path
+Automatically convert relative source file names to absolute path names
+in the @file{.gcno} files. This allows @command{gcov} to find the correct
+sources in projects where compilations occur with different working
+directories.
+
@item -fprofile-dir=@var{path}
@opindex fprofile-dir
Index: gcc/gcov-io.c
===================================================================
--- gcc/gcov-io.c (revision 248852)
+++ gcc/gcov-io.c (working copy)
@@ -357,6 +357,38 @@ gcov_write_string (const char *string)
#endif
#if !IN_LIBGCOV
+/* Write FILENAME to coverage file. Sets error flag on file
+ error, overflow flag on overflow */
+
+GCOV_LINKAGE void
+gcov_write_filename (const char *filename)
+{
+ if (profile_abs_path_flag && filename && filename[0]
+ && !(IS_DIR_SEPARATOR (filename[0])
+#if HAVE_DOS_BASED_FILE_SYSTEM
+ || filename[1] == ':'
+#endif
+ ))
+ {
+ char *buf = getcwd (NULL, 0);
+ if (buf != NULL && buf[0])
+ {
+ size_t len = strlen (buf);
+ buf = (char*)xrealloc (buf, len + strlen (filename) + 2);
+ if (!IS_DIR_SEPARATOR (buf[len - 1]))
+ strcat (buf, "/");
+ strcat (buf, filename);
+ gcov_write_string (buf);
+ free (buf);
+ return;
+ }
+ }
+
+ gcov_write_string (filename);
+}
+#endif
+
+#if !IN_LIBGCOV
/* Write a tag TAG and reserve space for the record length. Return a
value to be used for gcov_write_length. */
Index: gcc/gcov-io.h
===================================================================
--- gcc/gcov-io.h (revision 248852)
+++ gcc/gcov-io.h (working copy)
@@ -387,6 +387,7 @@ GCOV_LINKAGE void gcov_write_unsigned (gcov_unsign
/* Available only in compiler */
GCOV_LINKAGE unsigned gcov_histo_index (gcov_type value);
GCOV_LINKAGE void gcov_write_string (const char *);
+GCOV_LINKAGE void gcov_write_filename (const char *);
GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t);
GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/);
#endif
Index: gcc/profile.c
===================================================================
--- gcc/profile.c (revision 248852)
+++ gcc/profile.c (working copy)
@@ -954,7 +954,7 @@ output_location (char const *file_name, int line,
{
prev_file_name = file_name;
gcov_write_unsigned (0);
- gcov_write_string (prev_file_name);
+ gcov_write_filename (prev_file_name);
}
if (line_differs)
{
Index: gcc/testsuite/gcc.misc-tests/gcov-1a.c
===================================================================
--- gcc/testsuite/gcc.misc-tests/gcov-1a.c (revision 0)
+++ gcc/testsuite/gcc.misc-tests/gcov-1a.c (working copy)
@@ -0,0 +1,20 @@
+/* Test Gcov basics. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage -fprofile-abs-path" } */
+/* { dg-do run { target native } } */
+
+void noop ()
+{
+}
+
+int main ()
+{
+ int i;
+
+ for (i = 0; i < 10; i++) /* count(11) */
+ noop (); /* count(10) */
+
+ return 0; /* count(1) */
+}
+
+/* { dg-final { run-gcov gcov-1a.c } } */
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-06-05 19:00 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-21 18:51 [PATCH] Force use of absolute path names for gcov Bernd Edlinger
2017-04-21 20:27 ` Joseph Myers
2017-04-21 20:57 ` Bernd Edlinger
2017-04-28 18:14 ` [PING] " Bernd Edlinger
2017-05-12 16:48 ` [PING**2] " Bernd Edlinger
2017-06-01 15:59 ` [PING**3] " Bernd Edlinger
2017-06-01 17:52 ` Nathan Sidwell
2017-06-01 19:24 ` Bernd Edlinger
2017-06-02 11:35 ` Nathan Sidwell
2017-06-02 14:43 ` Bernd Edlinger
2017-06-05 11:11 ` Nathan Sidwell
2017-06-05 16:31 ` Bernd Edlinger
2017-06-05 19:00 ` Nathan Sidwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).