Gprofng handles DW_AT_decl_file 0 in DWARF 5 for accurate source file reporting.
Gprofng now correctly identifies source files for declarations in DWARF 5, fixing incorrect reporting of header files.
Gprofng has been updated to correctly handle DW_AT_decl_file with a value of 0 in DWARF 5. Previously, this was rejected, causing functions declared in the primary source file to be erroneously associated with a header file. This change ensures that declarations within the primary source file are now accurately reported.
In Details
This commit modifies gprofng's DWARF 5 parsing to correctly interpret DW_AT_decl_file pointing to index 0. In DWARF 5, index 0 refers to the primary source file, and Clang uses this for declarations within that file. The previous logic, inherited from DWARF 4's interpretation of 0 as 'no file', led to DwrCU::get_source returning no file, causing setSource to fall back to a different file. The fix involves accepting index 0 for DWARF 5+ and introducing DwrCU::get_decl_source to distinguish between 'file 0' and 'no attribute'. This is crucial for accurate source mapping.
- DW_AT_decl_file
- A DWARF attribute that specifies the source file in which a debug information entry (DIE) is declared.
- DWARF 5
- The fifth version of the DWARF debugging data format, which introduces new features and clarifications over DWARF 4.
- DIE
- Debug Information Entry. A fundamental unit of information within a DWARF debugging data section.