public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map?
@ 2020-07-07  5:20 i at maskray dot me
  2020-07-07  8:25 ` [Bug gcov-profile/96092] " marxin at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: i at maskray dot me @ 2020-07-07  5:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

            Bug ID: 96092
           Summary: Should --coverage respect -ffile-prefix-map?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

% gcc-10 -ffile-prefix-map=/tmp/c=/src --coverage -c -g /tmp/c/a.c

# -ffile-prefix-map implies -fdebug-prefix-map
% llvm-dwarfdump -debug-info a.o | grep /src
              DW_AT_name        ("/src/a.c")
              DW_AT_comp_dir    ("/src")
                DW_AT_decl_file ("/src/a.c")

# --coverage is not affected
% r2 -qc 'pxw `?v $s`' a.gcno
0x00000000  0x67636e6f 0x42303065 0x27b4c272 0x00000002  oncge00Br..'....
0x00000010  0x706d742f 0x0000632f 0x00000001 0x01000000  /tmp/c..........
0x00000020  0x0000000f 0x067072eb 0x40058857 0xdb5de9e8  .....rp.W..@..].
0x00000030  0x00000002 0x6e69616d 0x00000000 0x00000000  ....main........
0x00000040  0x00000003 0x706d742f 0x612f632f 0x0000632e  ..../tmp/c/a.c..
0x00000050  0x00000001 0x00000005 0x00000001 0x0000000c  ................
0x00000060  0x01410000 0x00000001 0x00000004 0x01430000  ..A...........C.
0x00000070  0x00000003 0x00000000 0x00000002 0x00000004  ................
0x00000080  0x01430000 0x00000003 0x00000002 0x00000003  ..C.............
0x00000090  0x00000005 0x01430000 0x00000003 0x00000003  ......C.........
0x000000a0  0x00000001 0x00000001 0x01450000 0x00000009  ..........E.....
0x000000b0  0x00000002 0x00000000 0x00000003 0x706d742f  ............/tmp
0x000000c0  0x612f632f 0x0000632e 0x00000001 0x00000000  /c/a.c..........
0x000000d0  0x00000000


I created this issue because I saw a clang-side proposal
https://reviews.llvm.org/D83154 (add -fcoverage-prefix-map) today.

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
@ 2020-07-07  8:25 ` marxin at gcc dot gnu.org
  2020-07-10  9:04 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-07  8:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-07-07
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
I'll take a look.

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
  2020-07-07  8:25 ` [Bug gcov-profile/96092] " marxin at gcc dot gnu.org
@ 2020-07-10  9:04 ` marxin at gcc dot gnu.org
  2020-07-12  4:32 ` i at maskray dot me
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-10  9:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Apparently we've got a patch in queue that does something similar:

+fprofile-prefix-path=
+Common·Joined·RejectNegative·Var(profile_prefix_path) 
+remove·prefix·from·absolute·path·before·manging·name·for·-fprofile-generate=·and·-fprofile-use=.

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
  2020-07-07  8:25 ` [Bug gcov-profile/96092] " marxin at gcc dot gnu.org
  2020-07-10  9:04 ` marxin at gcc dot gnu.org
@ 2020-07-12  4:32 ` i at maskray dot me
  2020-07-28 10:30 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: i at maskray dot me @ 2020-07-12  4:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

