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

bootstrap: Include line numbers in debuginfo by default for library/compiler profile #104968

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
@@ -1650,6 +1650,8 @@ impl<'a> Builder<'a> {
}
};
cargo.env(profile_var("DEBUG"), debuginfo_level.to_string());
// Regardless of the config setting, don't build debuginfo for build scripts.
cargo.env(profile_var("BUILD_OVERRIDE_DEBUG"), "0");
if !self.config.dry_run() && self.cc.borrow()[&target].args().iter().any(|arg| arg == "-gz")
{
rustflags.arg("-Clink-arg=-gz");
30 changes: 17 additions & 13 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
@@ -69,21 +69,25 @@ impl<'de> Deserialize<'de> for DebuginfoLevel {
use serde::de::Error;

Ok(match Deserialize::deserialize(deserializer)? {
StringOrInt::String("none") | StringOrInt::Int(0) => DebuginfoLevel::None,
StringOrInt::String("line-tables-only") => DebuginfoLevel::LineTablesOnly,
StringOrInt::String("limited") | StringOrInt::Int(1) => DebuginfoLevel::Limited,
StringOrInt::String("full") | StringOrInt::Int(2) => DebuginfoLevel::Full,
StringOrInt::Int(0) => DebuginfoLevel::None,
StringOrInt::Int(1) => DebuginfoLevel::Limited,
StringOrInt::Int(2) => DebuginfoLevel::Full,
StringOrInt::Int(n) => {
let other = serde::de::Unexpected::Signed(n);
return Err(D::Error::invalid_value(other, &"expected 0, 1, or 2"));
}
StringOrInt::String(s) => {
let other = serde::de::Unexpected::Str(s);
return Err(D::Error::invalid_value(
other,
&"expected none, line-tables-only, limited, or full",
));
}
StringOrInt::String(s) => match s.as_str() {
"none" => DebuginfoLevel::None,
"line-tables-only" => DebuginfoLevel::LineTablesOnly,
"limited" => DebuginfoLevel::Limited,
"full" => DebuginfoLevel::Full,
_ => {
return Err(D::Error::invalid_value(
serde::de::Unexpected::Str(&s),
&"expected none, line-tables-only, limited, or full",
));
}
},
})
}
}
@@ -877,8 +881,8 @@ impl Default for StringOrBool {

#[derive(Deserialize)]
#[serde(untagged)]
enum StringOrInt<'a> {
String(&'a str),
enum StringOrInt {
String(String),
Int(i64),
}

2 changes: 2 additions & 0 deletions src/bootstrap/defaults/config.codegen.toml
Original file line number Diff line number Diff line change
@@ -23,3 +23,5 @@ incremental = true
backtrace-on-ice = true
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
lto = "off"
# Include line numbers in backtraces.
debuginfo-level-rustc = "line-tables-only"
2 changes: 2 additions & 0 deletions src/bootstrap/defaults/config.compiler.toml
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ incremental = true
backtrace-on-ice = true
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
lto = "off"
# Include line numbers in backtraces.
debuginfo-level-rustc = "line-tables-only"

[llvm]
# Will download LLVM from CI if available on your platform.
2 changes: 2 additions & 0 deletions src/bootstrap/defaults/config.library.toml
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@ bench-stage = 0
incremental = true
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
lto = "off"
# Include line numbers in backtraces.
debuginfo-level-std = "line-tables-only"

[llvm]
# Will download LLVM from CI if available on your platform.
2 changes: 2 additions & 0 deletions src/bootstrap/defaults/config.tools.toml
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ incremental = true
# Using these defaults will download the stage2 compiler (see `download-rustc`
# setting) and the stage2 toolchain should therefore be used for these defaults.
download-rustc = "if-unchanged"
# Include line numbers in backtraces.
debuginfo-level-tools = "line-tables-only"

[build]
# Document with the in-tree rustdoc by default, since `download-rustc` makes it quick to compile.