Repository navigation
debugger: stabilize trim-paths unremap file loading #163910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
weihanglo
wants to merge
1
commit into
rust-lang:main
Choose a base branch
from
weihanglo:trim-paths-stabilization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In reply to @Mark-Simulacrum's #163910 (comment):
We looked at remap part, but not too much in the unremap part. Some goals here are binary reproducibility and local developer experience so embedding any absolute paths is not a "base" solution here. Could be extensions of course.
The other thing to compare is go's
-trimpathflag. Go is a bit different as every module has a clear identity even for local ones, though go doesn't have "unremap" concept, and mostly relies on their debugger to guess and requires kinda the exact checkout layout for finding sources.As for JavaScript sourcemaps URL, if they don't contain absolute maps across builds and is reproducible enough we could definitely extend them in the unremap files, or embed them in the object I think.
Cargo only put trim-paths aside final binaries, like dSYM or PDB files. This doesn't seem to be an issue.
Not sure if we need to, but users can set their own substitution rules if needed. Doesn't need to tie to the unremap files.
Not yet I believe, see this and this. And there is one real gap of the current remap rules: the local workspace source is mapped to path relative to workspace root (
DW_AT_comp_dir = "."). The reason of this decision is a tradeoff of local debug experience. With relative paths users can use debugger without any substitution rules for their local packages.Small enough (for cargo itself is 462 bytes). JSON is parsed once per object file or module load.
As aforementioned the current remap rules may not be useful for debuginfod. Need some pre/post-process. And anyway debuginfod is not supported at this moment in rustc and related tools. However, a future extension is that Cargo allows extending and customizing the remap rules, which we kinda have one for bootstrap for remapping to
/rustc/<sha>.True, debugger scripts load them, though the v1 schema is stabilized but exact remap prefixes is subject to change, and adding fields later doesn't break the compatibility per Cargo JSON policy (that one is more for
cargo metadatabut it is in general our attitude towards JSON outputs). And yes Cargo did an FCP. See the doc and the links in the updated PR description.View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think that answers my questions enough that I'm comfortable checking a box (done). It seems plausible that we'll want/need a v2 format (or extra fields in v1) for some of the goals based on it, if I'm understanding right, but that doesn't seem like a blocker for this stabilization.