Skip to content

Commit 4623d48

Browse files
committed
Auto merge of #54764 - tromey:test-rust-lldb, r=alexcrichton
Run debuginfo tests against rust-enabled lldb, when possible If the rust-enabled lldb was built, then use it when running the debuginfo tests. Updating the lldb submodule was necessary as this needed a way to differentiate the rust-enabled lldb, so I added a line to the --version output. This adds compiletest commands to differentiate between the rust-enabled and non-rust-enabled lldb, as is already done for gdb. A new "rust-lldb" header directive is also added, but not used in this patch; I plan to use it in #54004. This updates all the tests.
2 parents eae47a4 + ac33b2e commit 4623d48

File tree

76 files changed

+1405
-702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1405
-702
lines changed

src/bootstrap/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,6 @@ pub struct Build {
278278
initial_rustc: PathBuf,
279279
initial_cargo: PathBuf,
280280

281-
// Probed tools at runtime
282-
lldb_version: Option<String>,
283-
lldb_python_dir: Option<String>,
284-
285281
// Runtime state filled in later on
286282
// C/C++ compilers and archiver for all targets
287283
cc: HashMap<Interned<String>, cc::Tool>,
@@ -416,8 +412,6 @@ impl Build {
416412
ar: HashMap::new(),
417413
ranlib: HashMap::new(),
418414
crates: HashMap::new(),
419-
lldb_version: None,
420-
lldb_python_dir: None,
421415
is_sudo,
422416
ci_env: CiEnv::current(),
423417
delayed_failures: RefCell::new(Vec::new()),

src/bootstrap/sanity.rs

-13
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,6 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
236236
}
237237
}
238238

239-
let run = |cmd: &mut Command| {
240-
cmd.output().map(|output| {
241-
String::from_utf8_lossy(&output.stdout)
242-
.lines().next().unwrap_or_else(|| {
243-
panic!("{:?} failed {:?}", cmd, output)
244-
}).to_string()
245-
})
246-
};
247-
build.lldb_version = run(Command::new("lldb").arg("--version")).ok();
248-
if build.lldb_version.is_some() {
249-
build.lldb_python_dir = run(Command::new("lldb").arg("-P")).ok();
250-
}
251-
252239
if let Some(ref s) = build.config.ccache {
253240
cmd_finder.must_have(s);
254241
}

src/bootstrap/test.rs

