about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2014-08-27 15:18:16 +0200
committerMichael Woerister <michaelwoerister@posteo>2014-08-27 15:19:14 +0200
commite72e4dfc74ca65d6b3e0d821b94a34764ab2c63d (patch)
tree108b168a8b57c9bc3b1404394ba32f5f2cb94f07
parent849ae5d8815c54d135eb9d58cae77c2e6dcac55a (diff)
downloadrust-e72e4dfc74ca65d6b3e0d821b94a34764ab2c63d.tar.gz
rust-e72e4dfc74ca65d6b3e0d821b94a34764ab2c63d.zip
debuginfo: Improve GDB version handling in compiletest tool
-rw-r--r--src/compiletest/compiletest.rs16
-rw-r--r--src/compiletest/runtest.rs8
2 files changed, 18 insertions, 6 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 31b37070d2f..6c6cd6f610f 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -381,17 +381,23 @@ pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::Test
 
 fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
     match full_version_line {
-        Some(full_version_line) => {
+        Some(ref full_version_line)
+          if full_version_line.as_slice().trim().len() > 0 => {
             let full_version_line = full_version_line.as_slice().trim();
-            let re = Regex::new(r"[^0-9]([0-9]\.[0-9])([^0-9]|$)").unwrap();
+
+            let re = Regex::new(r"(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)").unwrap();
 
             match re.captures(full_version_line) {
                 Some(captures) => {
-                    Some(captures.at(1).to_string())
+                    Some(captures.at(2).to_string())
+                }
+                None => {
+                    println!("Could not extract GDB version from line '{}'",
+                             full_version_line);
+                    None
                 }
-                None => None
             }
         },
-        None => None
+        _ => None
     }
 }
\ No newline at end of file
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 6a1e1c6cc76..34f46a5f0d6 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -473,6 +473,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
 
             match config.gdb_version {
                 Some(ref version) => {
+                    println!("NOTE: compiletest thinks it is using GDB version {}",
+                             version.as_slice());
+
                     if header::gdb_version_to_int(version.as_slice()) >
                         header::gdb_version_to_int("7.4") {
                         // Add the directory containing the pretty printers to
@@ -488,7 +491,10 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
                                 .as_slice());
                     }
                 }
-                _ => { /* nothing to do */ }
+                _ => {
+                    println!("NOTE: compiletest does not know which version of \
+                              GDB it is using");
+                }
             }
 
             // Load the target executable