Skip to content

Preserve DWARF line-zero rows - #9192

Open
cpunion wants to merge 2 commits into
WebAssembly:mainfrom
cpunion:codex/dwarf-line-zero-9164
Open

cpunion wants to merge 2 commits into
WebAssembly:mainfrom
cpunion:codex/dwarf-line-zero-9164

Conversation

@cpunion

@cpunion cpunion commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9164.

Problem and fix

Line 0 means “no corresponding source line,” not “dead address.” Dropping that row incorrectly extends the preceding source line over those instructions.

- return line != 0 && addr != 0;
+ return addr != 0;

Address-zero and tombstone-sequence filtering remain unchanged. The production change is one condition and its comment; regenerated snapshots are in a separate commit.

Before / after

Check Before (main f3ab996) After
Original #9164 repro: call at 0x0b Incorrect line 5 Original line 0
TinyGo: roundtrip line-table coverage 94.14% 99.97%
TinyGo: O1 line-table coverage 94.02% 99.96%
TinyGo: Asyncify + O1 line-table coverage 82.18% 99.72%

Coverage here means code bytes covered by any line-table row, including line 0, within functions having DWARF—not source-test coverage. Both versions processed the same TinyGo goroutine/JSON input. Stripped Asyncify outputs are byte-identical.

Validation and scope

  • Regression fails before the fix and passes after it. Covers positive/zero line transitions, all-zero sequences, end-sequence rows, address remapping, roundtripping, and dead-address sentinels.
  • 92 Python tests (including 9 DWARF tests), the wasm-opt suite, LLVM DWARF verification, and runtime checks pass. C++: 437 passed, one existing platform skip. V8 execution checks were not run locally.

This only preserves existing rows. Encoding changes are in #9196; instruction-origin handling is in #9194. It does not generate helper DWARF or fully resolve tinygo-org/tinygo#5736.

Original contribution, developed with AI assistance.

This branch has not been deployed

No deployments
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.

DWARF line table rows with line 0 are dropped, so code gets attributed to the wrong line compiler: WASM DWARF misses ~40% of code bytes with opts=1

1 participant