DWARF Debugging Format DWARF Debugging Standard Wiki

DWARF4

DWARF4 Line Table File Numbers

There is no self-contradiction here.

DW_AT_decl_file Sec 2.14 Declaration Coordinates page 50.

  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.

DW_LNS_set_file Defined in sec 6.2.5.2 page 119.

  Stores the file value into the file register of the state\   machine.  \   [comment: Nothing is said about 0 meaning no source file.]

DW_MACINFO_start_file Section 6.3.1.2 page 124.

  This index corresponds to a file number in the line\   number information table for the relevant compilation unit.\   [comment: Nothing is said about 0 meaning no source file.]

Table 6.2.2 state machine registers page 109 file

  An unsigned integer indicating the identity of\   the source file corresponding to a machine\   instruction. \   [comment: While not stated it is clear this\   refers to the line table header file table.]\   [comment: Nothing is said about 0 meaning no source file.]\    

Section 6.2.2 Page 111 initial state of the registers file 1

  [comment; Nothing is said on why 1 is appropriate here.]\   [comment: Seemingly there is an assumption that the file\   table has at least one entry, and that first\   entry is numbered 1 and is the primary source file.]\   [comment: Nothing is said about 0 meaning no source file.]

Section 6.2.4 page 115

  The primary source file is described by an entry whose\   path name exactly matches that given in the DW_AT_name\   attribute in the compilation unit, and whose directory is\   understood to be given by the implicit entry with index 0.

  The line number program assigns numbers to each of the\   file entries in order, beginning with 1, and uses those\   numbers instead of file names in the file register.

  [comment: nothing stops a DWARF4 compiler from emitting\   an initial file with the name of the primary source file.\   And having the 'file register' default to 1 suggests\   stronly that it is advisable for compiler writers to add\   this source file name first. Thus having consistency\   with the initial state of the registers].

  The line number program assigns numbers to each of the\   file entries in order, beginning with 1, and uses those\   numbers instead of file names in the file register.

dwarfstd.org is supported by Sourceware. Contributions are welcome.

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2022 by DWARF Standards Committee.