public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/109591] New: Multiple -fdebug-prefix-map= prefixes match, which one wins?
@ 2023-04-21 22:58 i at maskray dot me
2023-04-21 23:12 ` [Bug debug/109591] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: i at maskray dot me @ 2023-04-21 22:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591
Bug ID: 109591
Summary: Multiple -fdebug-prefix-map= prefixes match, which one
wins?
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: i at maskray dot me
Target Milestone: ---
mkdir -p a/b/c
echo 'int main(){}' > a/b/c/d.c
~/Dev/gcc/out/release/gcc/xgcc -B ~/Dev/gcc/out/release/gcc -g -c
-fdebug-prefix-map=a/b/c=z -fdebug-prefix-map=a/b=y -fdebug-prefix-map=a=x
a/b/c/d.c
objdump -Wi d.o | grep 'd\.c' # <12> DW_AT_name : (indirect line
string, offset: 0): x/b/c/d.c
~/Dev/gcc/out/release/gcc/xgcc -B ~/Dev/gcc/out/release/gcc -g -c
-fdebug-prefix-map=a=x -fdebug-prefix-map=a/b=y -fdebug-prefix-map=a/b/c=z
a/b/c/d.c
objdump -Wi d.o | grep 'd\.c' # <12> DW_AT_name : (indirect line
string, offset: 0): z/d.c
return
When multiple -fdebug-prefix-map= options are applicable, it seems that the
last wins.
In Clang, after https://reviews.llvm.org/D49466 (landed in Nov 2019), the
longest prefix wins.
clang -g -c -fdebug-prefix-map=a=x -fdebug-prefix-map=a/b=y
-fdebug-prefix-map=a/b/c=z a/b/c/d.c # z/d.c
clang -g -c -fdebug-prefix-map=a=x -fdebug-prefix-map=a/b=y
-fdebug-prefix-map=a/b/c=z a/b/c/d.c # z/d.c
This issue is motivated by https://reviews.llvm.org/D148757
---
Related, there is a strange use case where the old prefix is empty. The new
prefix may or may not end with a slash: '-fdebug-prefix-map==w' and
'-fdebug-prefix-map==w/'.
'-fdebug-prefix-map==w' changes the file name to wa/b/c/d.c . I am unsure
whether it should be w/a/b/c/d.c instead. Clang has the same problem.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/109591] Multiple -fdebug-prefix-map= prefixes match, which one wins?
2023-04-21 22:58 [Bug debug/109591] New: Multiple -fdebug-prefix-map= prefixes match, which one wins? i at maskray dot me
@ 2023-04-21 23:12 ` pinskia at gcc dot gnu.org
2023-04-21 23:19 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-21 23:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>When multiple -fdebug-prefix-map= options are applicable, it seems that the last wins.
Right, that is the standard way all options in GCC works.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/109591] Multiple -fdebug-prefix-map= prefixes match, which one wins?
2023-04-21 22:58 [Bug debug/109591] New: Multiple -fdebug-prefix-map= prefixes match, which one wins? i at maskray dot me
2023-04-21 23:12 ` [Bug debug/109591] " pinskia at gcc dot gnu.org
@ 2023-04-21 23:19 ` pinskia at gcc dot gnu.org
2023-04-22 0:58 ` i at maskray dot me
2023-04-24 6:53 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-21 23:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC added -fdebug-prefix-map= back in r0-82686-gc8aea42ce2c691e4e8 2 years
before clang was first release . So ....
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/109591] Multiple -fdebug-prefix-map= prefixes match, which one wins?
2023-04-21 22:58 [Bug debug/109591] New: Multiple -fdebug-prefix-map= prefixes match, which one wins? i at maskray dot me
2023-04-21 23:12 ` [Bug debug/109591] " pinskia at gcc dot gnu.org
2023-04-21 23:19 ` pinskia at gcc dot gnu.org
@ 2023-04-22 0:58 ` i at maskray dot me
2023-04-24 6:53 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: i at maskray dot me @ 2023-04-22 0:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591
--- Comment #3 from Fangrui Song <i at maskray dot me> ---
(In reply to Andrew Pinski from comment #2)
> GCC added -fdebug-prefix-map= back in r0-82686-gc8aea42ce2c691e4e8 2 years
> before clang was first release . So ....
Thank you for the super rapid response!
I have created https://reviews.llvm.org/D148975 to change Clang to follow GCC's
lead. There is an opinion that is different, though:
> For me long matching prefix makes more sense, but if the same prefix is used multiple times, the last option should win.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug debug/109591] Multiple -fdebug-prefix-map= prefixes match, which one wins?
2023-04-21 22:58 [Bug debug/109591] New: Multiple -fdebug-prefix-map= prefixes match, which one wins? i at maskray dot me
` (2 preceding siblings ...)
2023-04-22 0:58 ` i at maskray dot me
@ 2023-04-24 6:53 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-24 6:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |documentation
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
It might be helpful to document this expected behavior (and maybe even add a
testcase?)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-24 6:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 22:58 [Bug debug/109591] New: Multiple -fdebug-prefix-map= prefixes match, which one wins? i at maskray dot me
2023-04-21 23:12 ` [Bug debug/109591] " pinskia at gcc dot gnu.org
2023-04-21 23:19 ` pinskia at gcc dot gnu.org
2023-04-22 0:58 ` i at maskray dot me
2023-04-24 6:53 ` rguenth 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).