]> git.lizzy.rs Git - rust.git/commitdiff
debuginfo: Improve GDB version handling in compiletest tool
authorMichael Woerister <michaelwoerister@posteo>
Wed, 27 Aug 2014 13:18:16 +0000 (15:18 +0200)
committerMichael Woerister <michaelwoerister@posteo>
Wed, 27 Aug 2014 13:19:14 +0000 (15:19 +0200)
src/compiletest/compiletest.rs
src/compiletest/runtest.rs

index 31b37070d2f139f7f04ceb69bc76c9c25719e09b..6c6cd6f610f5be970f07e4f7faa8c58c6df52b5f 100644 (file)
@@ -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
index 6a1e1c6cc76bc07c3202550182a4167dfaf8790a..34f46a5f0d638b94241149418f587c4f6a7c502e 100644 (file)
@@ -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