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

Function lldb_with_gdbstub_script

tests/all/guest_debug/mod.rs:128–152  ·  view source on GitHub ↗

Run an LLDB debug script against a gdbstub endpoint. Connects LLDB to `127.0.0.1: ` using the Wasm plugin, executes the given script commands, and returns LLDB's stdout.

(port: u16, script: &str)

Source from the content-addressed store, hash-verified

126/// Connects LLDB to `127.0.0.1:<port>` using the Wasm plugin,
127/// executes the given script commands, and returns LLDB's stdout.
128fn lldb_with_gdbstub_script(port: u16, script: &str) -> Result<String> {
129 let _ = env_logger::try_init();
130
131 let mut cmd = Command::new(lldb_path());
132 cmd.arg("--batch");
133 cmd.arg("-o").arg(format!(
134 "process connect --plugin wasm connect://127.0.0.1:{port}"
135 ));
136 for line in script.lines() {
137 let line = line.trim();
138 if !line.is_empty() {
139 cmd.arg("-o").arg(line);
140 }
141 }
142
143 eprintln!("Running LLDB: {cmd:?}");
144 let output = cmd.output()?;
145
146 let stdout = String::from_utf8(output.stdout)?;
147 let stderr = String::from_utf8(output.stderr)?;
148 eprintln!("--- LLDB stdout ---\n{stdout}");
149 eprintln!("--- LLDB stderr ---\n{stderr}");
150
151 Ok(stdout)
152}
153
154/// Validate output against FileCheck-style directives.
155fn check_output(output: &str, directives: &str) -> Result<()> {

Callers 4

guest_debug_cli_fib_stepFunction · 0.85

Calls 6

lldb_pathFunction · 0.85
OkFunction · 0.85
outputMethod · 0.80
newFunction · 0.50
argMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected