public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR 47793 - Support relative paths using -fprofile-generate
       [not found] <AANLkTimkRXMEH5QzVpcaxNZMaK=CE-w7tAXF=1yxQxNZ@mail.gmail.com>
@ 2011-02-23 18:33 ` Martin Thuresson
  2011-02-24  0:56   ` Martin Thuresson
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Thuresson @ 2011-02-23 18:33 UTC (permalink / raw)
  To: kai.tietz, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

Change 165596 and 168475 updated the code for handling gcda-paths. As
part of this change, relative paths stopped working.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793

This patch adds a guard so that "/" is not added when no prefix is
given.

The added testcase uses the path "../gcc/". This puts the gcda in the
same directory, so that the cleanup-coverage-files will find them.

I have tested the patch using "make bootstrap; make -k check" with
target x86_64-unknown-linux-gnu and saw no additional test failures.

Let me know if there is any other testing I should do.

Thanks,
Martin

[-- Attachment #2: foo.patch --]
[-- Type: text/x-patch, Size: 1800 bytes --]

diff -uprN /gcc/trunk/gcc/doc/invoke.texi gcc/doc/invoke.texi
--- /gcc/trunk/gcc/doc/invoke.texi	2011-02-09 02:01:59.000000000 -0800
+++ gcc/doc/invoke.texi	2011-02-22 09:32:41.000000000 -0800
@@ -7733,7 +7733,7 @@ Set the directory to search for the prof
 This option affects only the profile data generated by
 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
-and its related options.
+and its related options. Both absolute and relative paths are supported.
 By default, GCC will use the current directory as @var{path}, thus the
 profile data file will appear in the same directory as the object file.
 
diff -uprN /gcc/trunk/gcc/libgcov.c gcc/libgcov.c
--- /gcc/trunk/gcc/libgcov.c	2011-01-05 01:30:09.000000000 -0800
+++ gcc/libgcov.c	2011-02-23 08:51:35.000000000 -0800
@@ -283,8 +283,9 @@ gcov_exit (void)
 	      }
         }
       /* Update complete filename with stripped original. */
-      if (!IS_DIR_SEPARATOR (*fname) && !HAS_DRIVE_SPEC(fname))
+      if (prefix_length != 0 && !IS_DIR_SEPARATOR (*fname))
 	{
+          /* If prefix is given, add directory separator.  */
 	  strcpy (gi_filename_up, "/");
 	  strcpy (gi_filename_up + 1, fname);
 	}
diff -uprN /gcc/trunk/gcc/testsuite/gcc.dg/pr47793.c gcc/testsuite/gcc.dg/pr47793.c
--- /gcc/trunk/gcc/testsuite/gcc.dg/pr47793.c	1969-12-31 16:00:00.000000000 -0800
+++ gcc/testsuite/gcc.dg/pr47793.c	2011-02-23 08:51:54.000000000 -0800
@@ -0,0 +1,12 @@
+/* Bug pr47793: Allow relative paths in profile-generate.  */
+/* { dg-do run } */
+/* { dg-options "-O -fprofile-generate=../gcc/" } */
+/* { dg-final { scan-file pr47793.gcda "."} } */
+
+int
+main(void)
+{
+  return 0;
+}
+
+/* { dg-final { cleanup-coverage-files } } */

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PR 47793 - Support relative paths using -fprofile-generate
  2011-02-23 18:33 ` PR 47793 - Support relative paths using -fprofile-generate Martin Thuresson
@ 2011-02-24  0:56   ` Martin Thuresson
  2011-03-01 22:08     ` Martin Thuresson
  2011-05-04 23:53     ` Xinliang David Li
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Thuresson @ 2011-02-24  0:56 UTC (permalink / raw)
  To: kai.tietz, gcc-patches

On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson <martint@google.com> wrote:
> Change 165596 and 168475 updated the code for handling gcda-paths. As
> part of this change, relative paths stopped working.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
>
> This patch adds a guard so that "/" is not added when no prefix is
> given.
>
> The added testcase uses the path "../gcc/". This puts the gcda in the
> same directory, so that the cleanup-coverage-files will find them.
>
> I have tested the patch using "make bootstrap; make -k check" with
> target x86_64-unknown-linux-gnu and saw no additional test failures.
>
> Let me know if there is any other testing I should do.

ChangeLog
gcc/

