Skip to content

debugger: stabilize trim-paths unremap file loading - #163910

Open
weihanglo wants to merge 1 commit into
rust-lang:mainfrom
weihanglo:trim-paths-stabilization
Open

weihanglo wants to merge 1 commit into
rust-lang:mainfrom
weihanglo:trim-paths-stabilization

Conversation

@weihanglo

@weihanglo weihanglo commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Stabilization report

What is stabilized

With trim-paths object scope and debuginfo on, Cargo writes <artifact>.trim-paths.json1 beside each final artifact. This "unremap" file, maps the remapped paths back to local ones.

This stabilizes debugger script changes: rust-gdb and rust-lldb by default load {gdb,lldb}_trim_paths.py, which read the unremap files and apply them through GDB substitute-path or LLDB target.source-map to set up source file path substitutions.

Note that we already apply an unremap for /rustc/$RUSTC_COMMIT_HASH paths, so it wouldn't be a new capability per se, just an extension of it.

What changes

  • After stabilization, set RUST_{GDB,LLDB}_TRIM_PATHS=0 to opt out.
    Before, it required RUST_{GDB,LLDB}_TRIM_PATHS=unstable to enable.
  • After stabilization, both scripts are shipped on all channels.
    Before, they were shipped only on nightly.

Why we don't want to stabilize

  • This makes debugger scripts relying on Cargo-specific file format, inversing the dependency relation.
  • There is no integration test for them.
    (and debugger scripts actually don't have many tests)

Docs

See Cargo's the "Unremap files" section:
https://github.com/rust-lang/cargo/blob/ac74ae3c603b9efce95b07383b46d3103e834d9a/doc/book/src/reference/profiles.md?plain=1#L337-L386


Should be shipped after #163881 (or along with that)

Footnotes

  1. Example of the format at: https://github.com/rust-lang/cargo/blob/ac74ae3c603b9efce95b07383b46d3103e834d9a/doc/book/src/reference/profiles.md?plain=1#L367-L381 ↩

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Oct 6, 2026
## Stabilization report

### What is stabilized

With trim-paths `object` scope and debuginfo on,
Cargo writes `<artifact>.trim-paths.json` beside each final artifact.
The "unremap" file maps the remapped paths back to local ones.

This stabilizes debugger script changes:
`rust-gdb` and `rust-lldb` by default load `{gdb,lldb}_trim_paths.py`,
which read the unremap files and apply them
through GDB `substitute-path` or LLDB `target.source-map`
to set up source file path substitutions.

### What changes

* After stabilization, set `RUST_{GDB,LLDB}_TRIM_PATHS=0` to opt out.
  Before, this needed `RUST_{GDB,LLDB}_TRIM_PATHS=unstable`.
* After stabilization, both scripts are shipped on all channels.
  Before, they were shipped only on nightly.

### Why we don't want to stabilize

* This makes debugger scripts relying on Cargo-specific file format,
  inversing the dependency relation.
* There is no integration test for them.
  (and debugger scripts actually don't have many tests)

### Docs

See Cargo's the "Unremap files" section:
<https://github.com/rust-lang/cargo/blob/ac74ae3c603b9efce95b07383b46d3103e834d9a/doc/book/src/reference/profiles.md?plain=1#L337-L386>
@weihanglo
weihanglo force-pushed the trim-paths-stabilization branch from 31629c6 to 68cc859 Compare October 7, 2026 20:18
@weihanglo weihanglo changed the title debugger: load trim-paths unremap files by default debugger: stabilize trim-paths unremap file loading Oct 7, 2026
@Urgau

Urgau commented Oct 7, 2026

Copy link
Copy Markdown
Member

Cargo stabilized profile.trim-paths and the unremap file at rust-lang/cargo#17488.

@rfcbot merge compiler

@rust-rfcbot rust-rfcbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 7, 2026
@rust-rfcbot

rust-rfcbot commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

@Urgau has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 7, 2026
@jieyouxu

jieyouxu commented Oct 8, 2026

Copy link
Copy Markdown
Member

cc @Walnut356 (since you may be interested as well)

@nnethercote

Copy link
Copy Markdown
Contributor

Why we don't want to stabilize

  • This makes debugger scripts relying on Cargo-specific file format, inversing the dependency relation.

Can someone explain more about this dependency relation?

@weihanglo

Copy link
Copy Markdown
Member Author

The change creates a compatibility guarantee for toolchain's debugger support for a format defined by Cargo. rust-gdb and rust-lldb after this look for the <artifact>.trim-paths.json file and load their mappings by dfeault, unless expliclitly disabled.

"Inverting the dependency relation" may be a too strong word, though. Just now debugger and build tool is coupled to some extent, though for the majority it has net benefit.

@Urgau Urgau added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 19, 2026
@wesleywiser

Copy link
Copy Markdown
Member

It looks like if the file doesn't exist or is not in the format we expect, we'll print a warning message but the debugging experience (loading of visualizers, etc) is otherwise not degraded by the failure. Is that correct?

@weihanglo

Copy link
Copy Markdown
Member Author

It looks like if the file doesn't exist

This is a silent skip, as trim-paths is off by default for now in Cargo. Changing the default is tracked in rust-lang/cargo#17586.

or is not in the format we expect, we'll print a warning message but the debugging experience (loading of visualizers, etc) is otherwise not degraded by the failure. Is that correct?

Yes. Correct.

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

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants