Skip to content
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

--remap-path-prefix: Fix duplicated path components in debuginfo #96867

Merged
merged 4 commits into from
May 18, 2022

Conversation

michaelwoerister
Copy link
Member

This PR fixes an issue with --remap-path-prefix where path components could appear twice in the remapped version of the path (e.g. #78479). The underlying problem was that --remap-path-prefix is often used to map an absolute path to something that looks like a relative path, e.g.:

--remap-path-prefix=/home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823=crates.io",

and relative paths in debuginfo are interpreted as being relative to the compilation directory. So if Cargo invokes the compiler with /home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823/some_crate-0.1.0/src/lib.rs as input and /home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823/some_crate-0.1.0 as the compiler's working directory, then debuginfo will state that the working directory was crates.io/some_crate-0.1.0 and the file is question was crates.io/some_crate-0.1.0/src/lib.rs, which combined gives the path:

crates.io/some_crate-0.1.0/crates.io/some_crate-0.1.0/src/lib.rs

With this PR the compiler will detect this situation and set up debuginfo in LLVM in a way that makes it strip the duplicated path components when emitting DWARF.

The PR also extracts the logic for making remapped paths absolute into a common helper function that is now used by debuginfo too (instead of just during crate metadata generation).

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 9, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 9, 2022
@michaelwoerister
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 9, 2022
@bors
Copy link
Contributor

bors commented May 9, 2022

⌛ Trying commit 0e4a86f545d8550091c07a262e64967fa3de70af with merge ba1281089ae9e873f5ff73dd7d8eac4a8f460404...

@bors
Copy link
Contributor

bors commented May 9, 2022

☀️ Try build successful - checks-actions
Build commit: ba1281089ae9e873f5ff73dd7d8eac4a8f460404 (ba1281089ae9e873f5ff73dd7d8eac4a8f460404)

@rust-timer
Copy link
Collaborator

Queued ba1281089ae9e873f5ff73dd7d8eac4a8f460404 with parent e013f9e, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ba1281089ae9e873f5ff73dd7d8eac4a8f460404): comparison url.

Summary:

  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: no relevant changes found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 0 0 1 0 1
mean2 N/A N/A -0.5% N/A -0.5%
max N/A N/A -0.5% N/A -0.5%

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 9, 2022
@michaelwoerister
Copy link
Member Author

Perf looks good.

@nagisa
Copy link
Member

nagisa commented May 10, 2022

r? rust-lang/compiler

I won't be able to get to reviewing things for the upcoming next couple weeks.

@compiler-errors
Copy link
Member

not exactly my wheelhouse, so reassigning

r? rust-lang/compiler

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented May 18, 2022

📌 Commit 0e4a86f545d8550091c07a262e64967fa3de70af has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 18, 2022
@bors
Copy link
Contributor

bors commented May 18, 2022

⌛ Testing commit 0e4a86f545d8550091c07a262e64967fa3de70af with merge 5e5d0801988be7475a5df68a44b1ecde2bac7673...

@bors
Copy link
Contributor

bors commented May 18, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 18, 2022
@rust-log-analyzer

This comment has been minimized.

@michaelwoerister
Copy link
Member Author

It looks like -Z simulate-remapped-rust-src-base does not have an effect if remap-debuginfo = true in config.toml, so the test that failed produces a different output on CI (/rustc/<sha>/foo.rs vs /rustc/<value from simulate-remapped-rust-src-base>/foo.rs). I reverted my changes to that test so that it accepts both versions again.

@michaelwoerister
Copy link
Member Author

@bors r=davidtwco (assuming that test fix does not need a separate review)

@bors
Copy link
Contributor

bors commented May 18, 2022

📌 Commit 6411fef has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 18, 2022
@bors
Copy link
Contributor

bors commented May 18, 2022

⌛ Testing commit 6411fef with merge 936eba3...

@bors
Copy link
Contributor

bors commented May 18, 2022

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing 936eba3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 18, 2022
@bors bors merged commit 936eba3 into rust-lang:master May 18, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 18, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (936eba3): comparison url.

Summary:

  • Primary benchmarks: 🎉 relevant improvements found
  • Secondary benchmarks: 🎉 relevant improvements found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 0 0 2 6 2
mean2 N/A N/A -0.4% -4.1% -0.4%
max N/A N/A -0.4% -4.7% -0.4%

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

None yet

9 participants