@@ -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,24 @@ 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+ if mode == "debuginfo" {
2081+ if let Some ( debuggers:: Gdb { gdb } ) = debuggers:: discover_gdb ( builder) {
2082+ cmd. arg ( "--gdb" ) . arg ( gdb) ;
2083+ }
2084+
2085+ if let Some ( debuggers:: Android { adb_path, adb_test_dir, android_cross_path } ) =
2086+ debuggers:: discover_android ( builder, target)
2087+ {
2088+ cmd. arg ( "--adb-path" ) . arg ( adb_path) ;
2089+ cmd. arg ( "--adb-test-dir" ) . arg ( adb_test_dir) ;
2090+ cmd. arg ( "--android-cross-path" ) . arg ( android_cross_path) ;
2091+ }
2092+
2093+ if let Some ( debuggers:: Lldb { lldb_version, lldb_python_dir } ) =
2094+ debuggers:: discover_lldb ( builder)
2095+ {
2096+ cmd. arg ( "--lldb-version" ) . arg ( lldb_version) ;
2097+ cmd. arg ( "--lldb-python-dir" ) . arg ( lldb_python_dir) ;
21022098 }
21032099 }
21042100
@@ -2332,16 +2328,6 @@ Please disable assertions with `rust.debug-assertions = false`.
23322328
23332329 cmd. env ( "RUST_TEST_TMPDIR" , builder. tempdir ( ) ) ;
23342330
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-
23452331 if builder. config . cmd . rustfix_coverage ( ) {
23462332 cmd. arg ( "--rustfix-coverage" ) ;
23472333 }
0 commit comments