Skip to content
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

Is anyone running our gdb-based Android debuginfo tests? #129139

Open
saethlin opened this issue Aug 16, 2024 · 3 comments
Open

Is anyone running our gdb-based Android debuginfo tests? #129139

saethlin opened this issue Aug 16, 2024 · 3 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc C-discussion Category: Discussion or questions that doesn't represent real issues. O-android Operating system: Android T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@saethlin
Copy link
Member

saethlin commented Aug 16, 2024

This is mostly directed at @chriswailes, @maurer, and @mgeisler because you are the target maintainers for our Android targets.

I've been looking through our debuginfo tests, and I've found that a few of them were disabled years ago never revisited. Some of those tests are disabled only on Android. Based on the history linked from #10381, the last attempt to re-enable some of the mass-ignored android debuginfo tests was in 2015. So I'm not expecting any of you to really know the history here.

But currently (and I do not know for how long) we do not run any debuginfo tests on Android: https://github.com/rust-lang-ci/rust/actions/runs/10409799292/job/28830241725#step:25:23109

It seems like this is because compiletest looks for a gdb:

/// Returns (Path to GDB, GDB Version, GDB has Rust Support)
fn analyze_gdb(
gdb: Option<String>,
target: &str,
android_cross_path: &PathBuf,
) -> (Option<String>, Option<u32>, bool) {
#[cfg(not(windows))]
const GDB_FALLBACK: &str = "gdb";
#[cfg(windows)]
const GDB_FALLBACK: &str = "gdb.exe";
const MIN_GDB_WITH_RUST: u32 = 7011010;
let fallback_gdb = || {
if is_android_gdb_target(target) {
let mut gdb_path = match android_cross_path.to_str() {
Some(x) => x.to_owned(),
None => panic!("cannot find android cross path"),
};
gdb_path.push_str("/bin/gdb");
gdb_path
} else {
GDB_FALLBACK.to_owned()
}
};
let gdb = match gdb {
None => fallback_gdb(),
Some(ref s) if s.is_empty() => fallback_gdb(), // may be empty if configure found no gdb
Some(ref s) => s.to_owned(),
};
let mut version_line = None;
if let Ok(output) = Command::new(&gdb).arg("--version").output() {
if let Some(first_line) = String::from_utf8_lossy(&output.stdout).lines().next() {
version_line = Some(first_line.to_string());
}
}
let version = match version_line {
Some(line) => extract_gdb_version(&line),
None => return (None, None, false),
};
let gdb_native_rust = version.map_or(false, |v| v >= MIN_GDB_WITH_RUST);
(Some(gdb), version, gdb_native_rust)
}
but since compiletest doesn't find one, we skip the entire suite.

There is a fair amount of code in compiletest for handling debuginfo tests on Android. Since none of any of the code associated with running debuginfo tests on Android is currently being exercised, I suspect all of that code is just a time bomb for whoever eventually decides that we need those tests to be enabled.

In #128913 I am removing a number of ignore-test annotations from the test suite, and replacing them with more specific ignores where required. Because the entire suite is ignored for Android, I cannot do this.

So I have a few questions:

  • Is anyone running the debuginfo test suite on Android?
  • Would anyone object if I blindly remove all the other ignore-android annotations from the test suite?
  • Is anyone planning on working to re-enable the Android debuginfo tests? I've poked around, and it uses a bunch of Android SDK/emulator arcana that I do not understand. For example, I tried installing gdb-multiarch in the image, which results in the test suite managing to execute arm-linux-androideabi-gdb (which I cannot find in the container) but if I add set architecture to the gdb commands, the output is just i686/x86_64.
  • In my searching around for explanations about how to debug on Android, I found some mentions that one should be using lldb instead. Is that right?
@saethlin saethlin added A-testsuite Area: The testsuite used to check the correctness of rustc O-android Operating system: Android C-discussion Category: Discussion or questions that doesn't represent real issues. labels Aug 16, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 16, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 16, 2024
@maurer
Copy link
Contributor

maurer commented Aug 16, 2024

I'm not currently working to re-enable these tests, and I don't expect to have time to do so soon.

If someone wanted to do this, rather than installing gdb-multiarch, use either ndk-lldb or ndk-gdb which are installed as part of the NDK we're fetching. Those should:

  1. Have the right arch support
  2. Know how to connect to a process running in the emulator to debug it

If someone was going to spend time getting one set of tests working, lldb would be massively preferred.

@mgeier
Copy link
Contributor

mgeier commented Aug 16, 2024

@saethlin I think you meant to tag someone else, I'm not a maintainer for any target.

@saethlin
Copy link
Member Author

Right you are. Sorry about that.

@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) labels Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc C-discussion Category: Discussion or questions that doesn't represent real issues. O-android Operating system: Android T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants