Issue 250131.1: DW_IDX_parent semantic
| Author: | Simon Marchi |
|---|---|
| Champion: | Simon Marchi |
| Date submitted: | 2025-01-31 |
| Date revised: | 2025-02-11 |
| Date closed: | 2025-03-17 |
| Type: | Error |
| Status: | Accepted |
| DWARF version: | 6 |
Background
In Section 6.1.1.2, the parent index entry attribute is described as:
Parent debugging information entry, a reference to the index entry for the parent. This is represented as the offset of the entry relative to the start of the entry pool.
But in Table 6.1, DW_IDX_parent is described as:
Index of name table entry for parent
These two contradict each other. The first one makes more sense, as it points to a specific index entry, making it non-ambiguous. With the second one, pointing to an name table entry, how to know which of the (possibly multiple) entries associated to that name is the parent?
This caused confusion with the LLVM team here, where it was believed that either meaning was acceptable.
In the end, LLVM implemented the "offset to the index entry" approach.
GDB initially implemented the "name table index" approach (but noted that it was a curious choice, given it's ambiguous), but was recently changed to point directly to an entry in the entry pool:
dwarfdump also treats the value as "offset to parent in the entry pool":
Proposal
In Table 6.1, change the meaning of DW_IDX_parent to "Offset of the parent
entry relative to the start of entry pool" (could be shortened if it's
too long).
Open question
Table 7.23 indicates that the form class of DW_IDX_parent is constant.
Is it still correct, given the corrected meaning of DW_IDX_parent?
There is no class that looks like a better fit. I initially thought
that reference would be good, but it's documented as specifically
referring to a DIE, which is not the case here.
2025-02-11: Revised. Added additional references and a proposal for resolution.
2025-03-17: Accepted. Re open question: constant class is still correct.