Bug 59105

Summary: -fdebug-prefix-map doesn't affect DW_AT_comp_dir.
Product: gcc Reporter: Pawel Sikora <pawel_sikora>
Component: debugAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 4.8.2   
Target Milestone: ---   
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

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.