The question that seems to arise, in the DWARF5 standard, is "How does DW_AT_decl_file 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 DWARF5 std. What am I missing here? David Anderson =============== Section 6.2.4 Line Number Program Header (starts at page 153). Like table header, page 157 file_names_count (ULEB128) A count of the number of file name entries that occur in the following file_names field. 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, such as 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 constant. 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 number at which the first character of the identifier of the declared object appears. The 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. =============== _______________________________________________ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org