Gprofng resolves DWARF 5 indexed string and address forms.
Gprofng now correctly interprets DWARF 5 indexed strings and addresses, fixing issues with compilation unit names and PC ranges.
Gprofng has been updated to correctly resolve DWARF 5’s default indexed string (DW_FORM_strx*) and address (DW_FORM_addrx*) forms. Previously, these indices were misinterpreted, leading to incorrect compilation unit names, directories, and program counter ranges, causing display issues. This change ensures accurate resolution by using .debug_str_offsets and .debug_addr sections.
In Details
This commit addresses the incorrect handling of DWARF 5's default indexed forms, DW_FORM_strx* and DW_FORM_addrx*, in gprofng. Clang generates these by default for DWARF 5, using DW_AT_str_offsets_base and DW_AT_addr_base to resolve indices into .debug_str_offsets and .debug_addr respectively. The prior implementation treated DW_FORM_strx indices as byte offsets into .debug_str and DW_FORM_addrx indices as direct addresses, leading to incorrect string and PC range interpretation. The fix involves queuing indexed attributes during DIE parsing and resolving them after the DI…
- DW_FORM_strx*
- DWARF form specifier indicating a string reference using an index into the
.debug_str_offsetssection. - DW_FORM_addrx*
- DWARF form specifier indicating an address reference using an index into the
.debug_addrsection. - DW_AT_str_offsets_base
- DWARF attribute specifying the base offset for indexed string references in the
.debug_str_offsetssection. - DW_AT_addr_base
- DWARF attribute specifying the base offset for indexed address references in the
.debug_addrsection. - .debug_str_offsets
- A DWARF section containing offsets into the
.debug_strsection, used for indexed string lookups. - .debug_addr
- A DWARF section containing addresses, used for indexed address lookups.