Skip to content

Fix DWARF line 0 handling and coz --version for cmake installs#269

Merged
emeryberger merged 2 commits intoplasma-umass:masterfrom
camelid:fix-dwarf-line-zero
Feb 23, 2026
Merged

Fix DWARF line 0 handling and coz --version for cmake installs#269
emeryberger merged 2 commits intoplasma-umass:masterfrom
camelid:fix-dwarf-line-zero

Conversation

@camelid
Copy link
Copy Markdown
Member

@camelid camelid commented Feb 23, 2026

Summary

  • Skip DWARF line 0 entries in line table walking: Line 0 entries in DWARF line tables represent compiler-generated code with no source mapping. Previously these could create spurious address ranges spanning from a line-0 entry to the next real source line, causing incorrect profiling results. Now line 0 entries reset the range tracking, similar to end-of-sequence markers.
  • Fix coz --version showing "unknown" for cmake installs: The version lookup now searches multiple candidate paths for pyproject.toml (source tree and cmake install prefix under share/coz/), and the cmake install step copies pyproject.toml into the data directory.

Test plan

  • Build from source and verify coz --version shows the correct version
  • Install via cmake (make install) and verify coz --version still works
  • Profile a DWARF 5 binary and confirm no spurious line-0 entries appear in results
  • Run existing benchmarks to verify no regression

🤖 Generated with Claude Code

camelid and others added 2 commits February 22, 2026 19:25
LLVM emits DWARF line 0 for code with no meaningful source
attribution (prologues, drop glue, optimization artifacts), unlike
GCC which attributes such code to the nearest real source line.

Rather than adopting GCC's approach of assigning line 0 code to an
adjacent line (which would inflate that line's apparent cost), we
discard these entries by treating them like end_sequence — resetting
prev_address so no address range is created. This loses ~2.6% of
samples in tested Rust profiles but avoids both the misleading `:0`
locations and experiment cycles wasted on unoptimizable code.

No impact on GCC-compiled code which doesn't emit line 0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When installed via cmake, pyproject.toml was not installed alongside
the coz script, so _read_version() could not find it. Install
pyproject.toml to the existing data directory (share/coz/) and check
that path as a fallback after the source-tree path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@emeryberger emeryberger merged commit 481f460 into plasma-umass:master Feb 23, 2026
1 of 2 checks passed
@camelid camelid deleted the fix-dwarf-line-zero branch February 23, 2026 21:45
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.

2 participants