+27-4
Original file line numberDiff line numberDiff line change
@@ -1082,11 +1082,34 @@ impl Step for Compiletest {
10821082
if let Some(ref gdb) = builder.config.gdb {
10831083
cmd.arg("--gdb").arg(gdb);
10841084
}
1085-
if let Some(ref vers) = builder.lldb_version {
1085+
1086+
let run = |cmd: &mut Command| {
1087+
cmd.output().map(|output| {
1088+
String::from_utf8_lossy(&output.stdout)
1089+
.lines().next().unwrap_or_else(|| {
1090+
panic!("{:?} failed {:?}", cmd, output)
1091+
}).to_string()
1092+
})
1093+
};
1094+
let lldb_exe = if builder.config.lldb_enabled && !target.contains("emscripten") {
1095+
// Test against the lldb that was just built.
1096+
builder.llvm_out(target)
1097+
.join("bin")
1098+
.join("lldb")
1099+
} else {
1100+
PathBuf::from("lldb")
1101+
};
1102+
let lldb_version = Command::new(&lldb_exe)
1103+
.arg("--version")
1104+
.output()
1105+
.map(|output| { String::from_utf8_lossy(&output.stdout).to_string() })
1106+
.ok();
1107+
if let Some(ref vers) = lldb_version {
10861108
cmd.arg("--lldb-version").arg(vers);
1087-
}
1088-
if let Some(ref dir) = builder.lldb_python_dir {
1089-
cmd.arg("--lldb-python-dir").arg(dir);
1109+
let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
1110+
if let Some(ref dir) = lldb_python_dir {
1111+
cmd.arg("--lldb-python-dir").arg(dir);
1112+
}
10901113
}
10911114

10921115
// Get paths from cmd args

src/test/debuginfo/associated-types.rs

+18-9
Original file line numberDiff line numberDiff line change
@@ -51,33 +51,42 @@
5151
// lldb-command:run
5252

5353
// lldb-command:print arg
54-
// lldb-check:[...]$0 = Struct<i32> { b: -1, b1: 0 }
54+
// lldbg-check:[...]$0 = Struct<i32> { b: -1, b1: 0 }
55+
// lldbr-check:(associated_types::Struct<i32>) arg = Struct<i32> { b: -1, b1: 0 }
5556
// lldb-command:continue
5657

5758
// lldb-command:print inferred
58-
// lldb-check:[...]$1 = 1
59+
// lldbg-check:[...]$1 = 1
60+
// lldbr-check:(i64) inferred = 1
5961
// lldb-command:print explicitly
60-
// lldb-check:[...]$2 = 1
62+
// lldbg-check:[...]$2 = 1
63+
// lldbr-check:(i64) explicitly = 1
6164
// lldb-command:continue
6265

6366
// lldb-command:print arg
64-
// lldb-check:[...]$3 = 2
67+
// lldbg-check:[...]$3 = 2
68+
// lldbr-check:(i64) arg = 2
6569
// lldb-command:continue
6670

6771
// lldb-command:print arg
68-
// lldb-check:[...]$4 = (4, 5)
72+
// lldbg-check:[...]$4 = (4, 5)
73+
// lldbr-check:((i32, i64)) arg = { = 4 = 5 }
6974
// lldb-command:continue
7075

7176
// lldb-command:print a
72-
// lldb-check:[...]$5 = 6
77+
// lldbg-check:[...]$5 = 6
78+
// lldbr-check:(i32) a = 6
7379
// lldb-command:print b
74-
// lldb-check:[...]$6 = 7
80+
// lldbg-check:[...]$6 = 7
81+
// lldbr-check:(i64) b = 7
7582
// lldb-command:continue
7683

7784
// lldb-command:print a
78-
// lldb-check:[...]$7 = 8
85+
// lldbg-check:[...]$7 = 8
86+
// lldbr-check:(i64) a = 8
7987
// lldb-command:print b
80-
// lldb-check:[...]$8 = 9
88+
// lldbg-check:[...]$8 = 9
89+
// lldbr-check:(i32) b = 9
8190
// lldb-command:continue
8291

8392
#![allow(unused_variables)]

src/test/debuginfo/basic-types.rs

+29-16
Original file line numberDiff line numberDiff line change
@@ -56,36 +56,49 @@
5656

5757
// lldb-command:run
5858
// lldb-command:print b
59-
// lldb-check:[...]$0 = false
59+
// lldbg-check:[...]$0 = false
60+
// lldbr-check:(bool) b = false
6061
// lldb-command:print i
61-
// lldb-check:[...]$1 = -1
62+
// lldbg-check:[...]$1 = -1
63+
// lldbr-check:(isize) i = -1
6264

63-
// NOTE: LLDB does not support 32bit chars
64-
// d ebugger:print (usize)(c)
65-
// c heck:$3 = 97
65+
// NOTE: only rust-enabled lldb supports 32bit chars
66+
// lldbr-command:print c
67+
// lldbr-check:(char) c = 'a'
6668

6769
// lldb-command:print i8
68-
// lldb-check:[...]$2 = 'D'
70+
// lldbg-check:[...]$2 = 'D'
71+
// lldbr-check:(i8) i8 = 68
6972
// lldb-command:print i16
70-
// lldb-check:[...]$3 = -16
73+
// lldbg-check:[...]$3 = -16
74+
// lldbr-check:(i16) i16 = -16
7175
// lldb-command:print i32
72-
// lldb-check:[...]$4 = -32
76+
// lldbg-check:[...]$4 = -32
77+
// lldbr-check:(i32) i32 = -32
7378
// lldb-command:print i64
74-
// lldb-check:[...]$5 = -64
79+
// lldbg-check:[...]$5 = -64
80+
// lldbr-check:(i64) i64 = -64
7581
// lldb-command:print u
76-
// lldb-check:[...]$6 = 1
82+
// lldbg-check:[...]$6 = 1
83+
// lldbr-check:(usize) u = 1
7784
// lldb-command:print u8
78-
// lldb-check:[...]$7 = 'd'
85+
// lldbg-check:[...]$7 = 'd'
86+
// lldbr-check:(u8) u8 = 100
7987
// lldb-command:print u16
80-
// lldb-check:[...]$8 = 16
88+
// lldbg-check:[...]$8 = 16
89+
// lldbr-check:(u16) u16 = 16
8190
// lldb-command:print u32
82-
// lldb-check:[...]$9 = 32
91+
// lldbg-check:[...]$9 = 32
92+
// lldbr-check:(u32) u32 = 32
8393
// lldb-command:print u64
84-
// lldb-check:[...]$10 = 64
94+
// lldbg-check:[...]$10 = 64
95+
// lldbr-check:(u64) u64 = 64
8596
// lldb-command:print f32
86-
// lldb-check:[...]$11 = 2.5
97+
// lldbg-check:[...]$11 = 2.5
98+
// lldbr-check:(f32) f32 = 2.5
8799
// lldb-command:print f64
88-
// lldb-check:[...]$12 = 3.5
100+
// lldbg-check:[...]$12 = 3.5
101+
// lldbr-check:(f64) f64 = 3.5
89102

90103
#![allow(unused_variables)]
91104
#![feature(omit_gdb_pretty_printer_section)]

src/test/debuginfo/borrowed-basic.rs

+29-16
Original file line numberDiff line numberDiff line change
@@ -68,47 +68,60 @@
6868

6969
// lldb-command:run
7070
// lldb-command:print *bool_ref
71-
// lldb-check:[...]$0 = true
71+
// lldbg-check:[...]$0 = true
72+
// lldbr-check:(bool) *bool_ref = true
7273

7374
// lldb-command:print *int_ref
74-
// lldb-check:[...]$1 = -1
75+
// lldbg-check:[...]$1 = -1
76+
// lldbr-check:(isize) *int_ref = -1
7577

76-
// NOTE: lldb doesn't support 32bit chars at the moment
77-
// d ebugger:print *char_ref
78-
// c heck:[...]$x = 97
78+
// NOTE: only rust-enabled lldb supports 32bit chars
79+
// lldbr-command:print *char_ref
80+
// lldbr-check:(char) *char_ref = 'a'
7981

8082
// lldb-command:print *i8_ref
81-
// lldb-check:[...]$2 = 'D'
83+
// lldbg-check:[...]$2 = 'D'
84+
// lldbr-check:(i8) *i8_ref = 68
8285

8386
// lldb-command:print *i16_ref
84-
// lldb-check:[...]$3 = -16
87+
// lldbg-check:[...]$3 = -16
88+
// lldbr-check:(i16) *i16_ref = -16
8589

8690
// lldb-command:print *i32_ref
87-
// lldb-check:[...]$4 = -32
91+
// lldbg-check:[...]$4 = -32
92+
// lldbr-check:(i32) *i32_ref = -32
8893

8994
// lldb-command:print *i64_ref
90-
// lldb-check:[...]$5 = -64
95+
// lldbg-check:[...]$5 = -64
96+
// lldbr-check:(i64) *i64_ref = -64
9197

9298
// lldb-command:print *uint_ref
93-
// lldb-check:[...]$6 = 1
99+
// lldbg-check:[...]$6 = 1
100+
// lldbr-check:(usize) *uint_ref = 1
94101

95102
// lldb-command:print *u8_ref
96-
// lldb-check:[...]$7 = 'd'
103+
// lldbg-check:[...]$7 = 'd'
104+
// lldbr-check:(u8) *u8_ref = 100
97105

98106
// lldb-command:print *u16_ref
99-
// lldb-check:[...]$8 = 16
107+
// lldbg-check:[...]$8 = 16
108+
// lldbr-check:(u16) *u16_ref = 16
100109

101110
// lldb-command:print *u32_ref
102-
// lldb-check:[...]$9 = 32
111+
// lldbg-check:[...]$9 = 32
112+
// lldbr-check:(u32) *u32_ref = 32
103113

104114
// lldb-command:print *u64_ref
105-
// lldb-check:[...]$10 = 64
115+
// lldbg-check:[...]$10 = 64
116+
// lldbr-check:(u64) *u64_ref = 64
106117

107118
// lldb-command:print *f32_ref
108-
// lldb-check:[...]$11 = 2.5
119+
// lldbg-check:[...]$11 = 2.5
120+
// lldbr-check:(f32) *f32_ref = 2.5
109121

110122
// lldb-command:print *f64_ref
111-
// lldb-check:[...]$12 = 3.5
123+
// lldbg-check:[...]$12 = 3.5
124+
// lldbr-check:(f64) *f64_ref = 3.5
112125

113126
#![allow(unused_variables)]
114127
#![feature(omit_gdb_pretty_printer_section)]

src/test/debuginfo/borrowed-c-style-enum.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@
3434
// lldb-command:run
3535

3636
// lldb-command:print *the_a_ref
37-
// lldb-check:[...]$0 = TheA
37+
// lldbg-check:[...]$0 = TheA
38+
// lldbr-check:(borrowed_c_style_enum::ABC) *the_a_ref = borrowed_c_style_enum::ABC::TheA
3839

3940
// lldb-command:print *the_b_ref
40-
// lldb-check:[...]$1 = TheB
41+
// lldbg-check:[...]$1 = TheB
42+
// lldbr-check:(borrowed_c_style_enum::ABC) *the_b_ref = borrowed_c_style_enum::ABC::TheB
4143

4244
// lldb-command:print *the_c_ref
43-
// lldb-check:[...]$2 = TheC
45+
// lldbg-check:[...]$2 = TheC
46+
// lldbr-check:(borrowed_c_style_enum::ABC) *the_c_ref = borrowed_c_style_enum::ABC::TheC
4447

4548
#![allow(unused_variables)]
4649
#![feature(omit_gdb_pretty_printer_section)]

src/test/debuginfo/borrowed-enum.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@
3636
// lldb-command:run
3737

3838
// lldb-command:print *the_a_ref
39-
// lldb-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
39+
// lldbg-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
40+
// lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { borrowed_enum::ABC::TheA: 0, borrowed_enum::ABC::TheB: 8970181431921507452 }
4041
// lldb-command:print *the_b_ref
41-
// lldb-check:[...]$1 = TheB(0, 286331153, 286331153)
42+
// lldbg-check:[...]$1 = TheB(0, 286331153, 286331153)
43+
// lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 }
4244
// lldb-command:print *univariant_ref
43-
// lldb-check:[...]$2 = TheOnlyCase(4820353753753434)
45+
// lldbg-check:[...]$2 = TheOnlyCase(4820353753753434)
46+
// lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { borrowed_enum::TheOnlyCase = { = 4820353753753434 } }
4447

4548
#![allow(unused_variables)]
4649
#![feature(omit_gdb_pretty_printer_section)]

src/test/debuginfo/borrowed-struct.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,32 @@
4545
// lldb-command:run
4646

4747
// lldb-command:print *stack_val_ref
48-
// lldb-check:[...]$0 = SomeStruct { x: 10, y: 23.5 }
48+
// lldbg-check:[...]$0 = SomeStruct { x: 10, y: 23.5 }
49+
// lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = SomeStruct { x: 10, y: 23.5 }
4950

5051
// lldb-command:print *stack_val_interior_ref_1
51-
// lldb-check:[...]$1 = 10
52+
// lldbg-check:[...]$1 = 10
53+
// lldbr-check:(isize) *stack_val_interior_ref_1 = 10
5254

5355
// lldb-command:print *stack_val_interior_ref_2
54-
// lldb-check:[...]$2 = 23.5
56+
// lldbg-check:[...]$2 = 23.5
57+
// lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5
5558

5659
// lldb-command:print *ref_to_unnamed
57-
// lldb-check:[...]$3 = SomeStruct { x: 11, y: 24.5 }
60+
// lldbg-check:[...]$3 = SomeStruct { x: 11, y: 24.5 }
61+
// lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = SomeStruct { x: 11, y: 24.5 }
5862

5963
// lldb-command:print *unique_val_ref
60-
// lldb-check:[...]$4 = SomeStruct { x: 13, y: 26.5 }
64+
// lldbg-check:[...]$4 = SomeStruct { x: 13, y: 26.5 }
65+
// lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = SomeStruct { x: 13, y: 26.5 }
6166

6267
// lldb-command:print *unique_val_interior_ref_1
63-
// lldb-check:[...]$5 = 13
68+
// lldbg-check:[...]$5 = 13
69+
// lldbr-check:(isize) *unique_val_interior_ref_1 = 13
6470

6571
// lldb-command:print *unique_val_interior_ref_2
66-
// lldb-check:[...]$6 = 26.5
72+
// lldbg-check:[...]$6 = 26.5
73+
// lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5
6774

6875
#![allow(unused_variables)]
6976
#![feature(box_syntax)]

src/test/debuginfo/borrowed-tuple.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@
3434
// lldb-command:run
3535

3636
// lldb-command:print *stack_val_ref
37-
// lldb-check:[...]$0 = (-14, -19)
37+
// lldbg-check:[...]$0 = (-14, -19)
38+
// lldbr-check:((i16, f32)) *stack_val_ref = { = -14 = -19 }
3839

3940
// lldb-command:print *ref_to_unnamed
40-
// lldb-check:[...]$1 = (-15, -20)
41+
// lldbg-check:[...]$1 = (-15, -20)
42+
// lldbr-check:((i16, f32)) *ref_to_unnamed = { = -15 = -20 }
4143

4244
// lldb-command:print *unique_val_ref
43-
// lldb-check:[...]$2 = (-17, -22)
45+
// lldbg-check:[...]$2 = (-17, -22)
46+
// lldbr-check:((i16, f32)) *unique_val_ref = { = -17 = -22 }
4447

4548

4649
#![allow(unused_variables)]

0 commit comments

Comments
 (0)