Skip to content

fix(dwarf): remap DW_AT_location lists to the fused layout (#319 inc 3) — --verify CLEAN#322

Merged
avrabe merged 1 commit into
mainfrom
fix/319-inc3-die-locations
Jul 1, 2026
Merged

fix(dwarf): remap DW_AT_location lists to the fused layout (#319 inc 3) — --verify CLEAN#322
avrabe merged 1 commit into
mainfrom
fix/319-inc3-die-locations

Conversation

@avrabe

@avrabe avrabe commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Final increment for #319 — takes the fused DWARF to llvm-dwarfdump --verify clean (No errors.).

Stacks on #320 (inc 1, merged) + #321 (inc 2). The residual "Invalid DW_AT_location" / "Invalid DWARF expressions" errors were the same base-relative-offset bug as inc 2, in .debug_loc location lists: gimli mis-routes each entry's begin/end (base-relative offsets) through convert_address → garbage ranges (e.g. [0x905993c0,…)) which, with the 0xFFFFFFFF/0xFFFFFFFE sentinels, derail the list decode.

Fix

correct_die_locations — the correct_die_ranges analogue for location lists: resolve each list from the read side (attr_locations, base applied), translate the entry endpoints to the fused layout, re-emit as Location::OffsetPair relative to the output CU base, carrying the location expression bytes verbatim (WASM location exprs — DW_OP_WASM_location / DW_OP_stack_value — hold no code addresses; a data DW_OP_addr is unchanged under fusion, matching convert_address's data passthrough). Bare exprloc locations aren't lists (attr_locationsNone) and are left to gimli. Unmappable entries dropped; emptied list deletes DW_AT_location (LS-D-1).

Effect — #319 complete

original inc 1 inc 2 inc 3
overlapping 480 0 0 0
not-contained 534 11 0 0
invalid-expr / loc 18 / 17 18 / 17 18 / 17 0 / 0
records+variants total 1049 46 35 0 — No errors.

records-only likewise → No errors.

Test

inc3_location_list_ranges_stay_in_module — fuses records.wasm, asserts every DW_AT_location list entry's range lies within the fused module (the ~2.4 GiB garbage begin failed before). 3 witness/inc2/inc3 + 24 dwarf unit tests pass.

Refs: #319.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

LS-N verification gate

58/58 approved LS entries verified

count
Passed (≥1 test, all green) 58
Failed (≥1 test failure) 0
Missing (no ls_*_NN_* test found) 0

Approved loss-scenarios.yaml entries are expected to have a
regression test named ls_<letter>_<num>_* (e.g. LS-A-11
ls_a_11_*). The gate runs each prefix via cargo test --lib --no-fail-fast and aggregates pass/fail/missing.

Failed LS entries

(none)

Missing regression tests

(none)

Updated automatically by tools/post_verification_comment.py.
Source of truth: safety/stpa/loss-scenarios.yaml.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Mythos delta-pass (auto)

NO FINDINGS across 1 Tier-5 file(s)

File Verdict Hypothesis
`` ✅ NO FINDINGS

Auto-run via anthropics/claude-code-action@v1
(SHA-pinned) on the touched Tier-5 files, using the
maintainer's Max-plan OAuth token. See
.github/workflows/mythos-auto.yml and
scripts/mythos/discover.md.

@github-actions github-actions Bot added the mythos-pass-done Mythos delta-pass completed on Tier-5 file changes; findings (or NO FINDINGS) attached to PR label Jul 1, 2026
@avrabe

avrabe commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Mythos delta-pass — NO FINDINGS (meld-core/src/dwarf.rs)

correct_die_locations reuses the inc-2 correct_die_ranges skeleton (lockstep read↔write DIE walk, CU-base, tombstone-drop) already cleared NO FINDINGS on #321 (empirically: 261 units / 195k DIEs, 0 desync). Focused the pass on the NEW surface:

  1. Verbatim location-expression copy (Expression::raw) — sound. Dumped .debug_loc for 6 fixtures (records/results/resources/variants/strings/resource_with_lists): expression opcodes are exclusively DW_OP_WASM_location / DW_OP_stack_value / DW_OP_lit* / DW_OP_const* / DW_OP_plus_uconst etc. — zero DW_OP_addr/addrx/call*/entry_value, so no embedded code address to go stale (LS-D-1 N/A). A data DW_OP_addr (linear memory) is unchanged under multi-memory fusion anyway, matching convert_address's data passthrough.
  2. Expression framing exact — gimli read LocationListEntry.data = Expression(input.split(len)) (no length prefix); write::Expression::raw stores verbatim and the writer re-prepends the length. --verify structurally validates expressions (a corrupted build reproduces "Invalid DWARF expressions"), and it's clean.
  3. Exprloc gate correct — attr_locations returns None for a bare inline exprloc → left to gimli.

Oracle: freshly-built binary → llvm-dwarfdump --verify = No errors. across all 6 fixtures (records-only + records+variants). No failing test constructible. Adding mythos-pass-done.

Final increment — takes the fused DWARF to llvm-dwarfdump --verify clean.
The residual Invalid DW_AT_location / Invalid DWARF expressions were the same
base-relative-offset bug as inc 2, in .debug_loc location lists. Fix:
correct_die_locations (the correct_die_ranges analogue) rebuilds each list
from the read side, translating entry endpoints and carrying the location
expression bytes verbatim; unmappable entries dropped, emptied list deletes
the attribute (LS-D-1). records-only + records+variants both -> No errors
(cumulative #319: 1049 -> 0). Test: inc3_location_list_ranges_stay_in_module.

Refs: #319.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@avrabe avrabe force-pushed the fix/319-inc3-die-locations branch from 61b078d to 3c075ac Compare July 1, 2026 18:29
@avrabe avrabe merged commit 697474d into main Jul 1, 2026
14 checks passed
@avrabe avrabe deleted the fix/319-inc3-die-locations branch July 1, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mythos-pass-done Mythos delta-pass completed on Tier-5 file changes; findings (or NO FINDINGS) attached to PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant