]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/simple-tuple.rs
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / debuginfo / simple-tuple.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 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
13
14 // compile-flags:-g
15
16 // === GDB TESTS ===================================================================================
17
18 // gdbg-command:print/d 'simple_tuple::NO_PADDING_8'
19 // gdbr-command:print simple_tuple::NO_PADDING_8
20 // gdbg-check:$1 = {__0 = -50, __1 = 50}
21 // gdbr-check:$1 = (-50, 50)
22 // gdbg-command:print 'simple_tuple::NO_PADDING_16'
23 // gdbr-command:print simple_tuple::NO_PADDING_16
24 // gdbg-check:$2 = {__0 = -1, __1 = 2, __2 = 3}
25 // gdbr-check:$2 = (-1, 2, 3)
26 // gdbg-command:print 'simple_tuple::NO_PADDING_32'
27 // gdbr-command:print simple_tuple::NO_PADDING_32
28 // gdbg-check:$3 = {__0 = 4, __1 = 5, __2 = 6}
29 // gdbr-check:$3 = (4, 5, 6)
30 // gdbg-command:print 'simple_tuple::NO_PADDING_64'
31 // gdbr-command:print simple_tuple::NO_PADDING_64
32 // gdbg-check:$4 = {__0 = 7, __1 = 8, __2 = 9}
33 // gdbr-check:$4 = (7, 8, 9)
34
35 // gdbg-command:print 'simple_tuple::INTERNAL_PADDING_1'
36 // gdbr-command:print simple_tuple::INTERNAL_PADDING_1
37 // gdbg-check:$5 = {__0 = 10, __1 = 11}
38 // gdbr-check:$5 = (10, 11)
39 // gdbg-command:print 'simple_tuple::INTERNAL_PADDING_2'
40 // gdbr-command:print simple_tuple::INTERNAL_PADDING_2
41 // gdbg-check:$6 = {__0 = 12, __1 = 13, __2 = 14, __3 = 15}
42 // gdbr-check:$6 = (12, 13, 14, 15)
43
44 // gdbg-command:print 'simple_tuple::PADDING_AT_END'
45 // gdbr-command:print simple_tuple::PADDING_AT_END
46 // gdbg-check:$7 = {__0 = 16, __1 = 17}
47 // gdbr-check:$7 = (16, 17)
48
49 // gdb-command:run
50
51 // gdbg-command:print/d noPadding8
52 // gdbr-command:print noPadding8
53 // gdbg-check:$8 = {__0 = -100, __1 = 100}
54 // gdbr-check:$8 = (-100, 100)
55 // gdb-command:print noPadding16
56 // gdbg-check:$9 = {__0 = 0, __1 = 1, __2 = 2}
57 // gdbr-check:$9 = (0, 1, 2)
58 // gdb-command:print noPadding32
59 // gdbg-check:$10 = {__0 = 3, __1 = 4.5, __2 = 5}
60 // gdbr-check:$10 = (3, 4.5, 5)
61 // gdb-command:print noPadding64
62 // gdbg-check:$11 = {__0 = 6, __1 = 7.5, __2 = 8}
63 // gdbr-check:$11 = (6, 7.5, 8)
64
65 // gdb-command:print internalPadding1
66 // gdbg-check:$12 = {__0 = 9, __1 = 10}
67 // gdbr-check:$12 = (9, 10)
68 // gdb-command:print internalPadding2
69 // gdbg-check:$13 = {__0 = 11, __1 = 12, __2 = 13, __3 = 14}
70 // gdbr-check:$13 = (11, 12, 13, 14)
71
72 // gdb-command:print paddingAtEnd
73 // gdbg-check:$14 = {__0 = 15, __1 = 16}
74 // gdbr-check:$14 = (15, 16)
75
76 // gdbg-command:print/d 'simple_tuple::NO_PADDING_8'
77 // gdbr-command:print simple_tuple::NO_PADDING_8
78 // gdbg-check:$15 = {__0 = -127, __1 = 127}
79 // gdbr-check:$15 = (-127, 127)
80 // gdbg-command:print 'simple_tuple::NO_PADDING_16'
81 // gdbr-command:print simple_tuple::NO_PADDING_16
82 // gdbg-check:$16 = {__0 = -10, __1 = 10, __2 = 9}
83 // gdbr-check:$16 = (-10, 10, 9)
84 // gdbg-command:print 'simple_tuple::NO_PADDING_32'
85 // gdbr-command:print simple_tuple::NO_PADDING_32
86 // gdbg-check:$17 = {__0 = 14, __1 = 15, __2 = 16}
87 // gdbr-check:$17 = (14, 15, 16)
88 // gdbg-command:print 'simple_tuple::NO_PADDING_64'
89 // gdbr-command:print simple_tuple::NO_PADDING_64
90 // gdbg-check:$18 = {__0 = 17, __1 = 18, __2 = 19}
91 // gdbr-check:$18 = (17, 18, 19)
92
93 // gdbg-command:print 'simple_tuple::INTERNAL_PADDING_1'
94 // gdbr-command:print simple_tuple::INTERNAL_PADDING_1
95 // gdbg-check:$19 = {__0 = 110, __1 = 111}
96 // gdbr-check:$19 = (110, 111)
97 // gdbg-command:print 'simple_tuple::INTERNAL_PADDING_2'
98 // gdbr-command:print simple_tuple::INTERNAL_PADDING_2
99 // gdbg-check:$20 = {__0 = 112, __1 = 113, __2 = 114, __3 = 115}
100 // gdbr-check:$20 = (112, 113, 114, 115)
101
102 // gdbg-command:print 'simple_tuple::PADDING_AT_END'
103 // gdbr-command:print simple_tuple::PADDING_AT_END
104 // gdbg-check:$21 = {__0 = 116, __1 = 117}
105 // gdbr-check:$21 = (116, 117)
106
107
108 // === LLDB TESTS ==================================================================================
109
110 // lldb-command:run
111
112 // lldb-command:print/d noPadding8
113 // lldb-check:[...]$0 = (-100, 100)
114 // lldb-command:print noPadding16
115 // lldb-check:[...]$1 = (0, 1, 2)
116 // lldb-command:print noPadding32
117 // lldb-check:[...]$2 = (3, 4.5, 5)
118 // lldb-command:print noPadding64
119 // lldb-check:[...]$3 = (6, 7.5, 8)
120
121 // lldb-command:print internalPadding1
122 // lldb-check:[...]$4 = (9, 10)
123 // lldb-command:print internalPadding2
124 // lldb-check:[...]$5 = (11, 12, 13, 14)
125
126 // lldb-command:print paddingAtEnd
127 // lldb-check:[...]$6 = (15, 16)
128
129 #![allow(unused_variables)]
130 #![allow(dead_code)]
131 #![feature(omit_gdb_pretty_printer_section)]
132 #![omit_gdb_pretty_printer_section]
133
134 static mut NO_PADDING_8: (i8, u8) = (-50, 50);
135 static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3);
136
137 static mut NO_PADDING_32: (i32, f32, u32) = (4, 5.0, 6);
138 static mut NO_PADDING_64: (i64, f64, u64) = (7, 8.0, 9);
139
140 static mut INTERNAL_PADDING_1: (i16, i32) = (10, 11);
141 static mut INTERNAL_PADDING_2: (i16, i32, u32, u64) = (12, 13, 14, 15);
142
143 static mut PADDING_AT_END: (i32, i16) = (16, 17);
144
145 fn main() {
146     let noPadding8: (i8, u8) = (-100, 100);
147     let noPadding16: (i16, i16, u16) = (0, 1, 2);
148     let noPadding32: (i32, f32, u32) = (3, 4.5, 5);
149     let noPadding64: (i64, f64, u64) = (6, 7.5, 8);
150
151     let internalPadding1: (i16, i32) = (9, 10);
152     let internalPadding2: (i16, i32, u32, u64) = (11, 12, 13, 14);
153
154     let paddingAtEnd: (i32, i16) = (15, 16);
155
156     unsafe {
157         NO_PADDING_8 = (-127, 127);
158         NO_PADDING_16 = (-10, 10, 9);
159
160         NO_PADDING_32 = (14, 15.0, 16);
161         NO_PADDING_64 = (17, 18.0, 19);
162
163         INTERNAL_PADDING_1 = (110, 111);
164         INTERNAL_PADDING_2 = (112, 113, 114, 115);
165
166         PADDING_AT_END = (116, 117);
167     }
168
169     zzz(); // #break
170 }
171
172 fn zzz() {()}