pr34322: assertion failure in get_or_create_member_type
Fixes a bug in binutils' DWARF processing that caused an assertion failure when encountering DW_TAG_member without a proper struct/union parent.
This patch addresses PR 34322 by modifying binutils’ DWARF parsing logic. Specifically, it changes get_or_create_member_type to return NULL if the parent is NULL, and insert_element_in_list to ignore DW_TAG_member entries that lack a struct or union parent. This prevents an assertion failure and ensures malformed DWARF information is handled more gracefully.
- proposer
Submits a patch to fix PR 34322 by adjusting DWARF parsing to handle missing parent types for DW_TAG_member.
“I thought about warning "DW_TAG_member without struct/union parent" here but decided that doesn't help much as the warning is disconnected from output. As it is the --map-global-vars code silently ignores unexpected attributes that might be found in fuzzed files. I'm fine with that too. PR 34322 * dwarf.c (get_or_create_member_type): Return NULL on NULL parent. (insert_element_in_list): Ign…”
In Details
This patch for binutils addresses a bug in the DWARF debugging information parser related to processing DW_TAG_member entries. It corrects an assertion failure in get_or_create_member_type by handling cases where a member_parent is NULL, and modifies insert_element_in_list to gracefully ignore DW_TAG_member DIEs that lack a proper struct or union parent. This improves robustness when parsing DWARF data from potentially malformed object files, particularly for targets like avr.
- DWARF
- A standardized debugging data format used by compilers and debuggers to represent information about variables, types, functions, and source code locations within an executable.
- PR 34322
- A specific bug report number within the binutils project's issue tracking system.
- DW_TAG_member
- A DWARF tag indicating a member of a structure or union.
- DIE
- Debug Information Entry. A fundamental unit within DWARF data, representing a symbol or type.
- struct/union parent
- In DWARF, a
DW_TAG_memberDIE is typically a child of aDW_TAG_structure_typeorDW_TAG_union_typeDIE, establishing the context of the member. - --map-global-vars
- A binutils option likely related to mapping global variables, potentially interacting with DWARF information.