about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorTim Neumann <mail@timnn.me>2016-10-29 20:11:53 +0200
committerTim Neumann <mail@timnn.me>2016-10-31 21:12:59 +0100
commitdce460028e9c21ebadb28f6744d4b10bf0e8d501 (patch)
tree6fa7314f67b10d5aa74d4666a448c92b04f08e1e /src/bootstrap
parent6554fb0d8d5d794db7a7532a5edd16eb28777a48 (diff)
detect gdb version & rust support in compiletest
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/check.rs4
-rw-r--r--src/bootstrap/config.rs6
-rw-r--r--src/bootstrap/config.toml.example3
-rw-r--r--src/bootstrap/lib.rs2
-rw-r--r--src/bootstrap/sanity.rs7
5 files changed, 17 insertions, 5 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index af76a49fed0..50a2337b307 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -168,8 +168,8 @@ pub fn compiletest(build: &Build,
         cmd.arg("--lldb-python").arg(python_default);
     }
 
-    if let Some(ref vers) = build.gdb_version {
-        cmd.arg("--gdb-version").arg(vers);
+    if let Some(ref gdb) = build.config.gdb {
+        cmd.arg("--gdb").arg(gdb);
     }
     if let Some(ref vers) = build.lldb_version {
         cmd.arg("--lldb-version").arg(vers);
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 8c0ad1ccf82..0948a7c130e 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -85,6 +85,7 @@ pub struct Config {
     pub mandir: Option<String>,
     pub codegen_tests: bool,
     pub nodejs: Option<PathBuf>,
+    pub gdb: Option<PathBuf>,
 }
 
 /// Per-target configuration stored in the global configuration structure.
@@ -122,6 +123,7 @@ struct Build {
     compiler_docs: Option<bool>,
     docs: Option<bool>,
     submodules: Option<bool>,
+    gdb: Option<String>,
 }
 
 /// TOML representation of how the LLVM build is configured.
@@ -226,6 +228,7 @@ impl Config {
         }
         config.rustc = build.rustc.map(PathBuf::from);
         config.cargo = build.cargo.map(PathBuf::from);
+        config.gdb = build.gdb.map(PathBuf::from);
         set(&mut config.compiler_docs, build.compiler_docs);
         set(&mut config.docs, build.docs);
         set(&mut config.submodules, build.submodules);
@@ -392,6 +395,9 @@ impl Config {
                 "CFG_DEFAULT_LINKER" if value.len() > 0 => {
                     self.rustc_default_linker = Some(value.to_string());
                 }
+                "CFG_GDB" if value.len() > 0 => {
+                    self.gdb = Some(PathBuf::from(value));
+                }
                 "CFG_RELEASE_CHANNEL" => {
                     self.channel = value.to_string();
                 }
diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example
index b4730c003d6..1289cdba595 100644
--- a/src/bootstrap/config.toml.example
+++ b/src/bootstrap/config.toml.example
@@ -79,6 +79,9 @@
 # Indicate whether submodules are managed and updated automatically.
 #submodules = true
 
+# The path to (or name of) the GDB executable to use
+#gdb = "gdb"
+
 # =============================================================================
 # Options for compiling Rust code itself
 # =============================================================================
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 7c5a0c7373f..e99e088bffe 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -123,7 +123,6 @@ pub struct Build {
     bootstrap_key_stage0: String,
 
     // Probed tools at runtime
-    gdb_version: Option<String>,
     lldb_version: Option<String>,
     lldb_python_dir: Option<String>,
 
@@ -196,7 +195,6 @@ impl Build {
             package_vers: String::new(),
             cc: HashMap::new(),
             cxx: HashMap::new(),
-            gdb_version: None,
             lldb_version: None,
             lldb_python_dir: None,
         }
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index 969cd70fd57..cc1b7136d47 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -92,6 +92,12 @@ pub fn check(build: &mut Build) {
         need_cmd(s.as_ref());
     }
 
+    if let Some(ref gdb) = build.config.gdb {
+        need_cmd(gdb.as_ref());
+    } else {
+        build.config.gdb = have_cmd("gdb".as_ref());
+    }
+
     // We're gonna build some custom C code here and there, host triples
     // also build some C++ shims for LLVM so we need a C++ compiler.
     for target in build.config.target.iter() {
@@ -198,7 +204,6 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
                    .to_string()
         })
     };
-    build.gdb_version = run(Command::new("gdb").arg("--version")).ok();
     build.lldb_version = run(Command::new("lldb").arg("--version")).ok();
     if build.lldb_version.is_some() {
         build.lldb_python_dir = run(Command::new("lldb").arg("-P")).ok();