Skip to content

Commit 26702da

Browse files
committed
Update enum debuginfo tests
Bug #52452 notes some debuginfo test regressions when moving to gdb 8.1. This series will also cause versions of gdb before 8.2 to fail when a recent LLVM is used -- DW_TAG_variant_part support was not added until 8.2. This patch updates one of the builders to a later version of Ubuntu, and then arranges to install gdb 8.2 from the toolchain PPA. It updates the relevant tests to require both a new-enough LLVM and a new-enough gdb; the subsequent patch arranges to continue testing the fallback mode. The "gdbg" results are removed from these tests because the tests now require a rust-enabled gdb.
1 parent 03dc323 commit 26702da

10 files changed

+61
-71
lines changed

src/ci/docker/x86_64-gnu/Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:16.04
1+
FROM ubuntu:18.04
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
g++ \
@@ -9,10 +9,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
99
python2.7 \
1010
git \
1111
cmake \
12+
software-properties-common \
1213
sudo \
13-
gdb \
1414
xz-utils
1515

16+
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && \
17+
apt-get update && \
18+
apt-get install -y --no-install-recommends gdb
19+
1620
COPY scripts/sccache.sh /scripts/
1721
RUN sh /scripts/sccache.sh
1822

src/test/debuginfo/borrowed-enum.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
// ignore-tidy-linelength
1212
// min-lldb-version: 310
13-
// ignore-gdb-version: 7.11.90 - 7.12.9
13+
14+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
15+
// min-system-llvm-version: 7.0
16+
// min-gdb-version: 8.2
1417

1518
// compile-flags:-g
1619

@@ -19,15 +22,12 @@
1922
// gdb-command:run
2023

2124
// gdb-command:print *the_a_ref
22-
// gdbg-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, [...]}}
2325
// gdbr-check:$1 = borrowed_enum::ABC::TheA{x: 0, y: 8970181431921507452}
2426

2527
// gdb-command:print *the_b_ref
26-
// gdbg-check:$2 = {{RUST$ENUM$DISR = TheB, [...]}, {RUST$ENUM$DISR = TheB, __0 = 0, __1 = 286331153, __2 = 286331153}}
2728
// gdbr-check:$2 = borrowed_enum::ABC::TheB(0, 286331153, 286331153)
2829

2930
// gdb-command:print *univariant_ref
30-
// gdbg-check:$3 = {{__0 = 4820353753753434}}
3131
// gdbr-check:$3 = borrowed_enum::Univariant::TheOnlyCase(4820353753753434)
3232

3333

src/test/debuginfo/generic-enum-with-different-disr-sizes.rs

+12-16
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,39 @@
1212
// ignore-lldb: FIXME(#27089)
1313
// min-lldb-version: 310
1414

15+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
16+
// min-system-llvm-version: 7.0
17+
// min-gdb-version: 8.2
18+
1519
// compile-flags:-g
1620

1721
// === GDB TESTS ===================================================================================
1822
// gdb-command:run
1923

2024
// gdb-command:print eight_bytes1
21-
// gdbg-check:$1 = {{RUST$ENUM$DISR = Variant1, __0 = 100}, {RUST$ENUM$DISR = Variant1, __0 = 100}}
22-
// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum::Variant1(100)
25+
// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100)
2326

2427
// gdb-command:print four_bytes1
25-
// gdbg-check:$2 = {{RUST$ENUM$DISR = Variant1, __0 = 101}, {RUST$ENUM$DISR = Variant1, __0 = 101}}
26-
// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum::Variant1(101)
28+
// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101)
2729

2830
// gdb-command:print two_bytes1
29-
// gdbg-check:$3 = {{RUST$ENUM$DISR = Variant1, __0 = 102}, {RUST$ENUM$DISR = Variant1, __0 = 102}}
30-
// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum::Variant1(102)
31+
// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102)
3132

