Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/etc/lldb_batchmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def main():
print("Aborting.", file=sys.stderr)
sys.exit(1)
finally:
debugger.Terminate()
script_file.close()


Expand Down
29 changes: 27 additions & 2 deletions src/tools/compiletest/src/runtest/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,17 @@ impl TestCx<'_> {
// Path containing `lldb_batchmode.py`, so that the `script` command can import it.
let rust_pp_module_abs_path = self.config.src_root.join("src/etc");
let pythonpath = with_pythonpath_prepended(&rust_pp_module_abs_path);
// make sure `PATH` points to all the dlls necessary to run the debugee
let path = prepend_to_path(&self.config.target_run_lib_path);

let mut cmd = Command::new(lldb);
cmd.arg("--one-line")
.arg("script --language python -- import lldb_batchmode; lldb_batchmode.main()")
.env("LLDB_BATCHMODE_TARGET_PATH", test_executable)
.env("LLDB_BATCHMODE_SCRIPT_PATH", debugger_script)
.env("PYTHONUNBUFFERED", "1") // Help debugging #78665
.env("PYTHONPATH", pythonpath);
.env("PYTHONPATH", pythonpath)
.env("PATH", path);

self.run_command_to_procres(&mut cmd)
}
Expand All @@ -471,7 +474,29 @@ impl TestCx<'_> {
fn with_pythonpath_prepended(some_path: &Utf8Path) -> String {
// FIXME: we are propagating `PYTHONPATH` from the environment, not a compiletest flag!
if let Ok(pp) = std::env::var("PYTHONPATH") {
format!("{pp}:{some_path}")
#[cfg(target_os = "windows")]
{
format!("{pp};{some_path}")
}
#[cfg(not(target_os = "windows"))]
{
format!("{pp}:{some_path}")
}
Comment thread
jieyouxu marked this conversation as resolved.
} else {
some_path.to_string()
}
}

fn prepend_to_path(some_path: &Utf8Path) -> String {
if let Ok(path) = std::env::var("PATH") {
#[cfg(target_os = "windows")]
{
format!("{some_path};{path}")
}
#[cfg(not(target_os = "windows"))]
{
format!("{some_path}:{path}")
}
} else {
some_path.to_string()
}
Expand Down
Loading