binutils Newspaper
NOVEMBER 30, 2026
gprof — Proposed

gprof: Enable decompression before checking separate debug files

Patch enables DWARF decompression in gprof before reading section headers, fixing incorrect source line reporting with compressed separate debug files.

This patch addresses a bug in gprof where compressed DWARF debug information in separate files causes incorrect source line reporting, showing “:0” instead of the expected file and line numbers. The fix involves enabling the BFD_DECOMPRESS flag before BFD reads section headers, ensuring that compressed sections are handled correctly, similar to how the main executable is processed.

In the Thread 1 participant
  1. Li Guan proposer

    Submits a patch to fix incorrect source line reporting in gprof when using compressed DWARF debug files.

    “Set BFD_DECOMPRESS before bfd_check_format(), as core_init() already does for the main executable, so the separate debug file is opened with the same section decompression behavior.”

In Details

This patch modifies the gprof tool's handling of core files, specifically when dealing with separate debug information that uses DWARF compression. The issue arises because the BFD library's bfd_check_format() function, called during the processing of separate debug files, does not have decompression enabled by default. This leads to incorrect interpretation of section headers when DWARF is compressed, resulting in lost source location information. The patch preemptively sets the BFD_DECOMPRESS flag on the debug BFD object, ensuring proper decompression and accurate source mapping, mirr…

For Context
gprof
A Unix performance analysis tool that generates call graph profiles of a program.
DWARF
A debugging data format used by many compilers and debuggers to represent information about source code, types, and variables.
compressed DWARF
DWARF debugging information that has been compressed using algorithms like zlib to reduce file size.
separate debug files
Debug information that is stored in separate files from the executable, allowing for smaller executables and easier management of debug data.
BFD
Binary File Descriptor library. A low-level library used by GNU Binutils to read and write various executable file formats.
BFD_DECOMPRESS
A flag within the BFD library that indicates whether compressed sections should be automatically decompressed.
Filed Under: binutilsgprofdebugDWARFcompression