Skip to content

fix(visitor): ignore DW_AT_decl_file/line in visit_namespace#14

Merged
wu-vincent merged 1 commit into
mainfrom
fix/issue-13-namespace-decl-file
May 16, 2026
Merged

fix(visitor): ignore DW_AT_decl_file/line in visit_namespace#14
wu-vincent merged 1 commit into
mainfrom
fix/issue-13-namespace-decl-file

Conversation

@wu-vincent
Copy link
Copy Markdown
Member

Summary

visit_namespace crashed with ValueError: Unhandled attribute DW_AT_decl_file on binaries whose namespace DIEs carry a declaration location.

Namespace DIEs can include DW_AT_decl_file / DW_AT_decl_line (where the namespace was first declared), but the attribute match in visit_namespace had no skip-set, so those attributes fell through to the catch-all case _: and raised. Every other visitor (visit_typedef, visit_enumeration_type, …) already skips these declaration-location attributes.

This adds the same if attribute.name in {...}: continue skip-set to visit_namespace. The attributes are safely ignored: a namespace does not need a source location (namespaces re-open across files); its members each carry their own.

Closes #13

Test plan

  • Run dwarf2cpp on a binary whose namespaces carry DW_AT_decl_file (the case from Error in visit_namespace #13) and confirm it no longer raises.

Namespace DIEs can carry DW_AT_decl_file and DW_AT_decl_line, but the
attribute match in visit_namespace had no skip-set, so those fell
through to the catch-all and raised ValueError. Skip them, matching
visit_typedef, visit_enumeration_type and the other visit_* methods.
@wu-vincent wu-vincent merged commit f96cfc9 into main May 16, 2026
2 of 3 checks passed
@wu-vincent wu-vincent deleted the fix/issue-13-namespace-decl-file branch May 16, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in visit_namespace

1 participant