@@ -983,7 +983,12 @@ impl<'test> TestCx<'test> {
983
983
& [ "-quiet" . as_ref ( ) , "-batch" . as_ref ( ) , "-nx" . as_ref ( ) , & debugger_script] ;
984
984
985
985
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) ;
987
992
988
993
debugger_run_result =
989
994
self . compose_and_run ( gdb, self . config . run_lib_path . to_str ( ) . unwrap ( ) , None , None ) ;
@@ -1149,13 +1154,18 @@ impl<'test> TestCx<'test> {
1149
1154
) -> ProcRes {
1150
1155
// Prepare the lldb_batchmode which executes the debugger script
1151
1156
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
+ } ;
1152
1162
self . cmd2procres (
1153
1163
Command :: new ( & self . config . python )
1154
1164
. arg ( & lldb_script_path)
1155
1165
. arg ( test_executable)
1156
1166
. arg ( debugger_script)
1157
1167
. env ( "PYTHONUNBUFFERED" , "1" ) // Help debugging #78665
1158
- . env ( "PYTHONPATH" , self . config . lldb_python_dir . as_ref ( ) . unwrap ( ) ) ,
1168
+ . env ( "PYTHONPATH" , pythonpath ) ,
1159
1169
)
1160
1170
}
1161
1171
0 commit comments