diff --git a/configure b/configure index d0c85c0a008..ceb67869efe 100755 --- a/configure +++ b/configure @@ -636,6 +636,7 @@ opt_nosave optimize-llvm 1 "build optimized LLVM" opt_nosave llvm-assertions 0 "build LLVM with assertions" opt_nosave debug-assertions 0 "build with debugging assertions" opt_nosave debuginfo 0 "build with debugger metadata" +opt_nosave debuginfo-lines 0 "build with line number debugger metadata" opt_nosave debug-jemalloc 0 "build jemalloc with --enable-debug --enable-fill" valopt localstatedir "/var/lib" "local state directory" @@ -721,8 +722,13 @@ case "$CFG_RELEASE_CHANNEL" in nightly ) msg "overriding settings for $CFG_RELEASE_CHANNEL" CFG_ENABLE_LLVM_ASSERTIONS=1 + CFG_ENABLE_DEBUGINFO_LINES=1 ;; - dev | beta | stable) + beta | stable) + msg "overriding settings for $CFG_RELEASE_CHANNEL" + CFG_ENABLE_DEBUGINFO_LINES=1 + ;; + dev) ;; *) err "release channel must be 'dev', 'nightly', 'beta' or 'stable'" @@ -752,6 +758,7 @@ if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then putvar CFG_DISABLE_OPTIMIZE_LLVM; f if [ -n "$CFG_ENABLE_LLVM_ASSERTIONS" ]; then putvar CFG_ENABLE_LLVM_ASSERTIONS; fi if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTIONS; fi if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi +if [ -n "$CFG_ENABLE_DEBUGINFO_LINES" ]; then putvar CFG_ENABLE_DEBUGINFO_LINES; fi if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi step_msg "looking for build programs" diff --git a/mk/main.mk b/mk/main.mk index d4efee90361..8ffb5585769 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -141,6 +141,9 @@ endif ifdef CFG_ENABLE_DEBUGINFO $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO)) CFG_RUSTC_FLAGS += -g +else ifdef CFG_ENABLE_DEBUGINFO_LINES + $(info cfg: enabling line number debuginfo (CFG_ENABLE_DEBUGINFO_LINES)) + CFG_RUSTC_FLAGS += -C debuginfo=1 endif ifdef SAVE_TEMPS diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index cdbbc229bc8..d6f2fd28417 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -112,6 +112,8 @@ fn main() { // code. if env::var("RUSTC_DEBUGINFO") == Ok("true".to_string()) { cmd.arg("-g"); + } else if env::var("RUSTC_DEBUGINFO_LINES") == Ok("true".to_string()) { + cmd.arg("-Cdebuginfo=1"); } let debug_assertions = match env::var("RUSTC_DEBUG_ASSERTIONS") { Ok(s) => if s == "true" {"y"} else {"n"}, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index e4577bfcdfc..8c0ad1ccf82 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -56,6 +56,7 @@ pub struct Config { pub rust_codegen_units: u32, pub rust_debug_assertions: bool, pub rust_debuginfo: bool, + pub rust_debuginfo_lines: bool, pub rust_rpath: bool, pub rustc_default_linker: Option, pub rustc_default_ar: Option, @@ -141,6 +142,7 @@ struct Rust { codegen_units: Option, debug_assertions: Option, debuginfo: Option, + debuginfo_lines: Option, debug_jemalloc: Option, use_jemalloc: Option, backtrace: Option, @@ -239,6 +241,7 @@ impl Config { if let Some(ref rust) = toml.rust { set(&mut config.rust_debug_assertions, rust.debug_assertions); set(&mut config.rust_debuginfo, rust.debuginfo); + set(&mut config.rust_debuginfo_lines, rust.debuginfo_lines); set(&mut config.rust_optimize, rust.optimize); set(&mut config.rust_optimize_tests, rust.optimize_tests); set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests); @@ -329,6 +332,7 @@ impl Config { ("OPTIMIZE", self.rust_optimize), ("DEBUG_ASSERTIONS", self.rust_debug_assertions), ("DEBUGINFO", self.rust_debuginfo), + ("DEBUGINFO_LINES", self.rust_debuginfo_lines), ("JEMALLOC", self.use_jemalloc), ("DEBUG_JEMALLOC", self.debug_jemalloc), ("RPATH", self.rust_rpath), diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example index 39c976edc13..b4730c003d6 100644 --- a/src/bootstrap/config.toml.example +++ b/src/bootstrap/config.toml.example @@ -99,6 +99,9 @@ # Whether or not debuginfo is emitted #debuginfo = false +# Whether or not line number debug information is emitted +#debuginfo-lines = false + # Whether or not jemalloc is built and enabled #use-jemalloc = true diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index a63c23b4621..5acc00fe685 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -649,6 +649,7 @@ impl Build { .env("RUSTC_REAL", self.compiler_path(compiler)) .env("RUSTC_STAGE", stage.to_string()) .env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()) + .env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string()) .env("RUSTC_CODEGEN_UNITS", self.config.rust_codegen_units.to_string()) .env("RUSTC_DEBUG_ASSERTIONS",