Skip to content

Give the PdbGen tests real coverage via the compiler's breakpoint map - #3815

Merged
siegfriedpammer merged 3 commits into
masterfrom
pdbgen-sequence-point-tests
Jun 26, 2026
Merged

Give the PdbGen tests real coverage via the compiler's breakpoint map#3815
siegfriedpammer merged 3 commits into
masterfrom
pdbgen-sequence-point-tests

Conversation

@siegfriedpammer

@siegfriedpammer siegfriedpammer commented Jun 24, 2026

Copy link
Copy Markdown
Member

What

Gives the PdbGen test kind real coverage. Previously the tests compared ILSpy's reconstructed PDB to the C# compiler's PDB byte-for-byte, so any non-trivial method failed on IL ranges, hidden sequence points and local scopes the decompiler cannot reproduce exactly. Several fixtures were ignored or scaffolded with empty source bodies that passed vacuously.

How

  • Compare the breakpoint map instead of raw PDB XML - parse sequence-point blobs directly from the compiler PDB and ILSpy's generated PDB, keyed by method-definition row. The comparison checks the ordered source-location map for visible points and the placement of hidden points anchored to the visible point they follow, while staying independent of exact IL offsets, local scopes and embedded source.
  • Keep known gaps explicit - methods where the decompiler legitimately diverges (switch-expression arms kept hidden, lock/using/foreach disposal points, .cctor static-field initializers, folded loop back-branches, etc.) pin an auto-derived residual snapshot, using the same accept-the-diff workflow as the pretty tests. A separate oracle-free check rejects duplicate or overlapping sequence points.
  • Use real C# fixture files - PdbGen inputs are now normal .cs files rather than source embedded in XML CDATA, and empty/stub fixtures are filled with source that exercises the named constructs.
  • Expand coverage - adds cases for try/catch/finally, switch, async/await, yield, loops (including while/do-while), LINQ, pattern matching and related constructs.
  • Un-ignore the old skipped cases - ForLoopTests, LambdaCapturing and Members now run with pinned residuals where needed.

Test-only change; no decompiler or UI behavior is affected.

Assisted-by: CodeAlta:gpt-5.5:CodeAlta

The PdbGen tests compared the reconstructed PDB to the C# compiler's
byte-for-byte, so any non-trivial method failed on reconstructed IL
ranges, hidden sequence points and local scopes - none of which the
decompiler can reproduce exactly. That left four of seven fixtures
[Ignore]d and the suite with almost no coverage.

Compare only what a debugging user actually feels: the visible (non-hidden)
breakpoint map, parsed straight from the sequence-point blobs and keyed by
method-definition row (shared between the PDB and the PE it describes). IL
offsets, hidden points, local scopes and the embedded source are dropped.
The compiler's own PDB is the oracle, so the tests assert correct debugging
behavior rather than the decompiler's past output. Methods where the
decompiler legitimately diverges pin an auto-derived residual snapshot, the
same accept-the-diff workflow as the pretty tests; a separate oracle-free
check rejects duplicate or overlapping sequence points.

Un-ignores ForLoopTests, LambdaCapturing and Members (its source is
regenerated to match the decompiler's per-type output, collapsing ~50 lines
of indentation-induced coordinate noise to two genuine differences).

Assisted-by: Claude:claude-opus-4-8:Claude Code
@siegfriedpammer
siegfriedpammer force-pushed the pdbgen-sequence-point-tests branch 2 times, most recently from e6cde7a to 4b1db46 Compare June 25, 2026 21:51
Extends the breakpoint-map comparison to hidden sequence points, anchoring
each hidden point to the visible point it follows so the descriptor stays
independent of the IL offsets the decompiler reconstructs. Adds PdbGen cases
spanning try/catch/finally, switch, async/await, yield, loops, LINQ, pattern
matching and more, pinning the known residuals where the decompiler folds a
compiler-hidden branch into an adjacent point.

Assisted-by: Claude:claude-opus-4-8:Claude Code
@siegfriedpammer
siegfriedpammer force-pushed the pdbgen-sequence-point-tests branch from 4b1db46 to ed23d94 Compare June 25, 2026 22:23
The PDB sequence-point tests were missing real while-loop input, and their residual comparison treated breakpoint locations as an unordered multiset. Add coverage for while/do-while fixtures and compare residuals in sequence order so stepping-order changes are pinned.

Assisted-by: CodeAlta:gpt-5.5:CodeAlta
@siegfriedpammer
siegfriedpammer force-pushed the pdbgen-sequence-point-tests branch from ed23d94 to 4e36add Compare June 26, 2026 04:00
@siegfriedpammer
siegfriedpammer merged commit fe50c00 into master Jun 26, 2026
13 checks passed
@christophwille
christophwille deleted the pdbgen-sequence-point-tests branch June 26, 2026 05:27
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