Skip to content

Repair invalid DWARF scope ranges after transforms - #8964

Open
cpunion wants to merge 1 commit into
WebAssembly:mainfrom
cpunion:codex/fix-dwarf-range-topology-6406
Open

Repair invalid DWARF scope ranges after transforms#8964
cpunion wants to merge 1 commit into
WebAssembly:mainfrom
cpunion:codex/fix-dwarf-range-topology-6406

Conversation

@cpunion

@cpunion cpunion commented Aug 2, 2026

Copy link
Copy Markdown

Summary

  • preserve LLVM nonzero tombstones instead of remapping dead DIEs to address zero
  • reject lost or reversed low/high PC pairs without unsigned wraparound
  • normalize updated range lists and rebuild range-list parents from surviving child scopes
  • make ambiguous overlapping sibling scopes unavailable instead of assigning them incorrect code ranges

Binaryen currently updates DWARF range endpoints independently. When optimization or Asyncify removes or reorders expressions, the resulting endpoints can wrap, overlap, or escape their parent scope. This is the same failure mode reported in #6406, extended to range lists and scope topology.

The repair is conservative: representable parent unions are preserved, while ambiguous scopes fail closed. Empty replacement range lists are appended rather than mutating lists that another DIE may share.

Validation

  • python3 check.py wasm-opt
  • all existing DWARF pass fixtures, including ignore_missing_func_dwarf, inlined_to_start_dwarf, and class_with_dwarf_noprint
  • llvm-dwarfdump --verify reports no errors after roundtrip and Asyncify for those fixtures
  • a 73-CU Emscripten final module that previously reported containment, internal-overlap, and sibling-overlap errors now verifies with no errors after its final Asyncify transform

Fixes #6406.

Preserve nonzero tombstones, reject lost or reversed low/high pairs, normalize range lists, and repair parent scope ranges from surviving children. Ambiguous sibling scopes are made unavailable instead of being assigned incorrect code ranges.
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.

Impossible address ranges in DWARF debug info

1 participant