]> git.proxmox.com Git - rustc.git/blame - tests/debuginfo/packed-struct-with-destructor.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / debuginfo / packed-struct-with-destructor.rs
CommitLineData
1a4d82fc
JJ
1// min-lldb-version: 310
2
3// compile-flags:-g
4
5// === GDB TESTS ===================================================================================
6
7// gdb-command:run
8
9// gdb-command:print packed
c30ab7b3
SL
10// gdbg-check:$1 = {x = 123, y = 234, z = 345}
11// gdbr-check:$1 = packed_struct_with_destructor::Packed {x: 123, y: 234, z: 345}
1a4d82fc
JJ
12
13// gdb-command:print packedInPacked
c30ab7b3
SL
14// gdbg-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
15// gdbr-check:$2 = packed_struct_with_destructor::PackedInPacked {a: 1111, b: packed_struct_with_destructor::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct_with_destructor::Packed {x: 6666, y: 7777, z: 8888}}
1a4d82fc
JJ
16
17// gdb-command:print packedInUnpacked
c30ab7b3
SL
18// gdbg-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
19// gdbr-check:$3 = packed_struct_with_destructor::PackedInUnpacked {a: -1111, b: packed_struct_with_destructor::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct_with_destructor::Packed {x: -6666, y: -7777, z: -8888}}
1a4d82fc
JJ
20
21// gdb-command:print unpackedInPacked
c30ab7b3
SL
22// gdbg-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654}, c = {x = 543, y = 432, z = 321}, d = 210}
23// gdbr-check:$4 = packed_struct_with_destructor::UnpackedInPacked {a: 987, b: packed_struct_with_destructor::Unpacked {x: 876, y: 765, z: 654}, c: packed_struct_with_destructor::Unpacked {x: 543, y: 432, z: 321}, d: 210}
1a4d82fc
JJ
24
25
26// gdb-command:print packedInPackedWithDrop
c30ab7b3
SL
27// gdbg-check:$5 = {a = 11, b = {x = 22, y = 33, z = 44}, c = 55, d = {x = 66, y = 77, z = 88}}
28// gdbr-check:$5 = packed_struct_with_destructor::PackedInPackedWithDrop {a: 11, b: packed_struct_with_destructor::Packed {x: 22, y: 33, z: 44}, c: 55, d: packed_struct_with_destructor::Packed {x: 66, y: 77, z: 88}}
1a4d82fc
JJ
29
30// gdb-command:print packedInUnpackedWithDrop
c30ab7b3
SL
31// gdbg-check:$6 = {a = -11, b = {x = -22, y = -33, z = -44}, c = -55, d = {x = -66, y = -77, z = -88}}
32// gdbr-check:$6 = packed_struct_with_destructor::PackedInUnpackedWithDrop {a: -11, b: packed_struct_with_destructor::Packed {x: -22, y: -33, z: -44}, c: -55, d: packed_struct_with_destructor::Packed {x: -66, y: -77, z: -88}}
1a4d82fc
JJ
33
34// gdb-command:print unpackedInPackedWithDrop
c30ab7b3
SL
35// gdbg-check:$7 = {a = 98, b = {x = 87, y = 76, z = 65}, c = {x = 54, y = 43, z = 32}, d = 21}
36// gdbr-check:$7 = packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 98, b: packed_struct_with_destructor::Unpacked {x: 87, y: 76, z: 65}, c: packed_struct_with_destructor::Unpacked {x: 54, y: 43, z: 32}, d: 21}
1a4d82fc
JJ
37
38// gdb-command:print deeplyNested
c30ab7b3
SL
39// gdbg-check:$8 = {a = {a = 1, b = {x = 2, y = 3, z = 4}, c = 5, d = {x = 6, y = 7, z = 8}}, b = {a = 9, b = {x = 10, y = 11, z = 12}, c = {x = 13, y = 14, z = 15}, d = 16}, c = {a = 17, b = {x = 18, y = 19, z = 20}, c = 21, d = {x = 22, y = 23, z = 24}}, d = {a = 25, b = {x = 26, y = 27, z = 28}, c = 29, d = {x = 30, y = 31, z = 32}}, e = {a = 33, b = {x = 34, y = 35, z = 36}, c = {x = 37, y = 38, z = 39}, d = 40}, f = {a = 41, b = {x = 42, y = 43, z = 44}, c = 45, d = {x = 46, y = 47, z = 48}}}
40// gdbr-check:$8 = packed_struct_with_destructor::DeeplyNested {a: packed_struct_with_destructor::PackedInPacked {a: 1, b: packed_struct_with_destructor::Packed {x: 2, y: 3, z: 4}, c: 5, d: packed_struct_with_destructor::Packed {x: 6, y: 7, z: 8}}, b: packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 9, b: packed_struct_with_destructor::Unpacked {x: 10, y: 11, z: 12}, c: packed_struct_with_destructor::Unpacked {x: 13, y: 14, z: 15}, d: 16}, c: packed_struct_with_destructor::PackedInUnpacked {a: 17, b: packed_struct_with_destructor::Packed {x: 18, y: 19, z: 20}, c: 21, d: packed_struct_with_destructor::Packed {x: 22, y: 23, z: 24}}, d: packed_struct_with_destructor::PackedInUnpackedWithDrop {a: 25, b: packed_struct_with_destructor::Packed {x: 26, y: 27, z: 28}, c: 29, d: packed_struct_with_destructor::Packed {x: 30, y: 31, z: 32}}, e: packed_struct_with_destructor::UnpackedInPacked {a: 33, b: packed_struct_with_destructor::Unpacked {x: 34, y: 35, z: 36}, c: packed_struct_with_destructor::Unpacked {x: 37, y: 38, z: 39}, d: 40}, f: packed_struct_with_destructor::PackedInPackedWithDrop {a: 41, b: packed_struct_with_destructor::Packed {x: 42, y: 43, z: 44}, c: 45, d: packed_struct_with_destructor::Packed {x: 46, y: 47, z: 48}}}
1a4d82fc
JJ
41
42
43// === LLDB TESTS ==================================================================================
44
45// lldb-command:run
46
47// lldb-command:print packed
f035d41b
XL
48// lldbg-check:[...]$0 = { x = 123 y = 234 z = 345 }
49// lldbr-check:(packed_struct_with_destructor::Packed) packed = { x = 123 y = 234 z = 345 }
1a4d82fc
JJ
50
51// lldb-command:print packedInPacked
f035d41b
XL
52// lldbg-check:[...]$1 = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
53// lldbr-check:(packed_struct_with_destructor::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
1a4d82fc
JJ
54
55// lldb-command:print packedInUnpacked
f035d41b
XL
56// lldbg-check:[...]$2 = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
57// lldbr-check:(packed_struct_with_destructor::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
1a4d82fc
JJ
58
59// lldb-command:print unpackedInPacked
f035d41b
XL
60// lldbg-check:[...]$3 = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 }
61// lldbr-check:(packed_struct_with_destructor::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 }
1a4d82fc
JJ
62
63// lldb-command:print packedInPackedWithDrop
f035d41b
XL
64// lldbg-check:[...]$4 = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } }
65// lldbr-check:(packed_struct_with_destructor::PackedInPackedWithDrop) packedInPackedWithDrop = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } }
1a4d82fc
JJ
66
67// lldb-command:print packedInUnpackedWithDrop
f035d41b
XL
68// lldbg-check:[...]$5 = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } }
69// lldbr-check:(packed_struct_with_destructor::PackedInUnpackedWithDrop) packedInUnpackedWithDrop = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } }
1a4d82fc
JJ
70
71// lldb-command:print unpackedInPackedWithDrop
f035d41b
XL
72// lldbg-check:[...]$6 = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 }
73// lldbr-check:(packed_struct_with_destructor::UnpackedInPackedWithDrop) unpackedInPackedWithDrop = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 }
1a4d82fc
JJ
74
75// lldb-command:print deeplyNested
f035d41b
XL
76// lldbg-check:[...]$7 = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } }
77// lldbr-check:(packed_struct_with_destructor::DeeplyNested) deeplyNested = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } }
1a4d82fc
JJ
78
79
80#![allow(unused_variables)]
b039eaaf 81#![feature(omit_gdb_pretty_printer_section)]
1a4d82fc
JJ
82#![omit_gdb_pretty_printer_section]
83
84#[repr(packed)]
85struct Packed {
86 x: i16,
87 y: i32,
88 z: i64
89}
90
91impl Drop for Packed {
92 fn drop(&mut self) {}
93}
94
95#[repr(packed)]
96struct PackedInPacked {
97 a: i32,
98 b: Packed,
99 c: i64,
100 d: Packed
101}
102
103struct PackedInUnpacked {
104 a: i32,
105 b: Packed,
106 c: i64,
107 d: Packed
108}
109
110struct Unpacked {
111 x: i64,
112 y: i32,
113 z: i16
114}
115
116impl Drop for Unpacked {
117 fn drop(&mut self) {}
118}
119
120#[repr(packed)]
121struct UnpackedInPacked {
122 a: i16,
123 b: Unpacked,
124 c: Unpacked,
125 d: i64
126}
127
128#[repr(packed)]
129struct PackedInPackedWithDrop {
130 a: i32,
131 b: Packed,
132 c: i64,
133 d: Packed
134}
135
136impl Drop for PackedInPackedWithDrop {
137 fn drop(&mut self) {}
138}
139
140struct PackedInUnpackedWithDrop {
141 a: i32,
142 b: Packed,
143 c: i64,
144 d: Packed
145}
146
147impl Drop for PackedInUnpackedWithDrop {
148 fn drop(&mut self) {}
149}
150
151#[repr(packed)]
152struct UnpackedInPackedWithDrop {
153 a: i16,
154 b: Unpacked,
155 c: Unpacked,
156 d: i64
157}
158
159impl Drop for UnpackedInPackedWithDrop {
160 fn drop(&mut self) {}
161}
162
163struct DeeplyNested {
164 a: PackedInPacked,
165 b: UnpackedInPackedWithDrop,
166 c: PackedInUnpacked,
167 d: PackedInUnpackedWithDrop,
168 e: UnpackedInPacked,
169 f: PackedInPackedWithDrop
170}
171
172fn main() {
173 let packed = Packed { x: 123, y: 234, z: 345 };
174
175 let packedInPacked = PackedInPacked {
176 a: 1111,
177 b: Packed { x: 2222, y: 3333, z: 4444 },
178 c: 5555,
179 d: Packed { x: 6666, y: 7777, z: 8888 }
180 };
181
182 let packedInUnpacked = PackedInUnpacked {
183 a: -1111,
184 b: Packed { x: -2222, y: -3333, z: -4444 },
185 c: -5555,
186 d: Packed { x: -6666, y: -7777, z: -8888 }
187 };
188
189 let unpackedInPacked = UnpackedInPacked {
190 a: 987,
191 b: Unpacked { x: 876, y: 765, z: 654 },
192 c: Unpacked { x: 543, y: 432, z: 321 },
193 d: 210
194 };
195
196 let packedInPackedWithDrop = PackedInPackedWithDrop {
197 a: 11,
198 b: Packed { x: 22, y: 33, z: 44 },
199 c: 55,
200 d: Packed { x: 66, y: 77, z: 88 }
201 };
202
203 let packedInUnpackedWithDrop = PackedInUnpackedWithDrop {
204 a: -11,
205 b: Packed { x: -22, y: -33, z: -44 },
206 c: -55,
207 d: Packed { x: -66, y: -77, z: -88 }
208 };
209
210 let unpackedInPackedWithDrop = UnpackedInPackedWithDrop {
211 a: 98,
212 b: Unpacked { x: 87, y: 76, z: 65 },
213 c: Unpacked { x: 54, y: 43, z: 32 },
214 d: 21
215 };
216
217 let deeplyNested = DeeplyNested {
218 a: PackedInPacked {
219 a: 1,
220 b: Packed { x: 2, y: 3, z: 4 },
221 c: 5,
222 d: Packed { x: 6, y: 7, z: 8 }
223 },
224 b: UnpackedInPackedWithDrop {
225 a: 9,
226 b: Unpacked { x: 10, y: 11, z: 12 },
227 c: Unpacked { x: 13, y: 14, z: 15 },
228 d: 16
229 },
230 c: PackedInUnpacked {
231 a: 17,
232 b: Packed { x: 18, y: 19, z: 20 },
233 c: 21,
234 d: Packed { x: 22, y: 23, z: 24 }
235 },
236 d: PackedInUnpackedWithDrop {
237 a: 25,
238 b: Packed { x: 26, y: 27, z: 28 },
239 c: 29,
240 d: Packed { x: 30, y: 31, z: 32 }
241 },
242 e: UnpackedInPacked {
243 a: 33,
244 b: Unpacked { x: 34, y: 35, z: 36 },
245 c: Unpacked { x: 37, y: 38, z: 39 },
246 d: 40
247 },
248 f: PackedInPackedWithDrop {
249 a: 41,
250 b: Packed { x: 42, y: 43, z: 44 },
251 c: 45,
252 d: Packed { x: 46, y: 47, z: 48 }
253 }
254 };
255
256 zzz(); // #break
257}
258
259fn zzz() {()}