2011-02-23  Martin Thuresson  <martint@google.com>

	PR gcov-profile/47793
	* libgcov.c (gcov_exit): Support relative profile paths.

gcc/testsuite/

2011-02-23  Martin Thuresson  <martint@google.com>

	PR gcov-profile/47793
	* gcc.dg/pr47793.c: New.

>
> Thanks,
> Martin
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PR 47793 - Support relative paths using -fprofile-generate
  2011-02-24  0:56   ` Martin Thuresson
@ 2011-03-01 22:08     ` Martin Thuresson
  2011-03-07 19:54       ` Diego Novillo
  2011-05-04 23:53     ` Xinliang David Li
  1 sibling, 1 reply; 8+ messages in thread
From: Martin Thuresson @ 2011-03-01 22:08 UTC (permalink / raw)
  To: kai.tietz, gcc-patches; +Cc: jh

Ping.

On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson <martint@google.com> wrote:
> On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson <martint@google.com> wrote:
>> Change 165596 and 168475 updated the code for handling gcda-paths. As
>> part of this change, relative paths stopped working.
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
>>
>> This patch adds a guard so that "/" is not added when no prefix is
>> given.
>>
>> The added testcase uses the path "../gcc/". This puts the gcda in the
>> same directory, so that the cleanup-coverage-files will find them.
>>
>> I have tested the patch using "make bootstrap; make -k check" with
>> target x86_64-unknown-linux-gnu and saw no additional test failures.
>>
>> Let me know if there is any other testing I should do.
>
> ChangeLog
> gcc/
>
> 2011-02-23  Martin Thuresson  <martint@google.com>
>
>        PR gcov-profile/47793
>        * libgcov.c (gcov_exit): Support relative profile paths.
>
> gcc/testsuite/
>
> 2011-02-23  Martin Thuresson  <martint@google.com>
>
>        PR gcov-profile/47793
>        * gcc.dg/pr47793.c: New.
>
>>
>> Thanks,
>> Martin
>>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PR 47793 - Support relative paths using -fprofile-generate
  2011-03-01 22:08     ` Martin Thuresson
@ 2011-03-07 19:54       ` Diego Novillo
  2011-03-08  5:25         ` Martin Thuresson
  0 siblings, 1 reply; 8+ messages in thread
From: Diego Novillo @ 2011-03-07 19:54 UTC (permalink / raw)
  To: Martin Thuresson
  Cc: kai.tietz, gcc-patches, jh, Jakub Jelinek, Richard Guenther,
	Joseph S. Myers

On Tue, Mar 1, 2011 at 17:07, Martin Thuresson <martint@google.com> wrote:
> Ping.
>
> On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson <martint@google.com> wrote:
>> On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson <martint@google.com> wrote:
>>> Change 165596 and 168475 updated the code for handling gcda-paths. As
>>> part of this change, relative paths stopped working.
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
>>>
>>> This patch adds a guard so that "/" is not added when no prefix is
>>> given.
>>>
>>> The added testcase uses the path "../gcc/". This puts the gcda in the
>>> same directory, so that the cleanup-coverage-files will find them.
>>>
>>> I have tested the patch using "make bootstrap; make -k check" with
>>> target x86_64-unknown-linux-gnu and saw no additional test failures.
>>>
>>> Let me know if there is any other testing I should do.
>>
>> ChangeLog
>> gcc/
>>
>> 2011-02-23  Martin Thuresson  <martint@google.com>
>>
>>        PR gcov-profile/47793
>>        * libgcov.c (gcov_exit): Support relative profile paths.
>>
>> gcc/testsuite/
>>
>> 2011-02-23  Martin Thuresson  <martint@google.com>
>>
>>        PR gcov-profile/47793
>>        * gcc.dg/pr47793.c: New.

Martin,

Let's put it in google/main while the review is underway.  Is this a
regression vs 4.5 or 4.4?  If so, it may be suitable for trunk (or the
future release branch), but you will need an explicit approval from
the release managers (CC'd).  If it's a new bug, then this should go
in trunk after we re-enter stage 1.


Diego.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PR 47793 - Support relative paths using -fprofile-generate
  2011-03-07 19:54       ` Diego Novillo
