gprofng: fix 32892 source line level information not available with "-g -O2"
gprofng ignored DW_AT_specification.
As a result, gprofng skiped Dwarf for all functions declared as:
< 2>:<0x0000f725> DW_TAG_subprogram(46)
DW_AT_linkage_name(110) "func_name"
DW_AT_declaration*(60) 0x1 (1)
< 1>:<0x00015acc> DW_TAG_subprogram(46)
DW_AT_specification(71) 0xf725 (63269)
Another problem was that gprofng ignored DW_AT_ranges.
As a result, many functions are mapped to the <Unknown> module.
gprofng/ChangeLog
2025-05-01 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR 32892
* src/Dwarf.cc: Handle DW_AT_specification and DW_AT_ranges.
* src/DwarfLib.cc: Likewise.
* src/DwarfLib.h: Likewise.
* src/Dwarf.h (get_ranges): New function.
* src/Stabs.h (get_symbols): New function.
* src/Stabs.cc: Move Symbol class to src/Symbol.cc.
* src/Symbol.cc: New file.
* src/Symbol.h: New file.
* src/Makefile.am: Add Symbol.cc in build.
* src/Makefile.in: Rebuild.
* src/LoadObject.cc (dump_functions): Improve output for -dfunc option.
11 files changed