]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/evec-in-struct.rs
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / debuginfo / evec-in-struct.rs
1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // min-lldb-version: 310
12
13 // compile-flags:-g
14
15 // === GDB TESTS ===================================================================================
16
17 // gdb-command:run
18
19 // gdb-command:print no_padding1
20 // gdbg-check:$1 = {x = {0, 1, 2}, y = -3, z = {4.5, 5.5}}
21 // gdbr-check:$1 = evec_in_struct::NoPadding1 {x: [0, 1, 2], y: -3, z: [4.5, 5.5]}
22 // gdb-command:print no_padding2
23 // gdbg-check:$2 = {x = {6, 7, 8}, y = {{9, 10}, {11, 12}}}
24 // gdbr-check:$2 = evec_in_struct::NoPadding2 {x: [6, 7, 8], y: [[9, 10], [11, 12]]}
25
26 // gdb-command:print struct_internal_padding
27 // gdbg-check:$3 = {x = {13, 14}, y = {15, 16}}
28 // gdbr-check:$3 = evec_in_struct::StructInternalPadding {x: [13, 14], y: [15, 16]}
29
30 // gdb-command:print single_vec
31 // gdbg-check:$4 = {x = {17, 18, 19, 20, 21}}
32 // gdbr-check:$4 = evec_in_struct::SingleVec {x: [17, 18, 19, 20, 21]}
33
34 // gdb-command:print struct_padded_at_end
35 // gdbg-check:$5 = {x = {22, 23}, y = {24, 25}}
36 // gdbr-check:$5 = evec_in_struct::StructPaddedAtEnd {x: [22, 23], y: [24, 25]}
37
38
39 // === LLDB TESTS ==================================================================================
40
41 // lldb-command:run
42
43 // lldb-command:print no_padding1
44 // lldb-check:[...]$0 = NoPadding1 { x: [0, 1, 2], y: -3, z: [4.5, 5.5] }
45 // lldb-command:print no_padding2
46 // lldb-check:[...]$1 = NoPadding2 { x: [6, 7, 8], y: [[9, 10], [11, 12]] }
47
48 // lldb-command:print struct_internal_padding
49 // lldb-check:[...]$2 = StructInternalPadding { x: [13, 14], y: [15, 16] }
50
51 // lldb-command:print single_vec
52 // lldb-check:[...]$3 = SingleVec { x: [17, 18, 19, 20, 21] }
53
54 // lldb-command:print struct_padded_at_end
55 // lldb-check:[...]$4 = StructPaddedAtEnd { x: [22, 23], y: [24, 25] }
56
57 #![allow(unused_variables)]
58 #![feature(omit_gdb_pretty_printer_section)]
59 #![omit_gdb_pretty_printer_section]
60
61 struct NoPadding1 {
62     x: [u32; 3],
63     y: i32,
64     z: [f32; 2]
65 }
66
67 struct NoPadding2 {
68     x: [u32; 3],
69     y: [[u32; 2]; 2]
70 }
71
72 struct StructInternalPadding {
73     x: [i16; 2],
74     y: [i64; 2]
75 }
76
77 struct SingleVec {
78     x: [i16; 5]
79 }
80
81 struct StructPaddedAtEnd {
82     x: [i64; 2],
83     y: [i16; 2]
84 }
85
86 fn main() {
87
88     let no_padding1 = NoPadding1 {
89         x: [0, 1, 2],
90         y: -3,
91         z: [4.5, 5.5]
92     };
93
94     let no_padding2 = NoPadding2 {
95         x: [6, 7, 8],
96         y: [[9, 10], [11, 12]]
97     };
98
99     let struct_internal_padding = StructInternalPadding {
100         x: [13, 14],
101         y: [15, 16]
102     };
103
104     let single_vec = SingleVec {
105         x: [17, 18, 19, 20, 21]
106     };
107
108     let struct_padded_at_end = StructPaddedAtEnd {
109         x: [22, 23],
110         y: [24, 25]
111     };
112
113     zzz(); // #break
114 }
115
116 fn zzz() { () }