binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
binutils/gprof

Gprof enables decompression before checking separate debug files

Gprof now enables decompression for separate debug files earlier, fixing source line reporting for compressed DWARF sections.

This change modifies gprof to enable decompression for separate debug files before checking their format. Previously, this occurred after format checking, causing issues with compressed DWARF sections. By enabling decompression earlier, gprof now correctly reports source lines for files like tst-gmon-gprof-l2, which previously showed unknown locations.

In Details

The binutils/gprof subsystem initializes BFD (Binary File Descriptor) to read symbol information from executables and core dumps. This commit adjusts the order of operations when opening separate debug files. It ensures that the BFD_DECOMPRESS flag is set on the debug BFD *before* bfd_check_format() is called, mirroring the behavior for the main executable in core_init(). This resolves a bug where compressed DWARF sections in separate debug files were not being correctly decompressed, leading to incorrect source line reporting.

For Context
gprof
A performance analysis tool that profiles a program's execution and provides information about the time spent in different functions.
BFD
Binary File Descriptor library, a C library used by binutils and GDB to provide a common interface for reading and writing various executable file formats.
DWARF
A debugging data format used by many compilers and linkers. It stores information about variables, types, and source code locations.
compressed DWARF
A version of DWARF debugging information that has been compressed to reduce file size. This requires decompression before the information can be used.
separate debug files
A mechanism where debugging information (like DWARF) is stored in a separate file from the executable itself. This can help reduce the size of the main executable.
BFD_DECOMPRESS
A flag within the BFD library that indicates whether decompression should be applied to section data when reading files.
bfd_check_format
A BFD library function that checks and identifies the file format of a given BFD object.
Filed Under: binutilsgprofdebuggingdwarf