MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / lldb_with_script

Function lldb_with_script

tests/all/native_debug/lldb.rs:17–64  ·  view source on GitHub ↗
(args: &[&str], script: &str)

Source from the content-addressed store, hash-verified

15foreach_dwarf!(assert_test_exists);
16
17fn lldb_with_script(args: &[&str], script: &str) -> Result<String> {
18 let _ = env_logger::try_init();
19
20 let lldb_path = env::var("LLDB").unwrap_or("lldb".to_string());
21 let mut cmd = Command::new(&lldb_path);
22
23 cmd.arg("--batch");
24 if cfg!(target_os = "macos") {
25 cmd.args(&["-o", "settings set plugin.jit-loader.gdb.enable on"]);
26 }
27 let mut script_file = NamedTempFile::new()?;
28 script_file.write(script.as_bytes())?;
29 let script_path = script_file.path().to_str().unwrap();
30 cmd.args(&["-s", &script_path]);
31
32 let mut me = std::env::current_exe().expect("current_exe specified");
33 me.pop(); // chop off the file name
34 me.pop(); // chop off `deps`
35 if cfg!(target_os = "windows") {
36 me.push("wasmtime.exe");
37 } else {
38 me.push("wasmtime");
39 }
40 cmd.arg(me);
41
42 cmd.arg("--");
43 cmd.args(args);
44
45 log::trace!("Running command: {cmd:?}");
46 let output = cmd.output().expect("success");
47
48 let stdout = String::from_utf8(output.stdout)?;
49 log::trace!("--- sdout ---\n{stdout}");
50
51 let stderr = String::from_utf8(output.stderr)?;
52 log::trace!("--- sderr ---\n{stderr}");
53
54 if !output.status.success() {
55 bail!(
56 "failed to execute {cmd:?}:\n\
57 --- stderr ---\n\
58 {stderr}\n\
59 --- stdout ---\n\
60 {stdout}",
61 );
62 }
63 Ok(stdout)
64}
65
66fn check_lldb_output(output: &str, directives: &str) -> Result<()> {
67 let mut builder = CheckerBuilder::new();

Callers 13

dwarf_fib_wasmFunction · 0.85
dwarf_fib_wasm_dwarf5Function · 0.85
dwarf_fib_wasm_split4Function · 0.85
dwarf_genericFunction · 0.85
dwarf_codegen_optimizedFunction · 0.85
dwarf_fraction_normFunction · 0.85
dwarf_spilled_frame_baseFunction · 0.85
dwarf_fissionFunction · 0.85
test_dwarf_simpleFunction · 0.85

Calls 15

OkFunction · 0.85
as_bytesMethod · 0.80
to_strMethod · 0.80
outputMethod · 0.80
newFunction · 0.50
to_stringMethod · 0.45
argMethod · 0.45
argsMethod · 0.45
writeMethod · 0.45
unwrapMethod · 0.45
pathMethod · 0.45
expectMethod · 0.45

Tested by 1

test_dwarf_simpleFunction · 0.68