[PATCH] D131749: [MCDwarf] Respect -fdebug-prefix-map= for generated assembly debug info (DWARF v5)

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 11:10:36 PDT 2022


dblaikie added inline comments.


================
Comment at: llvm/test/MC/ELF/debug-prefix-map.s:36-38
+## include_directories[0] is relative to DW_AT_comp_dir, so there are two src_root
+## path components. This is not great but acceptable, because the -fdebug-prefix-map=
+## destination path is supposed to be absolute in practice.
----------------
I'm not sure this comment is correct (perhaps there's a bug in `llvm-dwarfdump` if both `include_directories[0]` and `DW_AT_comp_dir` are both being joined together). From the DWARFv5 spec:

> The first entry is the current directory of the compilation. Each additional path entry is either a full path name or is relative to the current directory of the compilation.
> The line number program assigns a number (index) to each of the directory entries in order, beginning with 0.
> Prior to DWARF Version 5, the current directory was not represented in the directories field and a directory index of 0 implicitly referred to that directory as found in the DW_AT_comp_dir attribute of the compilation unit debugging information entry. In DWARF Version 5, the current directory is explicitly present in the directories field. 


So maybe `llvm-dwarfdump` is incorrectly joining `DW_AT_comp_dir` to `include_directories[0]`?

I'm not sure the suggestion that `-fdebug-prefix-map=` is meant to be absolute is the case in practice - I think Chromium folks implemented it so they could have relative debug info that could be built on a build farm and shared between multiple developers with different source tree locations. So I /think/ it's probably usually relative (the same as Google's use of `-fdebug-compilation-dir=/proc/self/cwd` (which, is, admittedly, technically, an absolute path - but I don't think that's the case for Chromium)... huh, maybe chromium doesn't use prefix map anymore? https://chromium.googlesource.com/chromium/src/+/71df8872b86b4d8260230742cfd3b2e4756f62b5%5E%21/#F0 )


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131749/new/

https://reviews.llvm.org/D131749



More information about the llvm-commits mailing list