-
Notifications
You must be signed in to change notification settings - Fork 14k
Prepare to move debugger discovery from compiletest to bootstrap #148099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| use std::path::PathBuf; | ||
|
|
||
| use crate::core::builder::Builder; | ||
| use crate::core::config::TargetSelection; | ||
|
|
||
| pub(crate) struct Android { | ||
| pub(crate) adb_path: &'static str, | ||
| pub(crate) adb_test_dir: &'static str, | ||
| pub(crate) android_cross_path: PathBuf, | ||
| } | ||
|
|
||
| pub(crate) fn discover_android(builder: &Builder<'_>, target: TargetSelection) -> Option<Android> { | ||
| let adb_path = "adb"; | ||
| // See <https://github.com/rust-lang/rust/pull/102755>. | ||
| let adb_test_dir = "/data/local/tmp/work"; | ||
|
|
||
| let android_cross_path = if target.contains("android") && !builder.config.dry_run() { | ||
| builder.cc(target).parent().unwrap().parent().unwrap().to_owned() | ||
| } else { | ||
| PathBuf::new() | ||
| }; | ||
|
|
||
| Some(Android { adb_path, adb_test_dir, android_cross_path }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| use std::path::Path; | ||
|
|
||
| use crate::core::builder::Builder; | ||
|
|
||
| pub(crate) struct Gdb<'a> { | ||
| pub(crate) gdb: &'a Path, | ||
| } | ||
|
|
||
| pub(crate) fn discover_gdb<'a>(builder: &'a Builder<'_>) -> Option<Gdb<'a>> { | ||
| let gdb = builder.config.gdb.as_deref()?; | ||
|
|
||
| Some(Gdb { gdb }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| use std::path::PathBuf; | ||
|
|
||
| use crate::core::builder::Builder; | ||
| use crate::utils::exec::command; | ||
|
|
||
| pub(crate) struct Lldb { | ||
| pub(crate) lldb_version: String, | ||
| pub(crate) lldb_python_dir: String, | ||
| } | ||
|
|
||
| pub(crate) fn discover_lldb(builder: &Builder<'_>) -> Option<Lldb> { | ||
| // FIXME(#148361): We probably should not be picking up whatever arbitrary | ||
| // lldb happens to be in the user's path, and instead require some kind of | ||
| // explicit opt-in or configuration. | ||
| let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb")); | ||
|
|
||
| let lldb_version = command(&lldb_exe) | ||
| .allow_failure() | ||
| .arg("--version") | ||
| .run_capture(builder) | ||
| .stdout_if_ok() | ||
| .and_then(|v| if v.trim().is_empty() { None } else { Some(v) })?; | ||
|
|
||
| let lldb_python_dir = command(&lldb_exe) | ||
| .allow_failure() | ||
| .arg("-P") | ||
| .run_capture_stdout(builder) | ||
| .stdout_if_ok() | ||
| .map(|p| p.lines().next().expect("lldb Python dir not found").to_string())?; | ||
|
|
||
| Some(Lldb { lldb_version, lldb_python_dir }) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| //! Code for discovering debuggers and debugger-related configuration, so that | ||
| //! it can be passed to compiletest when running debuginfo tests. | ||
|
|
||
| pub(crate) use self::android::{Android, discover_android}; | ||
| pub(crate) use self::gdb::{Gdb, discover_gdb}; | ||
| pub(crate) use self::lldb::{Lldb, discover_lldb}; | ||
|
|
||
| mod android; | ||
| mod gdb; | ||
| mod lldb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| pub(crate) mod build_steps; | ||
| pub(crate) mod builder; | ||
| pub(crate) mod config; | ||
| pub(crate) mod debuggers; | ||
| pub(crate) mod download; | ||
| pub(crate) mod metadata; | ||
| pub(crate) mod sanity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: can you add a FIXME to #148361 for this? Trying to discover an
lldbfrom PATH is highly questionable, because then you can pick up some completely randomlldb🤦There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that we also do exactly the same thing for gdb and cdb; it just (currently) happens in compiletest instead of in bootstrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I understand, none of these are great :D