add gdb_native_rust config to compiletest

This commit is contained in:
Tim Neumann 2016-10-29 14:29:18 +02:00
parent 9253e1206e
commit 6554fb0d8d
3 changed files with 35 additions and 15 deletions

View File

@ -149,6 +149,9 @@ pub struct Config {
// Version of GDB
pub gdb_version: Option<String>,
// Whether GDB has native rust support
pub gdb_native_rust: bool,
// Version of LLDB
pub lldb_version: Option<String>,

View File

@ -172,6 +172,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
target: opt_str2(matches.opt_str("target")),
host: opt_str2(matches.opt_str("host")),
gdb_version: extract_gdb_version(matches.opt_str("gdb-version")),
gdb_native_rust: false,
lldb_version: extract_lldb_version(matches.opt_str("lldb-version")),
llvm_version: matches.opt_str("llvm-version"),
android_cross_path: opt_path(matches, "android-cross-path"),

View File

@ -430,11 +430,23 @@ actual:\n\
}
fn run_debuginfo_gdb_test_no_opt(&self) {
let prefixes = if self.config.gdb_native_rust {
// GDB with Rust
static PREFIXES: &'static [&'static str] = &["gdb", "gdbr"];
println!("NOTE: compiletest thinks it is using GDB with native rust support");
PREFIXES
} else {
// Generic GDB
static PREFIXES: &'static [&'static str] = &["gdb", "gdbg"];
println!("NOTE: compiletest thinks it is using GDB without native rust support");
PREFIXES
};
let DebuggerCommands {
commands,
check_lines,
breakpoint_lines
} = self.parse_debugger_commands("gdb");
} = self.parse_debugger_commands(prefixes);
let mut cmds = commands.join("\n");
// compile test file (it should have 'compile-flags:-g' in the header)
@ -731,7 +743,7 @@ actual:\n\
check_lines,
breakpoint_lines,
..
} = self.parse_debugger_commands("lldb");
} = self.parse_debugger_commands(&["lldb"]);
// Write debugger script:
// We don't want to hang when calling `quit` while the process is still running
@ -826,9 +838,11 @@ actual:\n\
}
}
fn parse_debugger_commands(&self, debugger_prefix: &str) -> DebuggerCommands {
let command_directive = format!("{}-command", debugger_prefix);
let check_directive = format!("{}-check", debugger_prefix);
fn parse_debugger_commands(&self, debugger_prefixes: &[&str]) -> DebuggerCommands {
let directives = debugger_prefixes.iter().map(|prefix| (
format!("{}-command", prefix),
format!("{}-check", prefix),
)).collect::<Vec<_>>();
let mut breakpoint_lines = vec!();
let mut commands = vec!();
@ -842,6 +856,7 @@ actual:\n\
breakpoint_lines.push(counter);
}
for &(ref command_directive, ref check_directive) in &directives {
header::parse_name_value_directive(
&line,
&command_directive).map(|cmd| {
@ -854,6 +869,7 @@ actual:\n\
check_lines.push(cmd)
});
}
}
Err(e) => {
self.fatal(&format!("Error while parsing debugger commands: {}", e))
}