--- Comment #3 from Fangrui Song <i at maskray dot me> ---
(In reply to Martin Liška from comment #2)
> Apparently we've got a patch in queue that does something similar:
> 
> +fprofile-prefix-path=
> +Common·Joined·RejectNegative·Var(profile_prefix_path) 
> +remove·prefix·from·absolute·path·before·manging·name·for·-fprofile-
> generate=·and·-fprofile-use=.

Can we generalize the option to -fprofile-prefix-map= and let it be part of
-ffile-prefix-map? We can let clang side add -fprofile-prefix-map= as well
(https://reviews.llvm.org/D83154#2146085 )
clang may not support -fprofile-prefix-path= as it can be emulated by
-fprofile-prefix-map=

(IIUC, in GCC, -fprofile-generate uses gcov so either -fprofile-prefix-map= or
-fcoverage-prefix-map= will be an ok name. In clang, -fprofile-generate is an
instrumentation different from --coverage (gcov).)

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
                   ` (2 preceding siblings ...)
  2020-07-12  4:32 ` i at maskray dot me
@ 2020-07-28 10:30 ` marxin at gcc dot gnu.org
  2021-03-18  9:46 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-28 10:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #2)
> Apparently we've got a patch in queue that does something similar:
> 
> +fprofile-prefix-path=
> +Common·Joined·RejectNegative·Var(profile_prefix_path) 
> +remove·prefix·from·absolute·path·before·manging·name·for·-fprofile-
> generate=·and·-fprofile-use=.

All right, we can definitely not come up with the suggested option.
We can adapt the Clang's approach of -fcoverage-prefix-map.
Please ping me once it lands to LLVM master and I'll implement it as well.

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
                   ` (3 preceding siblings ...)
  2020-07-28 10:30 ` marxin at gcc dot gnu.org
@ 2021-03-18  9:46 ` marxin at gcc dot gnu.org
  2021-08-31 17:32 ` apsaltis at vmware dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-18  9:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |11.0
   Target Milestone|---                         |12.0

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
                   ` (4 preceding siblings ...)
  2021-03-18  9:46 ` marxin at gcc dot gnu.org
@ 2021-08-31 17:32 ` apsaltis at vmware dot com
  2021-09-01  6:58 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: apsaltis at vmware dot com @ 2021-08-31 17:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

Andrew Psaltis <apsaltis at vmware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apsaltis at vmware dot com

--- Comment #5 from Andrew Psaltis <apsaltis at vmware dot com> ---
Any word on this?  WRT clang, it looks like this was committed early 2021[1],
and has been released along with llvm 12.0.0 as -fprofile-prefix-map[2].

[1]
https://github.com/llvm/llvm-project/commit/c3324450b204392169d4ec7172cb32f74c03e376
[2]
https://releases.llvm.org/12.0.0/tools/clang/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-prefix-map

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
                   ` (5 preceding siblings ...)
  2021-08-31 17:32 ` apsaltis at vmware dot com
@ 2021-09-01  6:58 ` marxin at gcc dot gnu.org
  2021-11-11 16:40 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-01  6:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
I'm planning working on that in the next weeks.

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
                   ` (6 preceding siblings ...)
  2021-09-01  6:58 ` marxin at gcc dot gnu.org
@ 2021-11-11 16:40 ` marxin at gcc dot gnu.org
  2021-12-02 13:13 ` cvs-commit at gcc dot gnu.org
  2021-12-02 13:14 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-11 16:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2021-Novembe
                   |                            |r/584166.html

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Patch candidate was sent.

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
                   ` (7 preceding siblings ...)
  2021-11-11 16:40 ` marxin at gcc dot gnu.org
@ 2021-12-02 13:13 ` cvs-commit at gcc dot gnu.org
  2021-12-02 13:14 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-02 13:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:cde87638bf5cf6aafffb590986b6a890da0ba06c

commit r12-5711-gcde87638bf5cf6aafffb590986b6a890da0ba06c
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Nov 11 16:42:23 2021 +0100

    Implement -fprofile-prefix-map.

            PR gcov-profile/96092

    gcc/ChangeLog:

            * common.opt: New option.
            * coverage.c (coverage_begin_function): Emit filename with
            remap_profile_filename.
            * doc/invoke.texi: Document the new option.
            * file-prefix-map.c (add_profile_prefix_map): New.
            (remap_profile_filename): Likewise.
            * file-prefix-map.h (add_profile_prefix_map): Likewise.
            (remap_profile_filename): Likewise.
            * lto-opts.c (lto_write_options): Handle
            OPT_fprofile_prefix_map_.
            * opts-global.c (handle_common_deferred_options): Likewise.
            * opts.c (common_handle_option): Likewise.
            (gen_command_line_string): Likewise.
            * profile.c (output_location): Emit filename with
            remap_profile_filename.

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

* [Bug gcov-profile/96092] Should --coverage respect -ffile-prefix-map?
  2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
                   ` (8 preceding siblings ...)
  2021-12-02 13:13 ` cvs-commit at gcc dot gnu.org
@ 2021-12-02 13:14 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-02 13:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96092

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
Implemented.

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

end of thread, other threads:[~2021-12-02 13:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07  5:20 [Bug gcov-profile/96092] New: Should --coverage respect -ffile-prefix-map? i at maskray dot me
2020-07-07  8:25 ` [Bug gcov-profile/96092] " marxin at gcc dot gnu.org
2020-07-10  9:04 ` marxin at gcc dot gnu.org
2020-07-12  4:32 ` i at maskray dot me
2020-07-28 10:30 ` marxin at gcc dot gnu.org
2021-03-18  9:46 ` marxin at gcc dot gnu.org
2021-08-31 17:32 ` apsaltis at vmware dot com
2021-09-01  6:58 ` marxin at gcc dot gnu.org
2021-11-11 16:40 ` marxin at gcc dot gnu.org
2021-12-02 13:13 ` cvs-commit at gcc dot gnu.org
2021-12-02 13:14 ` marxin at gcc dot gnu.org

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