@@ -29,6 +29,7 @@ use crate::core::builder::{
2929} ;
3030use crate :: core:: config:: TargetSelection ;
3131use crate :: core:: config:: flags:: { Subcommand , get_completion, top_level_help} ;
32+ use crate :: core:: debuggers;
3233use crate :: utils:: build_stamp:: { self , BuildStamp } ;
3334use crate :: utils:: exec:: { BootstrapCommand , command} ;
3435use crate :: utils:: helpers:: {
@@ -38,8 +39,6 @@ use crate::utils::helpers::{
3839use crate :: utils:: render_tests:: { add_flags_and_try_run_tests, try_run_tests} ;
3940use crate :: { CLang , CodegenBackendKind , DocTests , GitRepo , Mode , PathSet , envify} ;
4041
41- const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
42-
4342/// Runs `cargo test` on various internal tools used by bootstrap.
4443#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
4544pub struct CrateBootstrap {
@@ -2078,27 +2077,28 @@ Please disable assertions with `rust.debug-assertions = false`.
20782077
20792078 cmd. arg ( "--python" ) . arg ( builder. python ( ) ) ;
20802079
2081- if let Some ( ref gdb) = builder. config . gdb {
2082- cmd. arg ( "--gdb" ) . arg ( gdb) ;
2083- }
2084-
2085- let lldb_exe = builder. config . lldb . clone ( ) . unwrap_or_else ( || PathBuf :: from ( "lldb" ) ) ;
2086- let lldb_version = command ( & lldb_exe)
2087- . allow_failure ( )
2088- . arg ( "--version" )
2089- . run_capture ( builder)
2090- . stdout_if_ok ( )
2091- . and_then ( |v| if v. trim ( ) . is_empty ( ) { None } else { Some ( v) } ) ;
2092- if let Some ( ref vers) = lldb_version {
2093- cmd. arg ( "--lldb-version" ) . arg ( vers) ;
2094- let lldb_python_dir = command ( & lldb_exe)
2095- . allow_failure ( )
2096- . arg ( "-P" )
2097- . run_capture_stdout ( builder)
2098- . stdout_if_ok ( )
2099- . map ( |p| p. lines ( ) . next ( ) . expect ( "lldb Python dir not found" ) . to_string ( ) ) ;
2100- if let Some ( ref dir) = lldb_python_dir {
2101- cmd. arg ( "--lldb-python-dir" ) . arg ( dir) ;
2080+ // FIXME(#148099): Currently we set these Android-related flags in all
2081+ // modes, even though they should only be needed in "debuginfo" mode,
2082+ // because the GDB-discovery code in compiletest currently assumes that
2083+ // `--android-cross-path` is always set for Android targets.
2084+ if let Some ( debuggers:: Android { adb_path, adb_test_dir, android_cross_path } ) =
2085+ debuggers:: discover_android ( builder, target)
2086+ {
2087+ cmd. arg ( "--adb-path" ) . arg ( adb_path) ;
2088+ cmd. arg ( "--adb-test-dir" ) . arg ( adb_test_dir) ;
2089+ cmd. arg ( "--android-cross-path" ) . arg ( android_cross_path) ;
2090+ }
2091+
2092+ if mode == "debuginfo" {
2093+ if let Some ( debuggers:: Gdb { gdb } ) = debuggers:: discover_gdb ( builder) {
2094+ cmd. arg ( "--gdb" ) . arg ( gdb) ;
2095+ }
2096+
2097+ if let Some ( debuggers:: Lldb { lldb_version, lldb_python_dir } ) =
2098+ debuggers:: discover_lldb ( builder)
2099+ {
2100+ cmd. arg ( "--lldb-version" ) . arg ( lldb_version) ;
2101+ cmd. arg ( "--lldb-python-dir" ) . arg ( lldb_python_dir) ;
21022102 }
21032103 }
21042104
@@ -2332,16 +2332,6 @@ Please disable assertions with `rust.debug-assertions = false`.
23322332
23332333 cmd. env ( "RUST_TEST_TMPDIR" , builder. tempdir ( ) ) ;
23342334
2335- cmd. arg ( "--adb-path" ) . arg ( "adb" ) ;
2336- cmd. arg ( "--adb-test-dir" ) . arg ( ADB_TEST_DIR ) ;
2337- if target. contains ( "android" ) && !builder. config . dry_run ( ) {
2338- // Assume that cc for this target comes from the android sysroot
2339- cmd. arg ( "--android-cross-path" )
2340- . arg ( builder. cc ( target) . parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) ) ;
2341- } else {
2342- cmd. arg ( "--android-cross-path" ) . arg ( "" ) ;
2343- }
2344-
23452335 if builder. config . cmd . rustfix_coverage ( ) {
23462336 cmd. arg ( "--rustfix-coverage" ) ;
23472337 }
0 commit comments