Skip to content

Commit 2985a8b

Browse files
committed
Re-enable some gdb tests
Bug #47163 points out that some debug tests were disabled. This patch re-enables many of them for gdb (I don't know enough about recent versions of lldb to make this change there). One test that only works for a relatively new gdb, due to the use of DW_ATE_UTF, is moved to a version-specific test. In a couple of spot, I simplified the check expression where I thought that it made sense to do so -- sometimes it isn't very worthwhile to match exactly what is emitted, particularly where this has changed over time. I tested this with both a DW_ATE_UTF-capable gdb, and an older version.
1 parent 09be68c commit 2985a8b

18 files changed

+40
-67
lines changed

src/test/debuginfo/basic-types-globals-metadata.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// min-lldb-version: 310
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// compile-flags:-g
54
// gdb-command:run
@@ -9,9 +8,10 @@
98
// gdbg-command:whatis 'basic_types_globals_metadata::I'
109
// gdbr-command:whatis basic_types_globals_metadata::I
1110
// gdb-check:type = isize
12-
// gdbg-command:whatis 'basic_types_globals_metadata::C'
13-
// gdbr-command:whatis basic_types_globals_metadata::C
14-
// gdb-check:type = char
11+
12+
// Note we don't check the 'char' type here, as gdb only got support
13+
// for DW_ATE_UTF in 11.2. This is handled by a different test.
14+
1515
// gdbg-command:whatis 'basic_types_globals_metadata::I8'
1616
// gdbr-command:whatis basic_types_globals_metadata::I8
1717
// gdb-check:type = i8

src/test/debuginfo/basic-types-globals.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
2-
// as its numerical value along with its associated ASCII char, there
3-
// doesn't seem to be any way around this. Also, gdb doesn't know
4-
// about UTF-32 character encoding and will print a rust char as only
5-
// its numerical value.
6-
71
// min-lldb-version: 310
8-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
92

103
// compile-flags:-g
114
// gdb-command:run
@@ -15,10 +8,9 @@
158
// gdbg-command:print 'basic_types_globals::I'
169
// gdbr-command:print I
1710
// gdb-check:$2 = -1
18-
// gdbg-command:print 'basic_types_globals::C'
19-
// gdbr-command:print C
20-
// gdbg-check:$3 = 97
21-
// gdbr-check:$3 = 97 'a'
11+
// gdbg-command:print/d 'basic_types_globals::C'
12+
// gdbr-command:print/d C
13+
// gdb-check:$3 = 97
2214
// gdbg-command:print/d 'basic_types_globals::I8'
2315
// gdbr-command:print I8
2416
// gdb-check:$4 = 68

src/test/debuginfo/basic-types-metadata.rs

+12-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// min-lldb-version: 310
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// compile-flags:-g
54
// gdb-command:run
@@ -9,8 +8,10 @@
98
// gdb-check:type = bool
109
// gdb-command:whatis i
1110
// gdb-check:type = isize
12-
// gdb-command:whatis c
13-
// gdb-check:type = char
11+
12+
// Note we don't check the 'char' type here, as gdb only got support
13+
// for DW_ATE_UTF in 11.2. This is handled by a different test.
14+
1415
// gdb-command:whatis i8
1516
// gdb-check:type = i8
1617
// gdb-command:whatis i16
@@ -34,31 +35,19 @@
3435
// gdb-command:whatis f64
3536
// gdb-check:type = f64
3637
// gdb-command:whatis fnptr
37-
// gdb-check:type = [...] (*)([...])
38+
// gdb-check:type = [...] ([...])
3839
// gdb-command:info functions _yyy
3940
// gdbg-check:[...]![...]_yyy([...]);
40-
// gdbr-check:static fn basic_types_metadata::_yyy() -> !;
41+
// gdbr-check:static fn basic_types_metadata::_yyy()[...]
42+
43+
// Just check that something is emitted, this changed already once and
44+
// it's not extremely informative.
4145
// gdb-command:ptype closure_0
42-
// gdbr-check: type = struct closure
43-
// gdbg-check: type = struct closure {
44-
// gdbg-check: <no data fields>
45-
// gdbg-check: }
46+
// gdb-check: type = [...]closure[...]
4647
// gdb-command:ptype closure_1
47-
// gdbg-check: type = struct closure {
48-
// gdbg-check: bool *__0;
49-
// gdbg-check: }
50-
// gdbr-check: type = struct closure (
51-
// gdbr-check: bool *,
52-
// gdbr-check: )
48+
// gdb-check: type = [...]closure[...]
5349
// gdb-command:ptype closure_2
54-
// gdbg-check: type = struct closure {
55-
// gdbg-check: bool *__0;
56-
// gdbg-check: isize *__1;
57-
// gdbg-check: }
58-
// gdbr-check: type = struct closure (
59-
// gdbr-check: bool *,
60-
// gdbr-check: isize *,
61-
// gdbr-check: )
50+
// gdb-check: type = [...]closure[...]
6251

6352
//
6453
// gdb-command:continue

src/test/debuginfo/basic-types-mut-globals.rs

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
2-
// as its numerical value along with its associated ASCII char, there
3-
// doesn't seem to be any way around this. Also, gdb doesn't know
4-
// about UTF-32 character encoding and will print a rust char as only
5-
// its numerical value.
6-
71
// min-lldb-version: 310
8-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
92

