Skip to content

Commit de2dd3c

Browse files
committed
WIP: Fix LLDB pretty-printers tests
1 parent 1ddc308 commit de2dd3c

17 files changed

+153
-109
lines changed

src/ci/azure-pipelines/pr.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,25 @@ variables:
2121
- group: public-credentials
2222

2323
jobs:
24-
- job: Linux
24+
- job: macOS
2525
timeoutInMinutes: 600
2626
pool:
27-
vmImage: ubuntu-16.04
27+
vmImage: macos-10.15
2828
steps:
2929
- template: steps/run.yml
3030
strategy:
3131
matrix:
32-
x86_64-gnu-llvm-7: {}
33-
mingw-check: {}
34-
x86_64-gnu-tools:
35-
CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
32+
# OSX builders running tests, these run the full test suite.
33+
# NO_DEBUG_ASSERTIONS=1 to make them go faster, but also do have some
34+
# runners that run `//ignore-debug` tests.
35+
#
36+
# Note that the compiler is compiled to target 10.8 here because the Xcode
37+
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
38+
x86_64-apple:
39+
SCRIPT: ./x.py test
40+
INITIAL_RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
41+
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
42+
MACOSX_DEPLOYMENT_TARGET: 10.8
43+
MACOSX_STD_DEPLOYMENT_TARGET: 10.7
44+
NO_LLVM_ASSERTIONS: 1
45+
NO_DEBUG_ASSERTIONS: 1

src/etc/lldb_commands

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\"
2+
type synthetic add -l lldb_lookup.synthetic_lookup -x \".*\" --category Rust
3+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::(\\w+::)+)String$\" --category Rust
4+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^&str$\" --category Rust
5+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(std::ffi::(\\w+::)+)OsString$\" --category Rust
6+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::(\\w+::)+)Vec<.+>$\" --category Rust
7+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::(\\w+::)+)VecDeque<.+>$\" --category Rust
8+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::(\\w+::)+)BTreeSet<.+>$\" --category Rust
9+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::(\\w+::)+)BTreeMap<.+>$\" --category Rust
10+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(std::collections::(\\w+::)+)HashMap<.+>$\" --category Rust
11+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(std::collections::(\\w+::)+)HashSet<.+>$\" --category Rust
12+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::(\\w+::)+)Rc<.+>$\" --category Rust
13+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(alloc::(\\w+::)+)Arc<.+>$\" --category Rust
14+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(core::(\\w+::)+)Cell<.+>$\" --category Rust
15+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(core::(\\w+::)+)Ref<.+>$\" --category Rust
16+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(core::(\\w+::)+)RefMut<.+>$\" --category Rust
17+
type summary add -F lldb_lookup.summary_lookup -e -x -h \"^(core::(\\w+::)+)RefCell<.+>$\" --category Rust
18+
type category enable Rust

src/etc/rust-lldb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,5 @@ EOF
3030
fi
3131
fi
3232

33-
# Prepare commands that will be loaded before any file on the command line has been loaded
34-
script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\""
35-
synthetic_definition="type synthetic add -l lldb_lookup.synthetic_lookup -x \".*\" --category Rust"
36-
summary_definition="type summary add -F lldb_lookup.summary_lookup -e -x -h \".*\" --category Rust"
37-
category_enable="type category enable Rust"
38-
3933
# Call LLDB with the commands added to the argument list
40-
exec "$lldb" -O "$script_import" -O "$synthetic_definition" -O "$summary_definition" -O "$category_enable" "$@"
34+
exec "$lldb" --source-before-file ./lldb_commands "$@"

src/test/debuginfo/borrowed-struct.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
// lldb-command:run
3636

3737
// lldb-command:print *stack_val_ref
38-
// lldbg-check:[...]$0 = SomeStruct { x: 10, y: 23.5 }
39-
// lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = SomeStruct { x: 10, y: 23.5 }
38+
// lldbg-check:[...]$0 = { x = 10 y = 23.5 }
39+
// lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = (x = 10, y = 23.5)
4040

4141
// lldb-command:print *stack_val_interior_ref_1
4242
// lldbg-check:[...]$1 = 10
@@ -47,12 +47,12 @@
4747
// lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5
4848

4949
// lldb-command:print *ref_to_unnamed
50-
// lldbg-check:[...]$3 = SomeStruct { x: 11, y: 24.5 }
51-
// lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = SomeStruct { x: 11, y: 24.5 }
50+
// lldbg-check:[...]$3 = { x = 11 y = 24.5 }
51+
// lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = (x = 11, y = 24.5)
5252

5353
// lldb-command:print *unique_val_ref
54-
// lldbg-check:[...]$4 = SomeStruct { x: 13, y: 26.5 }
55-
// lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = SomeStruct { x: 13, y: 26.5 }
54+
// lldbg-check:[...]$4 = { x = 13 y = 26.5 }
55+
// lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = (x = 13, y = 26.5)
5656

