Deduplicate lldb_commands
.
This commit is contained in:
parent
4a799082fe
commit
36a8daeb44
@ -1474,29 +1474,8 @@ impl<'test> TestCx<'test> {
|
||||
// Switch LLDB into "Rust mode"
|
||||
let rust_src_root =
|
||||
self.config.find_rust_src_root().expect("Could not find Rust source root");
|
||||
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_lookup.py");
|
||||
let rust_pp_module_abs_path =
|
||||
rust_src_root.join(rust_pp_module_rel_path).to_str().unwrap().to_owned();
|
||||
|
||||
let rust_type_regexes = vec![
|
||||
"^(alloc::([a-z_]+::)+)String$",
|
||||
"^&(mut )?str$",
|
||||
"^&(mut )?\\[.+\\]$",
|
||||
"^(std::ffi::([a-z_]+::)+)OsString$",
|
||||
"^(alloc::([a-z_]+::)+)Vec<.+>$",
|
||||
"^(alloc::([a-z_]+::)+)VecDeque<.+>$",
|
||||
"^(alloc::([a-z_]+::)+)BTreeSet<.+>$",
|
||||
"^(alloc::([a-z_]+::)+)BTreeMap<.+>$",
|
||||
"^(std::collections::([a-z_]+::)+)HashMap<.+>$",
|
||||
"^(std::collections::([a-z_]+::)+)HashSet<.+>$",
|
||||
"^(alloc::([a-z_]+::)+)Rc<.+>$",
|
||||
"^(alloc::([a-z_]+::)+)Arc<.+>$",
|
||||
"^(core::([a-z_]+::)+)Cell<.+>$",
|
||||
"^(core::([a-z_]+::)+)Ref<.+>$",
|
||||
"^(core::([a-z_]+::)+)RefMut<.+>$",
|
||||
"^(core::([a-z_]+::)+)RefCell<.+>$",
|
||||
"^(core::([a-z_]+::)+)NonZero<.+>$",
|
||||
];
|
||||
let rust_pp_module_rel_path = Path::new("./src/etc");
|
||||
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path);
|
||||
|
||||
// In newer versions of lldb, persistent results (the `$N =` part at the start of
|
||||
// expressions you have evaluated that let you re-use the result) aren't printed, but lots
|
||||
@ -1507,16 +1486,13 @@ impl<'test> TestCx<'test> {
|
||||
script_str.push_str("command unalias p\n");
|
||||
script_str.push_str("command alias p expr --\n");
|
||||
|
||||
script_str
|
||||
.push_str(&format!("command script import {}\n", &rust_pp_module_abs_path[..])[..]);
|
||||
script_str.push_str("type synthetic add -l lldb_lookup.synthetic_lookup -x '.*' ");
|
||||
script_str.push_str("--category Rust\n");
|
||||
for type_regex in rust_type_regexes {
|
||||
script_str.push_str("type summary add -F lldb_lookup.summary_lookup -e -x -h ");
|
||||
script_str.push_str(&format!("'{}' ", type_regex));
|
||||
script_str.push_str("--category Rust\n");
|
||||
}
|
||||
script_str.push_str("type category enable Rust\n");
|
||||
script_str.push_str(&format!(
|
||||
"command script import {}/lldb_lookup.py\n",
|
||||
rust_pp_module_abs_path.to_str().unwrap()
|
||||
));
|
||||
File::open(rust_pp_module_abs_path.join("lldb_commands"))
|
||||
.and_then(|mut file| file.read_to_string(&mut script_str))
|
||||
.expect("Failed to read lldb_commands");
|
||||
|
||||
// Set breakpoints on every line that contains the string "#break"
|
||||
let source_file_name = self.testpaths.file.file_name().unwrap().to_string_lossy();
|
||||
|
Loading…
x
Reference in New Issue
Block a user