@@ -983,7 +983,12 @@ impl<'test> TestCx<'test> {
983983 & [ "-quiet" . as_ref ( ) , "-batch" . as_ref ( ) , "-nx" . as_ref ( ) , & debugger_script] ;
984984
985985 let mut gdb = Command :: new ( self . config . gdb . as_ref ( ) . unwrap ( ) ) ;
986- gdb. args ( debugger_opts) . env ( "PYTHONPATH" , rust_pp_module_abs_path) ;
986+ let pythonpath = if let Ok ( pp) = std:: env:: var ( "PYTHONPATH" ) {
987+ format ! ( "{pp}:{rust_pp_module_abs_path}" )
988+ } else {
989+ rust_pp_module_abs_path
990+ } ;
991+ gdb. args ( debugger_opts) . env ( "PYTHONPATH" , pythonpath) ;
987992
988993 debugger_run_result =
989994 self . compose_and_run ( gdb, self . config . run_lib_path . to_str ( ) . unwrap ( ) , None , None ) ;
@@ -1149,13 +1154,18 @@ impl<'test> TestCx<'test> {
11491154 ) -> ProcRes {
11501155 // Prepare the lldb_batchmode which executes the debugger script
11511156 let lldb_script_path = rust_src_root. join ( "src/etc/lldb_batchmode.py" ) ;
1157+ let pythonpath = if let Ok ( pp) = std:: env:: var ( "PYTHONPATH" ) {
1158+ format ! ( "{pp}:{}" , self . config. lldb_python_dir. as_ref( ) . unwrap( ) )
1159+ } else {
1160+ self . config . lldb_python_dir . as_ref ( ) . unwrap ( ) . to_string ( )
1161+ } ;
11521162 self . cmd2procres (
11531163 Command :: new ( & self . config . python )
11541164 . arg ( & lldb_script_path)
11551165 . arg ( test_executable)
11561166 . arg ( debugger_script)
11571167 . env ( "PYTHONUNBUFFERED" , "1" ) // Help debugging #78665
1158- . env ( "PYTHONPATH" , self . config . lldb_python_dir . as_ref ( ) . unwrap ( ) ) ,
1168+ . env ( "PYTHONPATH" , pythonpath ) ,
11591169 )
11601170 }
11611171
0 commit comments