about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-19 12:16:20 +0000
committerbors <bors@rust-lang.org>2024-08-19 12:16:20 +0000
commit4fe1e2bd5bf5a6f1cb245f161a5e9d315766f103 (patch)
tree6518a4cb7fea427377f1875de885b419988bdbac /src
parent45fbf41deb24581471e3e56824d9318d3d415cb8 (diff)
parentb2dae987f8d0118be944434f0504f5fefd8737c4 (diff)
downloadrust-4fe1e2bd5bf5a6f1cb245f161a5e9d315766f103.tar.gz
rust-4fe1e2bd5bf5a6f1cb245f161a5e9d315766f103.zip
Auto merge of #129218 - saethlin:gdb-supports-rust-now, r=jieyouxu
Delete debuginfo test suite infra for gdb without Rust support and lldb with Rust support

Implements https://github.com/rust-lang/rust/issues/128953

I also deleted all the `min-lldb-version: 310` comments, because the oldest compatible distro I can find is Ubuntu 16.04 which ships lldb 3.8, though of course the package that the Ubuntu maintainers put together for that is broken.

Rocky Linux 8 amusingly ships lldb 17, even though it has a similar glibc and kernel version.

This PR is multiple highly mechanical changes. Some of the commits were created by just running `sed`. You may find it easier to review each commit separately.
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/command-list.rs1
-rw-r--r--src/tools/compiletest/src/common.rs6
-rw-r--r--src/tools/compiletest/src/header/needs.rs7
-rw-r--r--src/tools/compiletest/src/lib.rs36
-rw-r--r--src/tools/compiletest/src/runtest.rs30
-rw-r--r--src/tools/compiletest/src/tests.rs8
6 files changed, 19 insertions, 69 deletions
diff --git a/src/tools/compiletest/src/command-list.rs b/src/tools/compiletest/src/command-list.rs
index 9477c48db0a..7f8080235c8 100644
--- a/src/tools/compiletest/src/command-list.rs
+++ b/src/tools/compiletest/src/command-list.rs
@@ -145,7 +145,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
     "needs-relocation-model-pic",
     "needs-run-enabled",
     "needs-rust-lld",
