Skip to content

Commit aee42a6

Browse files
committed
Add unsplit-debuginfo scope
1 parent 0688580 commit aee42a6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

text/3127-trim-paths.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ This flag accepts a comma-separated list of values and may be specified multiple
9494

9595
- `macro` - apply remappings to the expansion of `std::file!()` macro. This is where paths in embedded panic messages come from
9696
- `debuginfo` - apply remappings to debug information, wherever they may be written to
97-
- `split-debuginfo-file` - when `split-debuginfo=packed` or `unpacked`, apply remappings to the paths pointing to these split debug information files
97+
- `unsplit-debuginfo` - apply to remappings to debug information only when they are written to compiled executables or libraries, but not when they are in split files
98+
- `split-debuginfo-file` - apply remappings to the paths pointing to split debug information files when `split-debuginfo=packed` or `unpacked`. Does nothing when debuginfo is embedded with the compiled executables or libraries
9899
- `diagnostics` - apply remappings to printed compiler diagnostics
99100

100101
## Cargo
@@ -145,12 +146,9 @@ If `trim-paths` is `1` or `2` (`true`), then two `--remap-path-prefix` arguments
145146

146147
A further `--remap-path-scope` is also supplied for options `1` and `2`:
147148

148-
If `trim-paths` is `1`, then it depends on the setting of `split-debuginfo` (whether the setting is explicitly supplied or from the default)
149-
- If `split-debuginfo` is `off`, then `--remap-path-scope=macro,debuginfo`.
150-
- If `split-debuginfo` is `packed` or `unpacked`, then `--remap-path-scope=macro,split-debuginfo-file`
149+
If `trim-path` is `1`, then `--remap-path-scope=macro,unsplit-debuginfo,split-debuginfo-file`.
151150

152-
This is because we always want to remap panic messages as they will always be embedded in executable/library. We need to sanitise debug information
153-
if they are embedded, but don't need to touch them if they are split. However in case they are split we need to sanitise the paths to these split files
151+
As a result, panic messages (which are always embedded) are sanitised. If debug information is embedded, then they are sanitised; if they are split then they are kept untouched, but the paths to these split files are sanitised.
154152

155153
If `trim-path` is `2` (`true`), all paths will be affected, equivalent to `--remap-path-scope=macro,debuginfo,diagnostics,split-debuginfo-file`
156154

@@ -167,7 +165,7 @@ supplied *after* Cargo's own remapping.
167165

168166
## Changing handling of sysroot path in `rustc`
169167

170-
The virtualisation of sysroot files to `/rustc/[commit hash]/library/...` was done at compiler bootstraping, specifically when
168+
The virtualisation of sysroot files to `/rustc/[commit hash]/library/...` was done at compiler bootstrapping, specifically when
171169
`remap-debuginfo = true` in `config.toml`. This is done for Rust distribution on all channels.
172170

173171
At `rustc` runtime (i.e. compiling some code), we try to correlate this virtual path to a real path pointing to the file on the local file system.
@@ -205,7 +203,7 @@ release builds. It has, over the past 4 years, gained a decent amount of popular
205203
implement.
206204

207205
Path to sysroot crates are specially handled by `rustc`. Due to this, the behaviour we currently have is that all such paths are virtualised.
208-
Although good for privacy and reproducibility, some people find it a hinderance for debugging: https://github.com/rust-lang/rust/issues/85463.
206+
Although good for privacy and reproducibility, some people find it a hindrance for debugging: https://github.com/rust-lang/rust/issues/85463.
209207
Hence the user should be given control on if they want the virtual or local path.
210208

211209
An alternative is to extend the syntax accepted by `--remap-path-prefix` or add a new option called `--remap-path-prefix-scoped` which allows

0 commit comments

Comments
 (0)