[PATCH] D55519: Reuse code from CGDebugInfo::getOrCreateFile() when creating the file for the DICompileUnit
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 13 08:22:41 PST 2018
labath added a comment.
I am sorry about the late notice Adrian, but it looks like this patch completely breaks DWO file lookup. I think the search for the common prefix of compilation directory and file path is somehow broken. For example this is what I get when compiling a file from `/tmp` with PWD=/home/pavel (so, these paths only share `/` as a prefix):
~ $ /tmp/clang.bad -g -gsplit-dwarf -c -o foo.o /tmp/foo.cpp
~ $ llvm-dwarfdump foo.o
foo.o: file format ELF64-x86-64
.debug_info contents:
0x00000000: Compile Unit: length = 0x0000001c version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000020)
0x0000000b: DW_TAG_compile_unit
DW_AT_stmt_list (0x00000000)
DW_AT_GNU_dwo_name ("foo.dwo")
DW_AT_GNU_pubnames (true)
DW_AT_GNU_dwo_id (0x441cbc2aa7bff7c5)
DW_AT_GNU_addr_base (0x00000000)
Notice that `DW_AT_comp_dir` is completely missing (so the debugger has no chance of finding the dwo file). If I revert this (and r348866) then I get correct behavior:
~ $ /tmp/clang.good -g -gsplit-dwarf -c -o foo.o /tmp/foo.cpp
~ $ llvm-dwarfdump foo.o
foo.o: file format ELF64-x86-64
.debug_info contents:
0x00000000: Compile Unit: length = 0x00000020 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000024)
0x0000000b: DW_TAG_compile_unit
DW_AT_stmt_list (0x00000000)
DW_AT_GNU_dwo_name ("foo.dwo")
DW_AT_comp_dir ("/home/pavel")
DW_AT_GNU_pubnames (true)
DW_AT_GNU_dwo_id (0x441cbc2aa7bff7c5)
DW_AT_GNU_addr_base (0x00000000)
If I run the same command from `/tmp` then I get the correct compilation directory, no matter which clang I use:
/tmp $ /tmp/clang.bad -g -gsplit-dwarf -c -o foo.o /tmp/foo.cpp
/tmp $ llvm-dwarfdump foo.o
foo.o: file format ELF64-x86-64
.debug_info contents:
0x00000000: Compile Unit: length = 0x00000020 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000024)
0x0000000b: DW_TAG_compile_unit
DW_AT_stmt_list (0x00000000)
DW_AT_GNU_dwo_name ("foo.dwo")
DW_AT_comp_dir ("/tmp")
DW_AT_GNU_pubnames (true)
DW_AT_GNU_dwo_id (0xfc9fc3a6ed2d6bbb)
DW_AT_GNU_addr_base (0x00000000)
Could you please check this out?
Thank you.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55519/new/
https://reviews.llvm.org/D55519
More information about the llvm-commits
mailing list