Skip to content

Commit 22b4f9b

Browse files
fix(cargo-codspeed): fix incomplete callgraphs due to stripped debug symbols
1 parent 250ad31 commit 22b4f9b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/cargo-codspeed/src/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ impl BuildOptions<'_> {
115115
// Add debug info (equivalent to -g)
116116
rust_flags.push_str(" -C debuginfo=2");
117117

118+
// Prevent debug info stripping
119+
// https://doc.rust-lang.org/cargo/reference/profiles.html#release
120+
// According to cargo docs, for release profile which we default to:
121+
// `strip = "none"` and `debug = false`.
122+
// In practice, if we set debug info through RUSTFLAGS, cargo still strips them, most
123+
// likely because debug = false in the release profile.
124+
// We also need to disable stripping through rust flags.
125+
rust_flags.push_str(" -C strip=none");
126+
118127
// Add the codspeed cfg flag if instrumentation mode is enabled
119128
if measurement_mode == MeasurementMode::Instrumentation {
120129
rust_flags.push_str(" --cfg codspeed");

0 commit comments

Comments
 (0)