103
// compile-flags:-g
114

@@ -19,9 +12,8 @@
1912
// gdbr-command:print I
2013
// gdb-check:$2 = -1
2114
// gdbg-command:print/d 'basic_types_mut_globals::C'
22-
// gdbr-command:print C
23-
// gdbg-check:$3 = 97
24-
// gdbr-check:$3 = 97 'a'
15+
// gdbr-command:print/d C
16+
// gdb-check:$3 = 97
2517
// gdbg-command:print/d 'basic_types_mut_globals::I8'
2618
// gdbr-command:print I8
2719
// gdb-check:$4 = 68
@@ -65,9 +57,8 @@
6557
// gdbr-command:print I
6658
// gdb-check:$16 = 2
6759
// gdbg-command:print/d 'basic_types_mut_globals'::C
68-
// gdbr-command:print C
69-
// gdbg-check:$17 = 102
70-
// gdbr-check:$17 = 102 'f'
60+
// gdbr-command:print/d C
61+
// gdb-check:$17 = 102
7162
// gdbg-command:print/d 'basic_types_mut_globals'::I8
7263
// gdbr-command:print/d I8
7364
// gdb-check:$18 = 78

src/test/debuginfo/by-value-non-immediate-argument.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
1+
// ignore-lldb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
22
// min-lldb-version: 310
33

44
// compile-flags:-g

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

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// ignore-aarch64
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32
// min-lldb-version: 310
43

54
// compile-flags:-g

src/test/debuginfo/drop-locations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ignore-windows
22
// ignore-android
3-
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
3+
// ignore-lldb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
44
// min-lldb-version: 310
55

66
#![allow(unused)]

src/test/debuginfo/function-arg-initialization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
1+
// ignore-lldb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
22
// min-lldb-version: 310
33

44
// This test case checks if function arguments already have the correct value

src/test/debuginfo/gdb-char.rs

+8
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,23 @@
99
// gdb-command:run
1010
// gdb-command:print ch
1111
// gdb-check:$1 = 97 'a'
12+
// gdb-command:whatis ch
13+
// gdb-check:type = char
14+
// gdb-command:whatis gdb_char::C
15+
// gdb-check:type = char
1216

1317
#![allow(unused_variables)]
1418
#![feature(omit_gdb_pretty_printer_section)]
1519
#![omit_gdb_pretty_printer_section]
1620

21+
static mut C: char = 'a';
22+
1723
fn main() {
1824
let ch: char = 'a';
1925

2026
zzz(); // #break
27+
28+
let a = unsafe { (C, ) };
2129
}
2230

2331
fn zzz() {()}

src/test/debuginfo/lexical-scopes-in-block-expression.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// min-lldb-version: 310
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// compile-flags:-g
54

src/test/debuginfo/limited-debuginfo.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// ignore-lldb
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// compile-flags:-C debuginfo=1
54

src/test/debuginfo/method-on-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// min-lldb-version: 310
2-
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
2+
// ignore-lldb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
33

44
// compile-flags:-g
55

src/test/debuginfo/option-like-enum.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
1+
// ignore-lldb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
22

33
// min-lldb-version: 310
44

@@ -22,19 +22,19 @@
2222

2323
// gdbg-command:print empty_gdb->discr
2424
// gdbr-command:print empty_gdb.discr
25-
// gdb-check:$4 = (isize *) 0x0
25+
// gdb-check:$4 = (*mut isize) 0x1
2626

2727
// gdb-command:print droid
2828
// gdbg-check:$5 = {RUST$ENCODED$ENUM$2$Void = {id = 675675, range = 10000001, internals = 0x43218765}}
2929
// gdbr-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x43218765}
3030

3131
// gdbg-command:print void_droid_gdb->internals
3232
// gdbr-command:print void_droid_gdb.internals
33-
// gdb-check:$6 = (isize *) 0x0
33+
// gdb-check:$6 = (*mut isize) 0x0
3434

3535
// gdb-command:print nested_non_zero_yep
3636
// gdbg-check:$7 = {RUST$ENCODED$ENUM$1$2$Nope = {__0 = 10.5, __1 = {a = 10, b = 20, c = [...]}}}
37-
// gdbr-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...] "x[...]"})
37+
// gdbr-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...]})
3838

3939
// gdb-command:print nested_non_zero_nope
4040
// gdbg-check:$8 = {RUST$ENCODED$ENUM$1$2$Nope = {__0 = [...], __1 = {a = [...], b = [...], c = 0x0}}}

src/test/debuginfo/simple-struct.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// min-lldb-version: 310
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// compile-flags:-g
54

src/test/debuginfo/simple-tuple.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// min-lldb-version: 310
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// compile-flags:-g
54

src/test/debuginfo/struct-in-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// min-lldb-version: 310
22
// ignore-gdb-version: 7.11.90 - 7.12.9
3-
// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
3+
// ignore-lldb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
44

55
// compile-flags:-g
66

src/test/debuginfo/union-smoke.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// min-lldb-version: 310
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// ignore-gdb-version: 7.11.90 - 7.12.9
54

src/test/debuginfo/vec.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// min-lldb-version: 310
2-
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
32

43
// compile-flags:-g
54

0 commit comments

Comments
 (0)