[Dwarf-Discuss] DWARF v5 and "file 0"
Thu Jul 8 23:37:32 GMT 2021
On Thu, Jul 08, 2021 at 03:36:24PM -0700, David Anderson via Dwarf-Discuss wrote:
> On 7/8/21 12:23 PM, Paul Robinson via Dwarf-Discuss wrote:
> > The file table also added an entry for file 0, claiming that it
> > similarly used to mean the primary compilation file. I can't find
> > any evidence that was actually true, though; the default value for
> > the line-number program's "file" register was (and still is) 1, not
> > 0, and in fact section 2.14 says that DW_AT_decl_file = 0 means
> > there is no source file (analogous to line 0 meaning no specific
> > source line).
> "DWARF5 Line Table File Numbers"
> in the dwarfstd.org wiki
> explains the basic contradiction in DWARF5
> file numbering. It's impossible to
> obey the standard as written.
> Likely the best way around
> the contraction in DWARF5
> is to declare the special
> value of 0 ( in section 2.14)
> as invalid and erase it.
> (See the wiki entry
> for more details).
> DWARF4 has no such contradiction.
Just to make sure I understood
and the discussions at
correctly, it sounds like the general consensus is that:
* In DWARF 5, file name entries are zero-indexed.
* DW_AT_decl_file of 0 means the first file name entry (index 0, which
happens to be the same as DW_AT_name of the unit). It does NOT mean an
unspecified file; that was an oversight in the specification.
Is that correct?
More information about the Dwarf-discuss