3233
// gdb-command:print one_byte1
33-
// gdbg-check:$4 = {{RUST$ENUM$DISR = Variant1, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant1, __0 = 65 'A'}}
34-
// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum::Variant1(65)
34+
// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65)
3535

3636

3737
// gdb-command:print eight_bytes2
38-
// gdbg-check:$5 = {{RUST$ENUM$DISR = Variant2, __0 = 100}, {RUST$ENUM$DISR = Variant2, __0 = 100}}
39-
// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum::Variant2(100)
38+
// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100)
4039

4140
// gdb-command:print four_bytes2
42-
// gdbg-check:$6 = {{RUST$ENUM$DISR = Variant2, __0 = 101}, {RUST$ENUM$DISR = Variant2, __0 = 101}}
43-
// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum::Variant2(101)
41+
// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101)
4442

4543
// gdb-command:print two_bytes2
46-
// gdbg-check:$7 = {{RUST$ENUM$DISR = Variant2, __0 = 102}, {RUST$ENUM$DISR = Variant2, __0 = 102}}
47-
// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum::Variant2(102)
44+
// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102)
4845

4946
// gdb-command:print one_byte2
50-
// gdbg-check:$8 = {{RUST$ENUM$DISR = Variant2, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant2, __0 = 65 'A'}}
51-
// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum::Variant2(65)
47+
// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65)
5248

5349
// gdb-command:continue
5450

src/test/debuginfo/generic-struct-style-enum.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,26 @@
1010

1111
// ignore-tidy-linelength
1212
// min-lldb-version: 310
13-
// ignore-gdb-version: 7.11.90 - 7.12.9
13+
14+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
15+
// min-system-llvm-version: 7.0
16+
// min-gdb-version: 8.2
1417

1518
// compile-flags:-g
1619

1720
// gdb-command:set print union on
1821
// gdb-command:run
1922

2023
// gdb-command:print case1
21-
// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
22-
// gdbr-check:$1 = generic_struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
24+
// gdbr-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
2325

2426
// gdb-command:print case2
25-
// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
26-
// gdbr-check:$2 = generic_struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
27+
// gdbr-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153}
2728

2829
// gdb-command:print case3
29-
// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
30-
// gdbr-check:$3 = generic_struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
30+
// gdbr-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897}
3131

3232
// gdb-command:print univariant
33-
// gdbg-check:$4 = {{a = -1}}
3433
// gdbr-check:$4 = generic_struct_style_enum::Univariant<i32>::TheOnlyCase{a: -1}
3534

3635

src/test/debuginfo/generic-tuple-style-enum.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
// ignore-tidy-linelength
1212
// min-lldb-version: 310
13-
// ignore-gdb-version: 7.11.90 - 7.12.9
13+
14+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
15+
// min-system-llvm-version: 7.0
16+
// min-gdb-version: 8.2
1417

1518
// compile-flags:-g
1619

@@ -20,19 +23,15 @@
2023
// gdb-command:run
2124

2225
// gdb-command:print case1
23-
// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
24-
// gdbr-check:$1 = generic_tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
26+
// gdbr-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868)
2527

2628
// gdb-command:print case2
27-
// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
28-
// gdbr-check:$2 = generic_tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
29+
// gdbr-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153)
2930

3031
// gdb-command:print case3
31-
// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
32-
// gdbr-check:$3 = generic_tuple_style_enum::Regular::Case3(0, 6438275382588823897)
32+
// gdbr-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897)
3333

3434
// gdb-command:print univariant
35-
// gdbg-check:$4 = {{__0 = -1}}
3635
// gdbr-check:$4 = generic_tuple_style_enum::Univariant<i64>::TheOnlyCase(-1)
3736

3837

src/test/debuginfo/nil-enum.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@
1212
// ignore-lldb
1313

1414

