chore: DWARF / witness mapping discovery for fused output (sub-#130)#131
Draft
avrabe wants to merge 1 commit into
Draft
chore: DWARF / witness mapping discovery for fused output (sub-#130)#131avrabe wants to merge 1 commit into
avrabe wants to merge 1 commit into
Conversation
meld currently passes DWARF custom sections through fusion byte-for-byte. DWARF addresses encode byte offsets into the per-input code section, but fusion rewrites function bodies into a new merged code section — so every preserved DWARF address points at the wrong instruction (or out of range). The pulseengine `witness` MC/DC tool reads those addresses via gimli, so coverage attribution for fused modules is currently silently wrong. This change: - Adds `meld-core/tests/dwarf_passthrough.rs` pinning the current lossy-but-present behaviour as five green tests so any future remapping work has a clear oracle to flip. - Documents the witness DWARF contract and the cross-repo integration shape in the test's module docstring (witness intentionally stays out of meld-core's dep graph). No production code changes — defaults are unchanged. Phased plan (Phase 1.5 explicit policy, Phase 2 DWARF remap, Phase 3 adapter DIEs) tracked in #130. Refs #130 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.debug_*sections.Concrete numbers from the new test on
tests/wit_bindgen/fixtures/lists.wasm:Audit findings (committed in the test docstring + filed in #130)
FuserConfig::default().custom_sections == Merge(meld-core/src/lib.rs:110). DWARF is preserved, not dropped.merger.rs:2010-2012naively concatenates per-modulecustom_sectionswith no dedup or rewriting.lib.rs::encode_output(line 1345-1356) emits all of them unlessDropis configured.meld-core/src/parses or rewrites.debug_*content.parser.rs:1082-1084); only core-module custom sections flow through.Cross-repo dependency: witness
pulseengine/witnessv0.11.x is the consumer that breaks. It usesgimli(crates/witness-core/src/decisions.rs) to build a(code-section byte offset) -> (file, line)map for MC/DC attribution. The DWARF passed through by meld today gives gimli wrong + duplicated input.Witness is intentionally NOT a meld-core dependency. End-to-end "run witness on a fused module" verification belongs cross-repo (likely in
wasm-component-examplesrelease evidence). The test in this PR covers only meld-side invariants.What this PR contains
meld-core/tests/dwarf_passthrough.rs— 5 tests, all green:current_default_is_merge_not_drop— pins the default.fixture_carries_dwarf_in_some_embedded_module— sanity-check the fixture still has DWARF.fused_output_inherits_dwarf_byte_for_byte_today— pins that DWARF is forwarded with multiplicity (2 of each section in the fused output).drop_policy_strips_dwarf_completely— pins the user's only escape hatch today (CustomSectionHandling::Drop).dwarf_addresses_in_fused_output_are_known_to_be_wrong— pins the structural "code section length differs" invariant that proves passed-through addresses are invalid.Phased plan (tracked in #130)
.debug_*-aware policy distinct from generic custom-section handling. Recommend default = drop for.debug_*until Phase 2 ships, so users at least don't get wrong source attribution..debug_lineprograms and.debug_infoDW_AT_low_pc/DW_AT_high_pc/DW_AT_rangesto the merged code section using the function-body relocation map the merger already builds. Dedup.debug_str. Likely needs agimlidep on the meld-core side.br_iffallback). Variable-level debug info explicitly out of scope.Test plan
cargo test --package meld-core --test dwarf_passthrough— 5 tests green.cargo test --package meld-core --test wit_bindgen_runtime— 73 tests green.cargo test --package meld-core --lib— 198 unit tests green.Refs #130
🤖 Generated with Claude Code