[Dwarf-discuss] Facing a issue in contents of dwarf debug info section in an ELF file

David Anderson davea42@gmail.com
Wed Sep 27 23:45:07 GMT 2023


On 9/25/23 00:11, Kyle Huey via Dwarf-discuss wrote:
> Most likely the .debug_info section is SHF_COMPRESSED. Try compiling 
> with -gz=none.
> 

Also note that there are  different approaches that have been used.

If the section content starts with "ZLIB"
a struct is present and the content is zlib/libz
compressed. (I find the naming hard to keep straight,
libz/zlib meaning the same thing, link it in with -lz).

The Elf section name may start with .z, as for example
    .zdebug_info for the .debug_info section
     meaning .debug_info is libz compressed.

Using section (Elf) flag SHF_COMPRESSED
a struct begins the section with a type and size
libz    case ELFCOMPRESS_ZLIB
libzstd case ELFCOMPRESS_ZSTD (link it in with -lzstd)

Hopefully you will not need to handle more than one case.
David Anderson


More information about the Dwarf-discuss mailing list