Add DWARF5 sections in dwarf_section_names_xlat
Adds support for DWARF5 debugging sections to binutils' Mach-O object file handling, fixing GDB errors.
Tom de Vries proposes a patch to binutils to add support for several DWARF5 debugging sections, which were missing from the dwarf_section_names_xlat table in bfd/mach-o.c. This omission caused GDB to fail when processing Mach-O files containing these DWARF5 sections, specifically reporting errors related to missing .debug_str_offsets and other sections. The patch adds these missing sections, resolving the GDB errors and allowing successful debugging.
- proposer
Submitted a patch to add missing DWARF5 section names to the Mach-O handler in binutils.
“This is because that and other DWARF5 sections are not supported in the dwarf_section_names_xlat table in bfd/mach-o.c. Fix this by adding the missing sections.”
In Details
This patch targets the Mach-O backend within binutils' BFD library, specifically addressing incomplete support for DWARF5 debugging information. The issue arises because the dwarf_section_names_xlat table in bfd/mach-o.c does not map all recognized DWARF5 section names (e.g., .debug_addr, .debug_line_str, .debug_str_offsets) to their corresponding internal BFD representations. This leads to errors when tools like GDB attempt to process DWARF5-compliant object files generated for Mach-O targets, particularly on macOS.
- DWARF
- A debugging data format used by many compilers and debuggers to store information about program variables, types, and structure.
- DWARF5
- The fifth version of the DWARF debugging data format, introducing new features and sections for improved debugging capabilities.
- Mach-O
- Mach Object file format, the standard executable file format used on macOS and iOS.
- bfd
- Binary File Descriptor library, a low-level library used by GNU Binutils for handling various object file formats.
- dwarf_section_names_xlat
- A translation table within binutils/bfd that maps section names (e.g., '.debug_line') to internal BFD attributes for different object file formats.
- .debug_str_offsets
- A DWARF5 section containing offset information for string data, used for efficient string lookup during debugging.