Skip to content

test(dwarf): independent-parser gate via llvm-dwarfdump on emitted DWARF (#394) - #763

Merged
avrabe merged 1 commit into
mainfrom
feat/44-394-dwarf-line-info
Jul 15, 2026
Merged

test(dwarf): independent-parser gate via llvm-dwarfdump on emitted DWARF (#394)#763
avrabe merged 1 commit into
mainfrom
feat/44-394-dwarf-line-info

Conversation

@avrabe

@avrabe avrabe commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

.debug_line + .debug_info emission 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 one DW_TAG_subprogram DIE 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 library gimli::write produced 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:

  1. llvm-dwarfdump --verify must 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).
  2. --debug-info must decode the CU + ≥1 DW_TAG_subprogram carrying DW_AT_name + DW_AT_low_pc/DW_AT_high_pc.
  3. --debug-line must decode ≥1 line row.

Non-vacuous by construction: the tool is REQUIRED — the gate fails, never skips, when no llvm-dwarfdump is found. CI wires apt-get install -y llvm 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.

Evidence — msgq_put_359 fixture

Verifying .debug_info Unit Header Chain...
Verifying unit: 1 / 1, "panicking.rs"
Verifying .debug_line...
No errors.

llvm-dwarfdump --debug-info (CU + 5 subprogram DIEs, real names):

DW_TAG_compile_unit   DW_AT_name ("panicking.rs")  low_pc 0x0  high_pc 0x42e
  DW_TAG_subprogram   DW_AT_name ("z_impl_k_msgq_put")                          [0x000,0x216)
  DW_TAG_subprogram   DW_AT_name ("core::panicking::panic_const::…add_overflow…") [0x218,0x22e)
  DW_TAG_subprogram   DW_AT_name ("gale::msgq::put_decide::h36409b4bbfd25a9a")   [0x230,0x362)
  DW_TAG_subprogram   DW_AT_name ("gale_k_msgq_put_decide")                      [0x364,0x426)
  DW_TAG_subprogram   DW_AT_name ("core::panicking::panic_fmt::h6651313c3e2c6c2f") [0x428,0x42e)

--debug-line (sample rows):

Address            Line  File
0x…0220            175   1
0x…0224            175   1
0x…0248            175   1

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_39410 passed (9 existing + Oracle I).
  • cargo fmt --check, cargo clippy -p synth-cli --all-targets -- -D warnings clean.
  • CI Test job (ubuntu-latest) now installs llvm and runs the gate via cargo test --workspace.

Refs #394 (VCR-DBG-001), #242.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L

…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
@avrabe
avrabe merged commit 4bde940 into main Jul 15, 2026
36 checks passed
@avrabe
avrabe deleted the feat/44-394-dwarf-line-info branch July 15, 2026 17:06
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.

1 participant