feat(dwarf): internal functions get their real names from the wasm name section (#394) - #565
Merged
Merged
Conversation
…me section (#394) Tier-1.x follow-up to #557: DW_TAG_subprogram DW_AT_name for INTERNAL (non-exported) functions was the synthetic func_N because the wasm `name` custom section (function-names subsection) was never parsed. A backtrace through a panic showed `func_7` instead of `core::panicking::panic_const::panic_const_add_overflow::h...`. - wasm_decoder: parse the `name` custom section (KnownCustom::Name → Name::Function map, best-effort — debug metadata must not fail a compile) into a new `FunctionOps.debug_name`, applied after the parse loop (the section trails the code section). Both decode_wasm_module and decode_wasm_functions. - CLI: thread `debug_name` through ElfFunction into the subprogram compose. Name priority: name-section > export name > func_N. DWARF-only — the symbol table and relocation labels keep using the export-name-or-func_N `name`, so linkability and emitted bytes are unchanged. - Oracle G (dwarf_debug_line_emit_394): ground truth parsed from the fixture at runtime; asserts ≥1 internal function's DIE carries its real name-section name and zero synthetic func_N names remain (msgq_put_359 names every function). RED before (func_7/8/10), GREEN after. Frozen-safe: purely additive DWARF metadata — frozen_codegen_bytes 3/3, .text byte-identical. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
avrabe
added a commit
that referenced
this pull request
Jul 2, 2026
…tooling (#567) Early cut per the release-early directive: #565 (internal functions get their real wasm name-section names in DW_TAG_subprogram — gdb backtraces show core::panicking::… instead of func_7) is merged downstream-facing value; ship it now rather than batch it behind the allocator spike. VCR-RA-001 re-scoped to v0.22.0 (rivet release status v0.21.0: no blocking artifacts). Pin sweep 0.20.0 -> 0.21.0 + MODULE.bazel + lock; CHANGELOG. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Tier-1.x follow-up to #557 (#394):
DW_TAG_subprogramDW_AT_namefor internal (non-exported) functions was the syntheticfunc_N, because the wasmnamecustom section (function-names subsection) was never parsed. A backtrace through a panic helper showedfunc_7instead of the real developer-facing name.Before → after (
msgq_put_359.wasm,--relocatable --debug-line, subprogramDW_AT_names):z_impl_k_msgq_putz_impl_k_msgq_putfunc_7core::panicking::panic_const::panic_const_add_overflow::hacec966df230a78ffunc_8gale::msgq::put_decide::h36409b4bbfd25a9agale_k_msgq_put_decidegale_k_msgq_put_decidefunc_10core::panicking::panic_fmt::h6651313c3e2c6c2fHow
wasm_decoder.rs: parse thenamecustom section (KnownCustom::Name→Name::Functionmap) into a newFunctionOps.debug_name, applied after the parse loop (the custom section trails the code section). Best-effort by design — debug metadata must never fail a compile. Bothdecode_wasm_moduleanddecode_wasm_functions.synth-cli/main.rs: threaddebug_namethroughElfFunctioninto the subprogram compose. Name priority: name-section > export name >func_N. DWARF-only — the symbol table and relocation labels keep using the export-name-or-func_Nname, so linkability is untouched.dwarf_line.rs: doc-only (the priority contract onSubprogramInfo.name).Oracle (RED → GREEN)
New Oracle G in
dwarf_debug_line_emit_394.rs(emitted_subprogram_names_use_name_section_for_internal_functions_394): ground truth (name section + export section) parsed from the fixture at runtime with wasmparser directly (non-circular). Asserts (a) ≥1 compiled internal function's DIE carries its real name-section name, and (b) zero syntheticfunc_Nnames remain (the fixture names every function). RED before — the pre-change binary emitsfunc_7/func_8/func_10and none of the internal real names appear anywhere in the object; GREEN after.Gates (exit-code-verified)
frozen_codegen_bytes: 3/3 —.textbyte-identical (purely additive DWARF metadata;.symtabunchanged)cargo test --workspace --exclude synth-verify: 90 suites, 1677 passed, 0 failed (exit 0)cargo fmt --check: exit 0cargo clippy --workspace --all-targets -- -D warnings: exit 0 (full workspace incl. synth-verify)🤖 Generated with Claude Code