@@ -455,14 +455,17 @@ impl TestCx<'_> {
455455 // Path containing `lldb_batchmode.py`, so that the `script` command can import it.
456456 let rust_pp_module_abs_path = self . config . src_root . join ( "src/etc" ) ;
457457 let pythonpath = with_pythonpath_prepended ( & rust_pp_module_abs_path) ;
458+ // make sure `PATH` points to all the dlls necessary to run the debugee
459+ let path = prepend_to_path ( & self . config . target_run_lib_path ) ;
458460
459461 let mut cmd = Command :: new ( lldb) ;
460462 cmd. arg ( "--one-line" )
461463 . arg ( "script --language python -- import lldb_batchmode; lldb_batchmode.main()" )
462464 . env ( "LLDB_BATCHMODE_TARGET_PATH" , test_executable)
463465 . env ( "LLDB_BATCHMODE_SCRIPT_PATH" , debugger_script)
464466 . env ( "PYTHONUNBUFFERED" , "1" ) // Help debugging #78665
465- . env ( "PYTHONPATH" , pythonpath) ;
467+ . env ( "PYTHONPATH" , pythonpath)
468+ . env ( "PATH" , path) ;
466469
467470 self . run_command_to_procres ( & mut cmd)
468471 }
@@ -471,7 +474,29 @@ impl TestCx<'_> {
471474fn with_pythonpath_prepended ( some_path : & Utf8Path ) -> String {
472475 // FIXME: we are propagating `PYTHONPATH` from the environment, not a compiletest flag!
473476 if let Ok ( pp) = std:: env:: var ( "PYTHONPATH" ) {
474- format ! ( "{pp}:{some_path}" )
477+ #[ cfg( target_os = "windows" ) ]
478+ {
479+ format ! ( "{pp};{some_path}" )
480+ }
481+ #[ cfg( not( target_os = "windows" ) ) ]
482+ {
483+ format ! ( "{pp}:{some_path}" )
484+ }
485+ } else {
486+ some_path. to_string ( )
487+ }
488+ }
489+
490+ fn prepend_to_path ( some_path : & Utf8Path ) -> String {
491+ if let Ok ( path) = std:: env:: var ( "PATH" ) {
492+ #[ cfg( target_os = "windows" ) ]
493+ {
494+ format ! ( "{some_path};{path}" )
495+ }
496+ #[ cfg( not( target_os = "windows" ) ) ]
497+ {
498+ format ! ( "{some_path}:{path}" )
499+ }
475500 } else {
476501 some_path. to_string ( )
477502 }
0 commit comments