Bug 59105 - -fdebug-prefix-map doesn't affect DW_AT_comp_dir.
Summary: -fdebug-prefix-map doesn't affect DW_AT_comp_dir.
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-13 08:12 UTC by Pawel Sikora
Modified: 2014-04-23 10:04 UTC (History)
0 users

See Also:
Host: x86_64-gnu-linux
Target: x86_64-gnu-linux
Build: x86_64-gnu-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments
testcase (1.67 KB, application/x-gzip)
2013-11-13 08:12 UTC, Pawel Sikora
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2013-11-13 08:12:41 UTC
Created attachment 31203 [details]
testcase

hi,

i'm trying to use -fdebug-prefix-map to reuse (ccache) compilation units
across multiple software branches. the first problem was reported as PR58767
and the second one is here.

the gcc hardcodes DW_AT_comp_dir when -fdebug-prefix-map is in use and prevents
ccache from computing identical checksum/manifest. imo -fdebug-prefix-map
should adjust DW_AT_comp_dir in the same way as source name (DW_AT_name).


$ ./bug.sh
+ rm -f '*.o'
+ CXXFLAGS='-Wall -gno-record-gcc-switches -g2 -gdwarf-4 -c' 
+ cd repo/branch
+ readlink -m t.cpp
+ src=/home/users/pawels/bugs/gcc-bug/repo/branch/t.cpp 
+ dirname /home/users/pawels/bugs/gcc-bug/repo/branch/t.cpp
+ g++ -Wall -gno-record-gcc-switches -g2 -gdwarf-4 -c /home/users/pawels/bugs/gcc-bug/repo/branch/t.cpp '-fdebug-prefix-map=/home/users/pawels/bugs/gcc-bug/repo/branch/='
+ objdump -g t.o
+ grep -E DW_AT_name.+cpp
    <11>   DW_AT_name        : (indirect string, offset: 0x0): t.cpp
+ objdump -g t.o
+ grep -E DW_AT_comp_dir.+string
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x14c): /home/users/pawels/bugs/gcc-bug/repo/branch
+ cd ../..
Comment 1 Pawel Sikora 2014-04-23 10:04:38 UTC
my fault, the trailing slash in -fdebug-prefix-map was a problem.