Add DWARF5 sections in dwarf_section_names_xlat
Patch adds missing DWARF5 section names to binutils' Mach-O support to fix GDB debug info issues.
A patch adds DWARF5 section names like .debug_addr and .debug_line_str to the dwarf_section_names_xlat table in bfd/mach-o.c. This addresses a bug where GDB could not find necessary DWARF5 sections on macOS, leading to incorrect debug information parsing for executables. The fix was tested by rebuilding GDB and confirming that the previous error message no longer appears.
In Details
This patch modifies the bfd library's Mach-O object file parser to recognize new DWARF5 debugging sections. The dwarf_section_names_xlat table maps DWARF section names to internal BFD representations. The issue arises when GDB, which relies on BFD, encounters DWARF5 sections not present in this table, preventing it from correctly processing debug information on macOS.
- DWARF
- A standardized debugging data format used by many compilers to store information about variables, types, and code structure for debuggers.
- DWARF5
- The fifth version of the DWARF debugging data format, introducing new features and sections for improved debugging capabilities.
- Mach-O
- The executable file format used by macOS and iOS, analogous to ELF on Linux or PE on Windows.
- bfd
- The Binary File Descriptor library, part of GNU Binutils, providing a common interface for reading and writing various object file formats.
- .debug_str
- A DWARF section containing null-terminated strings, often used for C++ mangled names or other string literals.
- .debug_str_offsets
- A DWARF section that provides offsets into the .debug_str section, allowing for more efficient string lookup.