5757
// lldb-command:print *unique_val_interior_ref_1
5858
// lldbg-check:[...]$5 = 13

src/test/debuginfo/borrowed-tuple.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
// lldb-command:run
2525

2626
// lldb-command:print *stack_val_ref
27-
// lldbg-check:[...]$0 = (-14, -19)
28-
// lldbr-check:((i16, f32)) *stack_val_ref = { = -14 = -19 }
27+
// lldbg-check:[...]$0 = { 0 = -14 1 = -19 }
28+
// lldbr-check:((i16, f32)) *stack_val_ref = { 0 = -14 1 = -19 }
2929

3030
// lldb-command:print *ref_to_unnamed
31-
// lldbg-check:[...]$1 = (-15, -20)
32-
// lldbr-check:((i16, f32)) *ref_to_unnamed = { = -15 = -20 }
31+
// lldbg-check:[...]$1 = { 0 = -15 1 = -20 }
32+
// lldbr-check:((i16, f32)) *ref_to_unnamed = { 0 = -15 1 = -20 }
3333

3434
// lldb-command:print *unique_val_ref
35-
// lldbg-check:[...]$2 = (-17, -22)
36-
// lldbr-check:((i16, f32)) *unique_val_ref = { = -17 = -22 }
35+
// lldbg-check:[...]$2 = { 0 = -17 1 = -22 }
36+
// lldbr-check:((i16, f32)) *unique_val_ref = { 0 = -17 1 = -22 }
3737

3838

3939
#![allow(unused_variables)]

src/test/debuginfo/box.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
// lldbg-check:[...]$0 = 1
2121
// lldbr-check:(i32) *a = 1
2222
// lldb-command:print *b
23-
// lldbg-check:[...]$1 = (2, 3.5)
24-
// lldbr-check:((i32, f64)) *b = { = 2 = 3.5 }
23+
// lldbg-check:[...]$1 = { 0 = 2 1 = 3.5 }
24+
// lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 }
2525

2626
#![allow(unused_variables)]
2727
#![feature(box_syntax)]

src/test/debuginfo/boxed-struct.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
// lldb-command:run
2323

2424
// lldb-command:print *boxed_with_padding
25-
// lldbg-check:[...]$0 = StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 }
26-
// lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 }
25+
// lldbg-check:[...]$0 = { x = 99 y = 999 z = 9999 w = 99999 }
26+
// lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = { x = 99 y = 999 z = 9999 w = 99999 }
2727

2828
// lldb-command:print *boxed_with_dtor
29-
// lldbg-check:[...]$1 = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }
30-
// lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }
29+
// lldbg-check:[...]$1 = { x = 77 y = 777 z = 7777 w = 77777 }
30+
// lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 }
3131

3232
#![allow(unused_variables)]
3333
#![feature(box_syntax)]

src/test/debuginfo/by-value-self-argument-in-trait-impl.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
// lldb-command:continue
3232

3333
// lldb-command:print self
34-
// lldbg-check:[...]$1 = Struct { x: 2222, y: 3333 }
35-
// lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = Struct { x: 2222, y: 3333 }
34+
// lldbg-check:[...]$1 = { x = 2222 y = 3333 }
35+
// lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = { x = 2222 y = 3333 }
3636
// lldb-command:continue
3737

3838
// lldb-command:print self
39-
// lldbg-check:[...]$2 = (4444.5, 5555, 6666, 7777.5)
40-
// lldbr-check:((f64, isize, isize, f64)) self = { = 4444.5 = 5555 = 6666 = 7777.5 }
39+
// lldbg-check:[...] $2 = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 }
40+
// lldbr-check:((f64, isize, isize, f64)) self = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 }
4141
// lldb-command:continue
4242

4343
#![feature(omit_gdb_pretty_printer_section)]

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,32 @@
4040
// lldb-command:run
4141

4242
// lldb-command:print tuple_interior_padding
43-
// lldbg-check:[...]$0 = (0, OneHundred)
44-
// lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { = 0 = c_style_enum_in_composite::AnEnum::OneHundred }
43+
// lldbg-check:[...]$0 = { 0 = 0 1 = OneHundred }
44+
// lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { 0 = 0 1 = OneHundred }
4545

4646
// lldb-command:print tuple_padding_at_end
47-
// lldbg-check:[...]$1 = ((1, OneThousand), 2)
48-
// lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { = { = 1 = c_style_enum_in_composite::AnEnum::OneThousand } = 2 }
47+
// lldbg-check:[...]$1 = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 }
48+
// lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 }
49+
4950
// lldb-command:print tuple_different_enums
50-
// lldbg-check:[...]$2 = (OneThousand, MountainView, OneMillion, Vienna)
51-
// lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { = c_style_enum_in_composite::AnEnum::OneThousand = c_style_enum_in_composite::AnotherEnum::MountainView = c_style_enum_in_composite::AnEnum::OneMillion = c_style_enum_in_composite::AnotherEnum::Vienna }
51+
// lldbg-check:[...]$2 = { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna }
52+
// lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { 0 = c_style_enum_in_composite::AnEnum::OneThousand 1 = c_style_enum_in_composite::AnotherEnum::MountainView 2 = c_style_enum_in_composite::AnEnum::OneMillion 3 = c_style_enum_in_composite::AnotherEnum::Vienna }
5253