@ 2011-03-08  5:25         ` Martin Thuresson
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Thuresson @ 2011-03-08  5:25 UTC (permalink / raw)
  To: Diego Novillo
  Cc: kai.tietz, gcc-patches, jh, Jakub Jelinek, Richard Guenther,
	Joseph S. Myers

On Mon, Mar 7, 2011 at 11:53 AM, Diego Novillo <dnovillo@google.com> wrote:
> On Tue, Mar 1, 2011 at 17:07, Martin Thuresson <martint@google.com> wrote:
>> Ping.
>>
>> On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson <martint@google.com> wrote:
>>> On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson <martint@google.com> wrote:
>>>> Change 165596 and 168475 updated the code for handling gcda-paths. As
>>>> part of this change, relative paths stopped working.
>>>>
>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
>>>>
>>>> This patch adds a guard so that "/" is not added when no prefix is
>>>> given.
>>>>
>>>> The added testcase uses the path "../gcc/". This puts the gcda in the
>>>> same directory, so that the cleanup-coverage-files will find them.
>>>>
>>>> I have tested the patch using "make bootstrap; make -k check" with
>>>> target x86_64-unknown-linux-gnu and saw no additional test failures.
>>>>
>>>> Let me know if there is any other testing I should do.
>>>
>>> ChangeLog
>>> gcc/
>>>
>>> 2011-02-23  Martin Thuresson  <martint@google.com>
>>>
>>>        PR gcov-profile/47793
>>>        * libgcov.c (gcov_exit): Support relative profile paths.
>>>
>>> gcc/testsuite/
>>>
>>> 2011-02-23  Martin Thuresson  <martint@google.com>
>>>
>>>        PR gcov-profile/47793
>>>        * gcc.dg/pr47793.c: New.
>
> Martin,
>
> Let's put it in google/main while the review is underway.  Is this a
> regression vs 4.5 or 4.4?  If so, it may be suitable for trunk (or the
> future release branch), but you will need an explicit approval from
> the release managers (CC'd).  If it's a new bug, then this should go
> in trunk after we re-enter stage 1.

I have not tested 4.5 yet, but looking at the SVN log, I believe
this was introduced 2010/10/17.

Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PR 47793 - Support relative paths using -fprofile-generate
  2011-02-24  0:56   ` Martin Thuresson
  2011-03-01 22:08     ` Martin Thuresson
@ 2011-05-04 23:53     ` Xinliang David Li
  2011-05-06 18:06       ` Xinliang David Li
  2011-05-13  9:08       ` Jan Hubicka
  1 sibling, 2 replies; 8+ messages in thread
From: Xinliang David Li @ 2011-05-04 23:53 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Martin Thuresson

Is this patch ok for trunk?

Allowing relative path in -fprofile-generate= is very useful when
running the program remotely -- the profile data will be just dumped
in the dir relative to the working dir in the remote machine. Using
GCOV_PREFIX_STRIP can workaround the problem, but it is not always to
pass environment around.

Thanks,

David