-    "needs-rust-lldb",
     "needs-sanitizer-address",
     "needs-sanitizer-cfi",
     "needs-sanitizer-dataflow",
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 70ebefe3f41..5831f7c3cf2 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -296,15 +296,9 @@ pub struct Config {
     /// Version of GDB, encoded as ((major * 1000) + minor) * 1000 + patch
     pub gdb_version: Option<u32>,
 
-    /// Whether GDB has native rust support
-    pub gdb_native_rust: bool,
-
     /// Version of LLDB
     pub lldb_version: Option<u32>,
 
-    /// Whether LLDB has native rust support
-    pub lldb_native_rust: bool,
-
     /// Version of LLVM
     pub llvm_version: Option<u32>,
 
diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/header/needs.rs
index 5b2665f7d0b..8f935d5b744 100644
--- a/src/tools/compiletest/src/header/needs.rs
+++ b/src/tools/compiletest/src/header/needs.rs
@@ -1,4 +1,4 @@
-use crate::common::{Config, Debugger, Sanitizer};
+use crate::common::{Config, Sanitizer};
 use crate::header::IgnoreDecision;
 
 pub(super) fn handle_needs(
@@ -115,11 +115,6 @@ pub(super) fn handle_needs(
             ignore_reason: "ignored on targets without Rust's LLD",
         },
         Need {
-            name: "needs-rust-lldb",
-            condition: config.debugger != Some(Debugger::Lldb) || config.lldb_native_rust,
-            ignore_reason: "ignored on targets without Rust's LLDB",
-        },
-        Need {
             name: "needs-dlltool",
             condition: cache.dlltool,
             ignore_reason: "ignored when dlltool for the current architecture is not present",
diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs
index 6acf46f9196..7018362af54 100644
--- a/src/tools/compiletest/src/lib.rs
+++ b/src/tools/compiletest/src/lib.rs
@@ -194,14 +194,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
     let target = opt_str2(matches.opt_str("target"));
     let android_cross_path = opt_path(matches, "android-cross-path");
     let (cdb, cdb_version) = analyze_cdb(matches.opt_str("cdb"), &target);
-    let (gdb, gdb_version, gdb_native_rust) =
-        analyze_gdb(matches.opt_str("gdb"), &target, &android_cross_path);
-    let (lldb_version, lldb_native_rust) = matches
-        .opt_str("lldb-version")
-        .as_deref()
-        .and_then(extract_lldb_version)
-        .map(|(v, b)| (Some(v), b))
-        .unwrap_or((None, false));
+    let (gdb, gdb_version) = analyze_gdb(matches.opt_str("gdb"), &target, &android_cross_path);
+    let lldb_version = matches.opt_str("lldb-version").as_deref().and_then(extract_lldb_version);
     let color = match matches.opt_str("color").as_deref() {
         Some("auto") | None => ColorConfig::AutoColor,
         Some("always") => ColorConfig::AlwaysColor,
@@ -298,9 +292,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
         cdb_version,
         gdb,
         gdb_version,
-        gdb_native_rust,
         lldb_version,
-        lldb_native_rust,
         llvm_version,
         system_llvm: matches.opt_present("system-llvm"),
         android_cross_path,
@@ -1035,19 +1027,17 @@ fn extract_cdb_version(full_version_line: &str) -> Option<[u16; 4]> {
     Some([major, minor, patch, build])
 }
 
-/// Returns (Path to GDB, GDB Version, GDB has Rust Support)
+/// Returns (Path to GDB, GDB Version)
 fn analyze_gdb(
     gdb: Option<String>,
     target: &str,
     android_cross_path: &PathBuf,
-) -> (Option<String>, Option<u32>, bool) {
+) -> (Option<String>, Option<u32>) {
     #[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() {
@@ -1076,12 +1066,10 @@ fn analyze_gdb(
 
     let version = match version_line {
         Some(line) => extract_gdb_version(&line),
-        None => return (None, None, false),
+        None => return (None, None),
     };
 
-    let gdb_native_rust = version.map_or(false, |v| v >= MIN_GDB_WITH_RUST);
-
-    (Some(gdb), version, gdb_native_rust)
+    (Some(gdb), version)
 }
 
 fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
@@ -1131,8 +1119,8 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
     Some(((major * 1000) + minor) * 1000 + patch)
 }
 
-/// Returns (LLDB version, LLDB is rust-enabled)
-fn extract_lldb_version(full_version_line: &str) -> Option<(u32, bool)> {
+/// Returns LLDB version
+fn extract_lldb_version(full_version_line: &str) -> Option<u32> {
     // Extract the major LLDB version from the given version string.
     // LLDB version strings are different for Apple and non-Apple platforms.
     // The Apple variant looks like this:
@@ -1149,9 +1137,7 @@ fn extract_lldb_version(full_version_line: &str) -> Option<(u32, bool)> {
     // There doesn't seem to be a way to correlate the Apple version
     // with the upstream version, and since the tests were originally
     // written against Apple versions, we make a fake Apple version by
-    // multiplying the first number by 100.  This is a hack, but
-    // normally fine because the only non-Apple version we test is
-    // rust-enabled.
+    // multiplying the first number by 100. This is a hack.
 
     let full_version_line = full_version_line.trim();
 
@@ -1160,12 +1146,12 @@ fn extract_lldb_version(full_version_line: &str) -> Option<(u32, bool)> {
     {
         if let Some(idx) = apple_ver.find(not_a_digit) {
             let version: u32 = apple_ver[..idx].parse().unwrap();
-            return Some((version, full_version_line.contains("rust-enabled")));
+            return Some(version);
         }
     } else if let Some(lldb_ver) = full_version_line.strip_prefix("lldb version ") {
         if let Some(idx) = lldb_ver.find(not_a_digit) {
             let version: u32 = lldb_ver[..idx].parse().ok()?;
-            return Some((version * 100, full_version_line.contains("rust-enabled")));
+            return Some(version * 100);
         }
     }
     None
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 59fce44d1c7..eca21e55989 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -856,22 +856,10 @@ impl<'test> TestCx<'test> {
     }
 
     fn run_debuginfo_gdb_test_no_opt(&self) {
-        let prefixes = if self.config.gdb_native_rust {
-            // GDB with Rust
-            static PREFIXES: &[&str] = &["gdb", "gdbr"];
-            println!("NOTE: compiletest thinks it is using GDB with native rust support");
-            PREFIXES
-        } else {
-            // Generic GDB
-            static PREFIXES: &[&str] = &["gdb", "gdbg"];
-            println!("NOTE: compiletest thinks it is using GDB without native rust support");
-            PREFIXES
-        };
-
         let dbg_cmds = DebuggerCommands::parse_from(
             &self.testpaths.file,
             self.config,
-            prefixes,
+            &["gdb"],
             self.revision,
         )
         .unwrap_or_else(|e| self.fatal(&e));
@@ -1053,9 +1041,7 @@ impl<'test> TestCx<'test> {
                 .push_str(&format!("file {}\n", exe_file.to_str().unwrap().replace(r"\", r"\\")));
 
             // Force GDB to print values in the Rust format.
-            if self.config.gdb_native_rust {
-                script_str.push_str("set language rust\n");
-            }
+            script_str.push_str("set language rust\n");
 
             // Add line breakpoints
             for line in &dbg_cmds.breakpoint_lines {
@@ -1140,21 +1126,11 @@ impl<'test> TestCx<'test> {
             }
         }
 
-        let prefixes = if self.config.lldb_native_rust {
-            static PREFIXES: &[&str] = &["lldb", "lldbr"];
-            println!("NOTE: compiletest thinks it is using LLDB with native rust support");
-            PREFIXES
-        } else {
-            static PREFIXES: &[&str] = &["lldb", "lldbg"];
-            println!("NOTE: compiletest thinks it is using LLDB without native rust support");
-            PREFIXES
-        };
-
         // Parse debugger commands etc from test files
         let dbg_cmds = DebuggerCommands::parse_from(
             &self.testpaths.file,
             self.config,
-            prefixes,
+            &["lldb"],
             self.revision,
         )
         .unwrap_or_else(|e| self.fatal(&e));
diff --git a/src/tools/compiletest/src/tests.rs b/src/tools/compiletest/src/tests.rs
index 4292f234adc..7c2e7b0f023 100644
--- a/src/tools/compiletest/src/tests.rs
+++ b/src/tools/compiletest/src/tests.rs
@@ -48,12 +48,12 @@ fn test_extract_gdb_version() {
 #[test]
 fn test_extract_lldb_version() {
     // Apple variants
-    assert_eq!(extract_lldb_version("LLDB-179.5"), Some((179, false)));
-    assert_eq!(extract_lldb_version("lldb-300.2.51"), Some((300, false)));
+    assert_eq!(extract_lldb_version("LLDB-179.5"), Some(179));
+    assert_eq!(extract_lldb_version("lldb-300.2.51"), Some(300));
 
     // Upstream versions
-    assert_eq!(extract_lldb_version("lldb version 6.0.1"), Some((600, false)));
-    assert_eq!(extract_lldb_version("lldb version 9.0.0"), Some((900, false)));
+    assert_eq!(extract_lldb_version("lldb version 6.0.1"), Some(600));
+    assert_eq!(extract_lldb_version("lldb version 9.0.0"), Some(900));
 }
 
 #[test]