15+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
16+
// gdb 8.2.0 crashes on this test case, see
17+
// https://sourceware.org/bugzilla/show_bug.cgi?id=23626
18+
// This will be fixed in the next release, which will be >= 8.2.1.
19+
// min-system-llvm-version: 7.0
20+
// min-gdb-version: 8.2.1
21+
1522
// compile-flags:-g
1623
// gdb-command:run
1724

1825
// gdb-command:print first
19-
// gdbg-check:$1 = {<No data fields>}
20-
// gdbr-check:$1 = <error reading variable>
26+
// gdbr-check:$1 = nil_enum::ANilEnum {<No data fields>}
2127

2228
// gdb-command:print second
23-
// gdbg-check:$2 = {<No data fields>}
24-
// gdbr-check:$2 = <error reading variable>
29+
// gdbr-check:$2 = nil_enum::AnotherNilEnum {<No data fields>}
2530

2631
#![allow(unused_variables)]
2732
#![feature(omit_gdb_pretty_printer_section)]

src/test/debuginfo/recursive-struct.rs

+4-15
Original file line numberDiff line numberDiff line change
@@ -10,74 +10,63 @@
1010

1111
// ignore-tidy-linelength
1212
// ignore-lldb
13-
// ignore-gdb-version: 7.11.90 - 7.12.9
13+
14+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
15+
// min-system-llvm-version: 7.0
16+
// min-gdb-version: 8.2
1417

1518
// compile-flags:-g
1619

1720
// gdb-command:run
1821

1922
// gdb-command:print stack_unique.value
2023
// gdb-check:$1 = 0
21-
// gdbg-command:print stack_unique.next.RUST$ENCODED$ENUM$0$Empty.val->value
2224
// gdbr-command:print stack_unique.next.val.value
2325
// gdb-check:$2 = 1
2426

25-
// gdbg-command:print unique_unique->value
2627
// gdbr-command:print unique_unique.value
2728
// gdb-check:$3 = 2
28-
// gdbg-command:print unique_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value
2929
// gdbr-command:print unique_unique.next.val.value
3030
// gdb-check:$4 = 3
3131

3232
// gdb-command:print vec_unique[0].value
3333
// gdb-check:$5 = 6.5
34-
// gdbg-command:print vec_unique[0].next.RUST$ENCODED$ENUM$0$Empty.val->value
3534
// gdbr-command:print vec_unique[0].next.val.value
3635
// gdb-check:$6 = 7.5
3736

38-
// gdbg-command:print borrowed_unique->value
3937
// gdbr-command:print borrowed_unique.value
4038
// gdb-check:$7 = 8.5
41-
// gdbg-command:print borrowed_unique->next.RUST$ENCODED$ENUM$0$Empty.val->value
4239
// gdbr-command:print borrowed_unique.next.val.value
4340
// gdb-check:$8 = 9.5
4441

4542
// LONG CYCLE
4643
// gdb-command:print long_cycle1.value
4744
// gdb-check:$9 = 20
48-
// gdbg-command:print long_cycle1.next->value
4945
// gdbr-command:print long_cycle1.next.value
5046
// gdb-check:$10 = 21
51-
// gdbg-command:print long_cycle1.next->next->value
5247
// gdbr-command:print long_cycle1.next.next.value
5348
// gdb-check:$11 = 22
54-
// gdbg-command:print long_cycle1.next->next->next->value
5549
// gdbr-command:print long_cycle1.next.next.next.value
5650
// gdb-check:$12 = 23
5751

5852
// gdb-command:print long_cycle2.value
5953
// gdb-check:$13 = 24
60-
// gdbg-command:print long_cycle2.next->value
6154
// gdbr-command:print long_cycle2.next.value
6255
// gdb-check:$14 = 25
63-
// gdbg-command:print long_cycle2.next->next->value
6456
// gdbr-command:print long_cycle2.next.next.value
6557
// gdb-check:$15 = 26
6658