5354
// lldb-command:print padded_struct
54-
// lldbg-check:[...]$3 = PaddedStruct { a: 3, b: OneMillion, c: 4, d: Toronto, e: 5 }
55-
// lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = PaddedStruct { a: 3, b: c_style_enum_in_composite::AnEnum::OneMillion, c: 4, d: c_style_enum_in_composite::AnotherEnum::Toronto, e: 5 }
55+
// lldbg-check:[...]$3 = { a = 3 b = OneMillion c = 4 d = Toronto e = 5 }
56+
// lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = { a = 3 b = c_style_enum_in_composite::AnEnum::OneMillion c = 4 d = Toronto e = 5 }
5657

5758
// lldb-command:print packed_struct
58-
// lldbg-check:[...]$4 = PackedStruct { a: 6, b: OneHundred, c: 7, d: Vienna, e: 8 }
59-
// lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = PackedStruct { a: 6, b: c_style_enum_in_composite::AnEnum::OneHundred, c: 7, d: c_style_enum_in_composite::AnotherEnum::Vienna, e: 8 }
59+
// lldbg-check:[...]$4 = { a = 6 b = OneHundred c = 7 d = Vienna e = 8 }
60+
// lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = { a = 6 b = c_style_enum_in_composite::AnEnum::OneHundred c = 7 d = Vienna e = 8 }
6061

6162
// lldb-command:print non_padded_struct
62-
// lldbg-check:[...]$5 = NonPaddedStruct { a: OneMillion, b: MountainView, c: OneThousand, d: Toronto }
63-
// lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = NonPaddedStruct { a: c_style_enum_in_composite::AnEnum::OneMillion, b: c_style_enum_in_composite::AnotherEnum::MountainView, c: c_style_enum_in_composite::AnEnum::OneThousand, d: c_style_enum_in_composite::AnotherEnum::Toronto }
63+
// lldbg-check:[...]$5 = { a = OneMillion b = MountainView c = OneThousand d = Toronto }
64+
// lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = { a = c_style_enum_in_composite::AnEnum::OneMillion, b = c_style_enum_in_composite::AnotherEnum::MountainView, c = c_style_enum_in_composite::AnEnum::OneThousand, d = c_style_enum_in_composite::AnotherEnum::Toronto }
6465

6566
// lldb-command:print struct_with_drop
66-
// lldbg-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9)
67-
// lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { = StructWithDrop { a: c_style_enum_in_composite::AnEnum::OneHundred, b: c_style_enum_in_composite::AnotherEnum::Vienna } = 9 }
67+
// lldbg-check:[...]$6 = { 0 = { a = OneHundred b = Vienna } 1 = 9 }
68+
// lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { 0 = { a = c_style_enum_in_composite::AnEnum::OneHundred b = c_style_enum_in_composite::AnotherEnum::Vienna } 1 = 9 }
6869

6970
#![allow(unused_variables)]
7071
#![feature(omit_gdb_pretty_printer_section)]

src/test/debuginfo/cross-crate-spans.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ extern crate cross_crate_spans;
4444
// lldb-command:run
4545

4646
// lldb-command:print result
47-
// lldbg-check:[...]$0 = (17, 17)
48-
// lldbr-check:((u32, u32)) result = { = 17 = 17 }
47+
// lldbg-check:[...]$0 = { 0 = 17 1 = 17 }
48+
// lldbr-check:((u32, u32)) result = { 0 = 17 1 = 17 }
4949
// lldb-command:print a_variable
5050
// lldbg-check:[...]$1 = 123456789
5151
// lldbr-check:(u32) a_variable = 123456789
@@ -55,8 +55,8 @@ extern crate cross_crate_spans;
5555
// lldb-command:continue
5656

5757
// lldb-command:print result
58-
// lldbg-check:[...]$3 = (1212, 1212)
59-
// lldbr-check:((i16, i16)) result = { = 1212 = 1212 }
58+
// lldbg-check:[...]$3 = { 0 = 1212 1 = 1212 }
59+
// lldbr-check:((i16, i16)) result = { 0 = 1212 1 = 1212 }
6060
// lldb-command:print a_variable
6161
// lldbg-check:[...]$4 = 123456789
6262
// lldbr-check:(u32) a_variable = 123456789

0 commit comments

Comments
 (0)