Issue 210628.1: Clarification of relative paths in DW_AT_comp_dir

Author: Caroline Tice
Champion: Caroline Tice
Date submitted: 2021-06-28
Date revised: 2021-08-08
Date closed: 2021-08-09
Type: Clarification
Status: Accepted with modifications
DWARF Version: 6
Section 3.1.1, pg 64

Current text (Section 3.1.1, pg 64):
6. A DW_AT_comp_dir attribute whose value is a null-terminated string
containing the current working directory of the compilation command
that produced this compilation unit in whatever form makes sense for
the host system.

Proposal (allow relative paths, with clarification):
Add the following normative text after the current text:

"If a relative path is used in DW_AT_comp_dir, it will be relative 
to the location of the linked image containing the DW_AT_comp_dir entry."

Add the following non-normative text after the preceding text:

*In some cases a producer may allow the user to specify a relative
path for DW_AT_comp_dir. There are a few cases in which this is useful,
but in general using a relative path for DW_AT_comp_dir is discouraged
as it will not work well in many cases including the following:
different relative paths are used within the same build; the build
system creates multiple linked images in different directories; the
final linked image is moved before being debugged; .o files need to
be debugged directly.*

Updates to Section 6.2.4, pg 157

Add the following normative text after the end of the first paragraph
at the top of page 157:

"If the current directory itself is specified as a relative path, it is
relative to the location of the linked image containing the line table
entries (assuming the image has not been moved)."

2021-07-21: Revised: Added alternate proposal.
   Previous version:
2021-07-28: Revised: Remove proposal 1, add changes to 6.2.4 line table.
   Previous version:
2021-08-08: Clarified text added in Section 6.2.4.
2021-08-09: Accepted with modifications: remove parenthetical text in Sec. 6.2.4.