On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson <martint@google.com> wrote:
> On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson <martint@google.com> wrote:
>> Change 165596 and 168475 updated the code for handling gcda-paths. As
>> part of this change, relative paths stopped working.
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
>>
>> This patch adds a guard so that "/" is not added when no prefix is
>> given.
>>
>> The added testcase uses the path "../gcc/". This puts the gcda in the
>> same directory, so that the cleanup-coverage-files will find them.
>>
>> I have tested the patch using "make bootstrap; make -k check" with
>> target x86_64-unknown-linux-gnu and saw no additional test failures.
>>
>> Let me know if there is any other testing I should do.
>
> ChangeLog
> gcc/
>
> 2011-02-23  Martin Thuresson  <martint@google.com>
>
>        PR gcov-profile/47793
>        * libgcov.c (gcov_exit): Support relative profile paths.
>
> gcc/testsuite/
>
> 2011-02-23  Martin Thuresson  <martint@google.com>
>
>        PR gcov-profile/47793
>        * gcc.dg/pr47793.c: New.
>
>>
>> Thanks,
>> Martin
>>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PR 47793 - Support relative paths using -fprofile-generate
  2011-05-04 23:53     ` Xinliang David Li
@ 2011-05-06 18:06       ` Xinliang David Li
  2011-05-13  9:08       ` Jan Hubicka
  1 sibling, 0 replies; 8+ messages in thread
From: Xinliang David Li @ 2011-05-06 18:06 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Martin Thuresson

Honza, what do you think of the patch? It actually fixed a regression.

Thanks,

David

On Wed, May 4, 2011 at 4:40 PM, Xinliang David Li <davidxl@google.com> wrote:
> Is this patch ok for trunk?
>
> Allowing relative path in -fprofile-generate= is very useful when
> running the program remotely -- the profile data will be just dumped
> in the dir relative to the working dir in the remote machine. Using
> GCOV_PREFIX_STRIP can workaround the problem, but it is not always to
> pass environment around.
>
> Thanks,
>
> David
>
> On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson <martint@google.com> wrote:
>> On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson <martint@google.com> wrote:
>>> Change 165596 and 168475 updated the code for handling gcda-paths. As
>>> part of this change, relative paths stopped working.
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
>>>
>>> This patch adds a guard so that "/" is not added when no prefix is
>>> given.
>>>
>>> The added testcase uses the path "../gcc/". This puts the gcda in the
>>> same directory, so that the cleanup-coverage-files will find them.
>>>
>>> I have tested the patch using "make bootstrap; make -k check" with
>>> target x86_64-unknown-linux-gnu and saw no additional test failures.
>>>
>>> Let me know if there is any other testing I should do.
>>
>> ChangeLog
>> gcc/
>>
>> 2011-02-23  Martin Thuresson  <martint@google.com>
>>
>>        PR gcov-profile/47793
>>        * libgcov.c (gcov_exit): Support relative profile paths.
>>
>> gcc/testsuite/
>>
>> 2011-02-23  Martin Thuresson  <martint@google.com>
>>
>>        PR gcov-profile/47793
>>        * gcc.dg/pr47793.c: New.
>>
>>>
>>> Thanks,
>>> Martin
>>>
>>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: PR 47793 - Support relative paths using -fprofile-generate
  2011-05-04 23:53     ` Xinliang David Li
  2011-05-06 18:06       ` Xinliang David Li
@ 2011-05-13  9:08       ` Jan Hubicka
  1 sibling, 0 replies; 8+ messages in thread
From: Jan Hubicka @ 2011-05-13  9:08 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: GCC Patches, Jan Hubicka, Martin Thuresson

> Is this patch ok for trunk?
Hi,
the patch is OK.
Sorry for delayed reply, I was very busy by the inliner/thunk bits and this code
is not really in my area of expertise, so it needed some consideration to make sense
of it.

Honza
> 
> Allowing relative path in -fprofile-generate= is very useful when
> running the program remotely -- the profile data will be just dumped
> in the dir relative to the working dir in the remote machine. Using
> GCOV_PREFIX_STRIP can workaround the problem, but it is not always to
> pass environment around.
> 
> Thanks,
> 
> David
> 
> On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson <martint@google.com> wrote:
> > On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson <martint@google.com> wrote:
> >> Change 165596 and 168475 updated the code for handling gcda-paths. As
> >> part of this change, relative paths stopped working.
> >>
> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793
> >>
> >> This patch adds a guard so that "/" is not added when no prefix is
> >> given.
> >>
> >> The added testcase uses the path "../gcc/". This puts the gcda in the
> >> same directory, so that the cleanup-coverage-files will find them.
> >>
> >> I have tested the patch using "make bootstrap; make -k check" with
> >> target x86_64-unknown-linux-gnu and saw no additional test failures.
> >>
> >> Let me know if there is any other testing I should do.
> >
> > ChangeLog
> > gcc/
> >
> > 2011-02-23  Martin Thuresson  <martint@google.com>
> >
> >        PR gcov-profile/47793
> >        * libgcov.c (gcov_exit): Support relative profile paths.
> >
> > gcc/testsuite/
> >
> > 2011-02-23  Martin Thuresson  <martint@google.com>
> >
> >        PR gcov-profile/47793
> >        * gcc.dg/pr47793.c: New.
> >
> >>
> >> Thanks,
> >> Martin
> >>
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-05-12 22:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AANLkTimkRXMEH5QzVpcaxNZMaK=CE-w7tAXF=1yxQxNZ@mail.gmail.com>
2011-02-23 18:33 ` PR 47793 - Support relative paths using -fprofile-generate Martin Thuresson
2011-02-24  0:56   ` Martin Thuresson
2011-03-01 22:08     ` Martin Thuresson
2011-03-07 19:54       ` Diego Novillo
2011-03-08  5:25         ` Martin Thuresson
2011-05-04 23:53     ` Xinliang David Li
2011-05-06 18:06       ` Xinliang David Li
2011-05-13  9:08       ` Jan Hubicka

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).