Consider this basic example:
fn main() {
std::thread::sleep(std::time::Duration::from_secs_f64(1.0));
}
When compiled with cargo build and the following Cargo.toml:
[profile.dev]
debug = false
strip = "symbols"
we see the following profile with samply record:

That is, all symbols are still there. However, when we instead build with
[profile.dev]
debug = false
strip = "debuginfo"
we see the following profile:
I believe this is a bug, as the documentation for strip specifies that symbols is supposed to be a more aggressive stripping than debuginfo, which is supposed to leave backtrace information mostly intact. We see the opposite behavior.
The following lines of code are suspect:
|
if sess.target.is_like_osx { |
|
let stripcmd = "rust-objcopy"; |
|
match (strip, crate_type) { |
|
(Strip::Debuginfo, _) => { |
|
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-S"]) |
|
} |
|
// Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988) |
|
(Strip::Symbols, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro) => { |
|
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-x"]) |
|
} |
|
(Strip::Symbols, _) => { |
|
strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[]) |
|
} |
|
(Strip::None, _) => {} |
|
} |
|
} |
-S on rust-objcopy is documented as such:
It does not seem appropriate to be used in the Debuginfo branch, but omitted in the Symbols branch.
Consider this basic example:
When compiled with
cargo buildand the followingCargo.toml:we see the following profile with
samply record:That is, all symbols are still there. However, when we instead build with
we see the following profile:
I believe this is a bug, as the documentation for
stripspecifies thatsymbolsis supposed to be a more aggressive stripping thandebuginfo, which is supposed to leave backtrace information mostly intact. We see the opposite behavior.The following lines of code are suspect:
rust/compiler/rustc_codegen_ssa/src/back/link.rs
Lines 1103 to 1118 in bf6f8a4
-Sonrust-objcopyis documented as such:It does not seem appropriate to be used in the
Debuginfobranch, but omitted in theSymbolsbranch.