Skip to content

Commit

Permalink
debuginfo: Improve GDB version handling in compiletest tool
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Aug 27, 2014
1 parent 849ae5d commit e72e4df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
16 changes: 11 additions & 5 deletions src/compiletest/compiletest.rs
Expand Up @@ -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
}
}
8 changes: 7 additions & 1 deletion src/compiletest/runtest.rs
Expand Up @@ -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
Expand All @@ -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
Expand Down

13 comments on commit e72e4df

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at michaelwoerister@e72e4df

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging michaelwoerister/rust/gdb-pretty = e72e4df into auto

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

michaelwoerister/rust/gdb-pretty = e72e4df merged ok, testing candidate = a2bf2c45

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at michaelwoerister@e72e4df

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging michaelwoerister/rust/gdb-pretty = e72e4df into auto

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

michaelwoerister/rust/gdb-pretty = e72e4df merged ok, testing candidate = bdf3a368

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at michaelwoerister@e72e4df

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging michaelwoerister/rust/gdb-pretty = e72e4df into auto

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

michaelwoerister/rust/gdb-pretty = e72e4df merged ok, testing candidate = c8e86e9

@bors
Copy link
Contributor

@bors bors commented on e72e4df Aug 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = c8e86e9

Please sign in to comment.