Skip to content

build: root XLOG categories and debug paths past ccache - #648

Open
michalhosna wants to merge 1 commit into
mainfrom
mh/xlog-prefix-map
Open

build: root XLOG categories and debug paths past ccache#648
michalhosna wants to merge 1 commit into
mainfrom
mh/xlog-prefix-map

Conversation

@michalhosna

@michalhosna michalhosna commented Aug 27, 2026

Copy link
Copy Markdown
Member

Sharing one ccache across work trees was quietly breaking correctness.

  • The same TU logged under moqx.ServiceMatcher in a non-ccache build and under a src-rooted category in a ccache build. Filtering logs by category could not be relied on.
  • A cached object carried the debug paths of whichever worktree compiled it first. Debugging a binary in one worktree could open a different worktree's source.

Cause: ccache with base_dir rewrites the source path it forwards to the compiler but leaves -f*-prefix-map untouched, so the map stopped matching. The block comment carries the detail.

Fixes: An object now embeds no worktree path. The shared cache becomes sound


This change is Reviewable

@gmarzot

gmarzot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Should the build dir get a relative map too, or do generated headers not go through base_dir?

@michalhosna

Copy link
Copy Markdown
Member Author

They do go through base_dir.

ccache makes paths relative to the build dir, so

  • a generated header comes out as generated/Foo.h, no prefix left.
  • src/ sits outside the build dir, so it comes out as ../../src/Foo.cpp and still has a prefix to map.

The same TU logged under moqx.ServiceMatcher without ccache and under a
src-rooted category with it. The block comment carries the cause.

- macro- and debug- maps stay separate: categories want an opaque root,
  debug info wants paths a debugger started at the worktree root opens.
- Objects carry no worktree path either way, so a cache shared between
  worktrees stops handing back another worktree's DW_AT_comp_dir.
- STRIP_PREFIXES takes the build root alone now that the src map supplies
  the category root it used to strip.
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