add gdb_native_rust config to compiletest
This commit is contained in:
parent
9253e1206e
commit
6554fb0d8d
|
@ -149,6 +149,9 @@ pub struct Config {
|
||||||
// Version of GDB
|
// Version of GDB
|
||||||
pub gdb_version: Option<String>,
|
pub gdb_version: Option<String>,
|
||||||
|
|
||||||
|
// Whether GDB has native rust support
|
||||||
|
pub gdb_native_rust: bool,
|
||||||
|
|
||||||
// Version of LLDB
|
// Version of LLDB
|
||||||
pub lldb_version: Option<String>,
|
pub lldb_version: Option<String>,
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
|
||||||
target: opt_str2(matches.opt_str("target")),
|
target: opt_str2(matches.opt_str("target")),
|
||||||
host: opt_str2(matches.opt_str("host")),
|
host: opt_str2(matches.opt_str("host")),
|
||||||
gdb_version: extract_gdb_version(matches.opt_str("gdb-version")),
|
gdb_version: extract_gdb_version(matches.opt_str("gdb-version")),
|
||||||
|
gdb_native_rust: false,
|
||||||
lldb_version: extract_lldb_version(matches.opt_str("lldb-version")),
|
lldb_version: extract_lldb_version(matches.opt_str("lldb-version")),
|
||||||
llvm_version: matches.opt_str("llvm-version"),
|
llvm_version: matches.opt_str("llvm-version"),
|
||||||
android_cross_path: opt_path(matches, "android-cross-path"),
|
android_cross_path: opt_path(matches, "android-cross-path"),
|
||||||
|
|
|
@ -430,11 +430,23 @@ actual:\n\
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_debuginfo_gdb_test_no_opt(&self) {
|
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 {
|
let DebuggerCommands {
|
||||||
commands,
|
commands,
|
||||||
check_lines,
|
check_lines,
|
||||||
breakpoint_lines
|
breakpoint_lines
|
||||||
} = self.parse_debugger_commands("gdb");
|
} = self.parse_debugger_commands(prefixes);
|
||||||
let mut cmds = commands.join("\n");
|
let mut cmds = commands.join("\n");
|
||||||
|
|
||||||
// compile test file (it should have 'compile-flags:-g' in the header)
|
// compile test file (it should have 'compile-flags:-g' in the header)
|
||||||
|
@ -731,7 +743,7 @@ actual:\n\
|
||||||
check_lines,
|
check_lines,
|
||||||
breakpoint_lines,
|
breakpoint_lines,
|
||||||
..
|
..
|
||||||
} = self.parse_debugger_commands("lldb");
|
} = self.parse_debugger_commands(&["lldb"]);
|
||||||
|
|
||||||
// Write debugger script:
|
// Write debugger script:
|
||||||
// We don't want to hang when calling `quit` while the process is still running
|
// 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 {
|
fn parse_debugger_commands(&self, debugger_prefixes: &[&str]) -> DebuggerCommands {
|
||||||
let command_directive = format!("{}-command", debugger_prefix);
|
let directives = debugger_prefixes.iter().map(|prefix| (
|
||||||
let check_directive = format!("{}-check", debugger_prefix);
|
format!("{}-command", prefix),
|
||||||
|
format!("{}-check", prefix),
|
||||||
|
)).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut breakpoint_lines = vec!();
|
let mut breakpoint_lines = vec!();
|
||||||
let mut commands = vec!();
|
let mut commands = vec!();
|
||||||
|
@ -842,17 +856,19 @@ actual:\n\
|
||||||
breakpoint_lines.push(counter);
|
breakpoint_lines.push(counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
header::parse_name_value_directive(
|
for &(ref command_directive, ref check_directive) in &directives {
|
||||||
&line,
|
header::parse_name_value_directive(
|
||||||
&command_directive).map(|cmd| {
|
&line,
|
||||||
commands.push(cmd)
|
&command_directive).map(|cmd| {
|
||||||
});
|
commands.push(cmd)
|
||||||
|
});
|
||||||
|
|
||||||
header::parse_name_value_directive(
|
header::parse_name_value_directive(
|
||||||
&line,
|
&line,
|
||||||
&check_directive).map(|cmd| {
|
&check_directive).map(|cmd| {
|
||||||
check_lines.push(cmd)
|
check_lines.push(cmd)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.fatal(&format!("Error while parsing debugger commands: {}", e))
|
self.fatal(&format!("Error while parsing debugger commands: {}", e))
|
||||||
|
|
Loading…
Reference in New Issue