6759
// gdb-command:print long_cycle3.value
6860
// gdb-check:$16 = 27
69-
// gdbg-command:print long_cycle3.next->value
7061
// gdbr-command:print long_cycle3.next.value
7162
// gdb-check:$17 = 28
7263

7364
// gdb-command:print long_cycle4.value
7465
// gdb-check:$18 = 29.5
7566

76-
// gdbg-command:print (*****long_cycle_w_anonymous_types).value
7767
// gdbr-command:print long_cycle_w_anonymous_types.value
7868
// gdb-check:$19 = 30
7969

80-
// gdbg-command:print (*****((*****long_cycle_w_anonymous_types).next.RUST$ENCODED$ENUM$0$Empty.val)).value
8170
// gdbr-command:print long_cycle_w_anonymous_types.next.val.value
8271
// gdb-check:$20 = 31
8372

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
// ignore-tidy-linelength
1212
// min-lldb-version: 310
13-
// ignore-gdb-version: 7.11.90 - 7.12.9
13+
14+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
15+
// min-system-llvm-version: 7.0
16+
// min-gdb-version: 8.2
1417

1518
// compile-flags:-g
1619

@@ -20,19 +23,15 @@
2023
// gdb-command:run
2124

2225
// gdb-command:print case1
23-
// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
2426
// gdbr-check:$1 = struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
2527

2628
// gdb-command:print case2
27-
// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
2829
// gdbr-check:$2 = struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
2930

3031
// gdb-command:print case3
31-
// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
3232
// gdbr-check:$3 = struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
3333

3434
// gdb-command:print univariant
35-
// gdbg-check:$4 = {{a = -1}}
3635
// gdbr-check:$4 = struct_style_enum::Univariant::TheOnlyCase{a: -1}
3736

3837

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
// ignore-tidy-linelength
1212
// min-lldb-version: 310
13-
// ignore-gdb-version: 7.11.90 - 7.12.9
13+
14+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
15+
// min-system-llvm-version: 7.0
16+
// min-gdb-version: 8.2
1417

1518
// compile-flags:-g
1619

@@ -20,19 +23,15 @@
2023
// gdb-command:run
2124

2225
// gdb-command:print case1
23-
// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
2426
// gdbr-check:$1 = tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
2527

2628
// gdb-command:print case2
27-
// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
2829
// gdbr-check:$2 = tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
2930

3031
// gdb-command:print case3
31-
// gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
3232
// gdbr-check:$3 = tuple_style_enum::Regular::Case3(0, 6438275382588823897)
3333

3434
// gdb-command:print univariant
35-
// gdbg-check:$4 = {{__0 = -1}}
3635
// gdbr-check:$4 = tuple_style_enum::Univariant::TheOnlyCase(-1)
3736

3837

src/test/debuginfo/unique-enum.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
// ignore-tidy-linelength
1212
// min-lldb-version: 310
13-
// ignore-gdb-version: 7.11.90 - 7.12.9
13+
14+
// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
15+
// min-system-llvm-version: 7.0
16+
// min-gdb-version: 8.2
1417

1518
// compile-flags:-g
1619

@@ -19,15 +22,12 @@
1922
// gdb-command:run
2023

2124
// gdb-command:print *the_a
22-
// gdbg-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, [...]}}
2325
// gdbr-check:$1 = unique_enum::ABC::TheA{x: 0, y: 8970181431921507452}
2426

2527
// gdb-command:print *the_b
26-
// gdbg-check:$2 = {{RUST$ENUM$DISR = TheB, [...]}, {RUST$ENUM$DISR = TheB, __0 = 0, __1 = 286331153, __2 = 286331153}}
2728
// gdbr-check:$2 = unique_enum::ABC::TheB(0, 286331153, 286331153)
2829

2930
// gdb-command:print *univariant
30-
// gdbg-check:$3 = {{__0 = 123234}}
3131
// gdbr-check:$3 = unique_enum::Univariant::TheOnlyCase(123234)
3232

3333

0 commit comments

Comments
 (0)