Add DWARF5 sections to mach-o section name translation table
Binutils BFD now recognizes DWARF5 sections for mach-o object files, fixing a GDB error.
Binutils’ BFD library has been updated to include support for DWARF5 debugging sections in mach-o object files. Previously, sections like .debug_str_offsets and others were not recognized, leading to errors in GDB when processing DWARF5-formatted debug information. This change adds these sections to the dwarf_section_names_xlat table, resolving a bug where GDB reported missing .debug_str sections when .debug_str_offsets was actually the issue.
In Details
The bfd/mach-o.c file is updated to extend the dwarf_section_names_xlat table. This table maps DWARF section names to their mach-o segment/section equivalents. The addition of DWARF5-specific sections (e.g., .debug_addr, .debug_str_offsets, .debug_line_str, .debug_loclists, .debug_macro, .debug_names, .debug_str) ensures that the mach-o backend correctly identifies and processes these sections when GDB or other tools attempt to read DWARF5 debug information from mach-o binaries.
- DWARF5
- The fifth version of the DWARF (Debugging With Attributed Record Formats) standard, a set of compiler-generated symbolic debugging information formats used by many compilers and debuggers. DWARF5 introduces new forms and sections for improved debugging capabilities.
- mach-o
- Mach Object file format, the executable file format used by macOS, iOS, and other Apple operating systems. It is the native object file format for these platforms.
- BFD
- The Binary File Descriptor library, a core component of GNU Binutils that provides a common interface for handling various executable file formats (like ELF, COFF, a.out).
- .debug_str
- A DWARF section that contains null-terminated strings, typically used for identifying names of functions, variables, and types.
- .debug_str_offsets
- A DWARF5 section that provides offsets into the
.debug_strsection, allowing for more efficient string lookups, especially when dealing with many strings or long strings.