[Dwarf-Discuss] The DWARF5 line table header
Mon Feb 17 00:48:50 GMT 2020
The question that seems to arise, in the DWARF5 standard, is "How does
entry refer to primary source file?"
The primary source file is index 0 in the file header table array
of strings. But by 2.14 no DW_AT_decl_file index can
refer to that name.? Unless saying 'no source line has been
specified' that is supposed to mean the primary source file
that 6.1.4 refers to?
I quote below what seem to be the relevant parts of the
What am I missing here?
Section 6.2.4 Line Number Program Header (starts at page 153).
Like table header, page 157
A count of the number of file name entries that occur in the following
file_names (sequence of file name entries)
A sequence of file names and optional related information. Each entry is
encoded as described by the file_name_entry_format field.
Entries in this sequence describe source files that contribute to the line
number information for this compilation or is used in other contexts,
in a declaration coordinate or a macro file inclusion.
The first entry in the sequence is the primary source file whose file name
exactly matches that given in the DW_AT_name attribute in the compilation
unit debugging information entry.
2.14 Declaration Coordinates Page 50.
It is sometimes useful in a debugger to be able to associate a
declaration with its
occurrence in the program source.
Any debugging information entry representing the declaration of an object,
module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and
DW_AT_decl_column attributes, each of whose value is an unsigned integer
The value of the DW_AT_decl_file attribute corresponds to a file number from
the line number information table for the compilation unit containing the
debugging information entry and represents the source file in which the
declaration appeared (see Section 6.2 on page 148). The value 0
indicates that no
source file has been specified.
The value of the DW_AT_decl_line attribute represents the source line
which the first character of the identifier of the declared object
value 0 indicates that no source line has been specified.
The value of the DW_AT_decl_column attribute represents the source column
number at which the first character of the identifier of the declared object
appears. The value 0 indicates that no column has been specified.
More information about the Dwarf-discuss