test(dwarf): independent-parser gate via llvm-dwarfdump on emitted DWARF (#394) - #763
Merged
Conversation
…tted DWARF (#394) Oracles A–H validate synth's emitted `.debug_info`/`.debug_line` with `gimli::read` — the same library `gimli::write` produced the bytes with, so a self-consistent emitter bug (an encoding gimli round-trips but real toolchains reject) passes them. Oracle I closes that gap with the INDEPENDENT LLVM parser: * `llvm-dwarfdump --verify` must report "No errors" (its structural + parent/child PC-range containment checks — the #564/Oracle-H property, now cross-validated by a second implementation); * `--debug-info` must decode the CU + ≥1 `DW_TAG_subprogram` with `DW_AT_name` + `DW_AT_low_pc`/`DW_AT_high_pc`; * `--debug-line` must decode ≥1 line row. The tool is REQUIRED: the gate FAILS (never skips) when no `llvm-dwarfdump` is found — so it cannot silently go vacuous on a host that lacks it (the "harness that skips on an assumption is a vacuous gate" trap). CI wires an `apt-get install -y llvm` step into the Test job so the binary is always present on ubuntu-latest. Locally the finder also accepts $LLVM_DWARFDUMP and the macOS Xcode-toolchain path. Observed on the msgq_put_359 fixture: --verify "No errors"; 5 subprogram DIEs (z_impl_k_msgq_put, gale::msgq::put_decide::h…, core::panicking::panic_fmt::h…, …); 109 decoded line rows. .debug_line + .debug_info emission for #394 (VCR-DBG-001) was already implemented and merged (PRs #429–#573); this adds the one explicitly-named deliverable that was unmet — an independent-parser gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
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_line+.debug_infoemission for #394 (VCR-DBG-001) is already implemented and merged on main (PRs #429, #430, #443, #550, #557, #565, #573): synth emits a real line-number program plus a compile-unit DIE and oneDW_TAG_subprogramDIE per function, all relocated against__synth_text_base, gated by 9 passing oracle tests (A–H).The one deliverable #394's gate spec named that was still unmet: an independent-parser check. Oracles A–H parse synth's emitted DWARF with
gimli::read— the same librarygimli::writeproduced the bytes with — so a self-consistent emitter bug (an encoding gimli round-trips but real toolchains reject) would pass them. This PR adds that missing gate.What's new — Oracle I (
emitted_dwarf_verifies_with_llvm_dwarfdump_394)Runs the independent LLVM DWARF parser against synth's emitted
.o:llvm-dwarfdump --verifymust report "No errors" — its structural checks and the parent/child PC-range containment rule (the DWARF regression: compile_unit DW_AT_high_pc (line-table extent) doesn't cover child subprogram DIEs (code extent) — fails llvm-dwarfdump --verify post-link #564 / Oracle-H property, now cross-validated by a second implementation).--debug-infomust decode the CU + ≥1DW_TAG_subprogramcarryingDW_AT_name+DW_AT_low_pc/DW_AT_high_pc.--debug-linemust decode ≥1 line row.Non-vacuous by construction: the tool is REQUIRED — the gate fails, never skips, when no
llvm-dwarfdumpis found. CI wiresapt-get install -y llvminto the Test job so the binary is always present onubuntu-latest. Locally the finder also accepts$LLVM_DWARFDUMPand the macOS Xcode-toolchain path.Evidence —
msgq_put_359fixturellvm-dwarfdump --debug-info(CU + 5 subprogram DIEs, real names):--debug-line(sample rows):Oracle I summary line:
--verify: No errors; --debug-info decoded 5 subprogram DIE(s); --debug-line decoded 109 row(s).Test / CI
cargo test -p synth-cli --test dwarf_debug_line_emit_394— 10 passed (9 existing + Oracle I).cargo fmt --check,cargo clippy -p synth-cli --all-targets -- -D warningsclean.ubuntu-latest) now installsllvmand runs the gate viacargo test --workspace.Refs #394 (VCR-DBG-001), #242.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L