1 // min-lldb-version: 310
5 // === GDB TESTS ===================================================================================
11 // gdb-command:print b
12 // gdb-check:$2 = false
13 // gdb-command:continue
15 // gdb-command:print a
17 // gdb-command:print b
19 // gdb-command:print c
21 // gdb-command:continue
23 // gdb-command:print a
25 // gdb-command:print b
26 // gdbg-check:$7 = {__0 = 6, __1 = 7}
27 // gdbr-check:$7 = (6, 7)
28 // gdb-command:continue
30 // gdb-command:print h
32 // gdb-command:print i
33 // gdbg-check:$9 = {a = 9, b = 10}
34 // gdbr-check:$9 = destructured_fn_argument::Struct {a: 9, b: 10}
35 // gdb-command:print j
37 // gdb-command:continue
39 // gdb-command:print k
41 // gdb-command:print l
43 // gdb-command:continue
45 // gdb-command:print m
47 // gdb-command:print n
49 // gdb-command:continue
51 // gdb-command:print o
53 // gdb-command:continue
55 // gdb-command:print p
57 // gdb-command:print q
59 // gdb-command:print r
60 // gdbg-check:$18 = {a = 21, b = 22}
61 // gdbr-check:$18 = destructured_fn_argument::Struct {a: 21, b: 22}
62 // gdb-command:continue
64 // gdb-command:print s
66 // gdb-command:print t
68 // gdb-command:continue
70 // gdb-command:print u
72 // gdb-command:print v
74 // gdb-command:print w
76 // gdb-command:print x
78 // gdb-command:print y
80 // gdb-command:print z
82 // gdb-command:print ae
84 // gdb-command:print oe
86 // gdb-command:print ue
88 // gdb-command:continue
90 // gdb-command:print aa
91 // gdbg-check:$30 = {__0 = 34, __1 = 35}
92 // gdbr-check:$30 = (34, 35)
93 // gdb-command:continue
95 // gdb-command:print bb
96 // gdbg-check:$31 = {__0 = 36, __1 = 37}
97 // gdbr-check:$31 = (36, 37)
98 // gdb-command:continue
100 // gdb-command:print cc
101 // gdb-check:$32 = 38
102 // gdb-command:continue
104 // gdb-command:print dd
105 // gdbg-check:$33 = {__0 = 40, __1 = 41, __2 = 42}
106 // gdbr-check:$33 = (40, 41, 42)
107 // gdb-command:continue
109 // gdb-command:print *ee
110 // gdbg-check:$34 = {__0 = 43, __1 = 44, __2 = 45}
111 // gdbr-check:$34 = (43, 44, 45)
112 // gdb-command:continue
114 // gdb-command:print *ff
115 // gdb-check:$35 = 46
116 // gdb-command:print gg
117 // gdbg-check:$36 = {__0 = 47, __1 = 48}
118 // gdbr-check:$36 = (47, 48)
119 // gdb-command:continue
121 // gdb-command:print *hh
122 // gdb-check:$37 = 50
123 // gdb-command:continue
125 // gdb-command:print ii
126 // gdb-check:$38 = 51
127 // gdb-command:continue
129 // gdb-command:print *jj
130 // gdb-check:$39 = 52
131 // gdb-command:continue
133 // gdb-command:print kk
134 // gdb-check:$40 = 53
135 // gdb-command:print ll
136 // gdb-check:$41 = 54
137 // gdb-command:continue
139 // gdb-command:print mm
140 // gdb-check:$42 = 55
141 // gdb-command:print *nn
142 // gdb-check:$43 = 56
143 // gdb-command:continue
145 // gdb-command:print oo
146 // gdb-check:$44 = 57
147 // gdb-command:print pp
148 // gdb-check:$45 = 58
149 // gdb-command:print qq
150 // gdb-check:$46 = 59
151 // gdb-command:continue
153 // gdb-command:print rr
154 // gdb-check:$47 = 60
155 // gdb-command:print ss
156 // gdb-check:$48 = 61
157 // gdb-command:print tt
158 // gdb-check:$49 = 62
159 // gdb-command:continue
162 // === LLDB TESTS ==================================================================================
166 // lldb-command:print a
167 // lldbg-check:[...]$0 = 1
168 // lldbr-check:(isize) a = 1
169 // lldb-command:print b
170 // lldbg-check:[...]$1 = false
171 // lldbr-check:(bool) b = false
172 // lldb-command:continue
174 // lldb-command:print a
175 // lldbg-check:[...]$2 = 2
176 // lldbr-check:(isize) a = 2
177 // lldb-command:print b
178 // lldbg-check:[...]$3 = 3
179 // lldbr-check:(u16) b = 3
180 // lldb-command:print c
181 // lldbg-check:[...]$4 = 4
182 // lldbr-check:(u16) c = 4
183 // lldb-command:continue
185 // lldb-command:print a
186 // lldbg-check:[...]$5 = 5
187 // lldbr-check:(isize) a = 5
188 // lldb-command:print b
189 // lldbg-check:[...]$6 = { 0 = 6 1 = 7 }
190 // lldbr-check:((u32, u32)) b = { 0 = 6 1 = 7 }
191 // lldb-command:continue
193 // lldb-command:print h
194 // lldbg-check:[...]$7 = 8
195 // lldbr-check:(i16) h = 8
196 // lldb-command:print i
197 // lldbg-check:[...]$8 = { a = 9 b = 10 }
198 // lldbr-check:(destructured_fn_argument::Struct) i = { a = 9 b = 10 }
199 // lldb-command:print j
200 // lldbg-check:[...]$9 = 11
201 // lldbr-check:(i16) j = 11
202 // lldb-command:continue
204 // lldb-command:print k
205 // lldbg-check:[...]$10 = 12
206 // lldbr-check:(i64) k = 12
207 // lldb-command:print l
208 // lldbg-check:[...]$11 = 13
209 // lldbr-check:(i32) l = 13
210 // lldb-command:continue
212 // lldb-command:print m
213 // lldbg-check:[...]$12 = 14
214 // lldbr-check:(isize) m = 14
215 // lldb-command:print n
216 // lldbg-check:[...]$13 = 16
217 // lldbr-check:(i32) n = 16
218 // lldb-command:continue
220 // lldb-command:print o
221 // lldbg-check:[...]$14 = 18
222 // lldbr-check:(i32) o = 18
223 // lldb-command:continue
225 // lldb-command:print p
226 // lldbg-check:[...]$15 = 19
227 // lldbr-check:(i64) p = 19
228 // lldb-command:print q
229 // lldbg-check:[...]$16 = 20
230 // lldbr-check:(i32) q = 20
231 // lldb-command:print r
232 // lldbg-check:[...]$17 = { a = 21 b = 22 }
233 // lldbr-check:(destructured_fn_argument::Struct) r = { a = 21, b = 22 }
234 // lldb-command:continue
236 // lldb-command:print s
237 // lldbg-check:[...]$18 = 24
238 // lldbr-check:(i32) s = 24
239 // lldb-command:print t
240 // lldbg-check:[...]$19 = 23
241 // lldbr-check:(i64) t = 23
242 // lldb-command:continue
244 // lldb-command:print u
245 // lldbg-check:[...]$20 = 25
246 // lldbr-check:(i16) u = 25
247 // lldb-command:print v
248 // lldbg-check:[...]$21 = 26
249 // lldbr-check:(i32) v = 26
250 // lldb-command:print w
251 // lldbg-check:[...]$22 = 27
252 // lldbr-check:(i64) w = 27
253 // lldb-command:print x
254 // lldbg-check:[...]$23 = 28
255 // lldbr-check:(i32) x = 28
256 // lldb-command:print y
257 // lldbg-check:[...]$24 = 29
258 // lldbr-check:(i64) y = 29
259 // lldb-command:print z
260 // lldbg-check:[...]$25 = 30
261 // lldbr-check:(i32) z = 30
262 // lldb-command:print ae
263 // lldbg-check:[...]$26 = 31
264 // lldbr-check:(i64) ae = 31
265 // lldb-command:print oe
266 // lldbg-check:[...]$27 = 32
267 // lldbr-check:(i32) oe = 32
268 // lldb-command:print ue
269 // lldbg-check:[...]$28 = 33
270 // lldbr-check:(u16) ue = 33
271 // lldb-command:continue
273 // lldb-command:print aa
274 // lldbg-check:[...]$29 = { 0 = 34 1 = 35 }
275 // lldbr-check:((isize, isize)) aa = { 0 = 34 1 = 35 }
276 // lldb-command:continue
278 // lldb-command:print bb
279 // lldbg-check:[...]$30 = { 0 = 36 1 = 37 }
280 // lldbr-check:((isize, isize)) bb = { 0 = 36 1 = 37 }
281 // lldb-command:continue
283 // lldb-command:print cc
284 // lldbg-check:[...]$31 = 38
285 // lldbr-check:(isize) cc = 38
286 // lldb-command:continue
288 // lldb-command:print dd
289 // lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 }
290 // lldbr-check:((isize, isize, isize)) dd = { 0 = 40 1 = 41 2 = 42 }
291 // lldb-command:continue
293 // lldb-command:print *ee
294 // lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 }
295 // lldbr-check:((isize, isize, isize)) *ee = { 0 = 43 1 = 44 2 = 45 }
296 // lldb-command:continue
298 // lldb-command:print *ff
299 // lldbg-check:[...]$34 = 46
300 // lldbr-check:(isize) *ff = 46
301 // lldb-command:print gg
302 // lldbg-check:[...]$35 = { 0 = 47 1 = 48 }
303 // lldbr-check:((isize, isize)) gg = { 0 = 47 1 = 48 }
304 // lldb-command:continue
306 // lldb-command:print *hh
307 // lldbg-check:[...]$36 = 50
308 // lldbr-check:(i32) *hh = 50
309 // lldb-command:continue
311 // lldb-command:print ii
312 // lldbg-check:[...]$37 = 51
313 // lldbr-check:(i32) ii = 51
314 // lldb-command:continue
316 // lldb-command:print *jj
317 // lldbg-check:[...]$38 = 52
318 // lldbr-check:(i32) *jj = 52
319 // lldb-command:continue
321 // lldb-command:print kk
322 // lldbg-check:[...]$39 = 53
323 // lldbr-check:(f64) kk = 53
324 // lldb-command:print ll
325 // lldbg-check:[...]$40 = 54
326 // lldbr-check:(isize) ll = 54
327 // lldb-command:continue
329 // lldb-command:print mm
330 // lldbg-check:[...]$41 = 55
331 // lldbr-check:(f64) mm = 55
332 // lldb-command:print *nn
333 // lldbg-check:[...]$42 = 56
334 // lldbr-check:(isize) *nn = 56
335 // lldb-command:continue
337 // lldb-command:print oo
338 // lldbg-check:[...]$43 = 57
339 // lldbr-check:(isize) oo = 57
340 // lldb-command:print pp
341 // lldbg-check:[...]$44 = 58
342 // lldbr-check:(isize) pp = 58
343 // lldb-command:print qq
344 // lldbg-check:[...]$45 = 59
345 // lldbr-check:(isize) qq = 59
346 // lldb-command:continue
348 // lldb-command:print rr
349 // lldbg-check:[...]$46 = 60
350 // lldbr-check:(isize) rr = 60
351 // lldb-command:print ss
352 // lldbg-check:[...]$47 = 61
353 // lldbr-check:(isize) ss = 61
354 // lldb-command:print tt
355 // lldbg-check:[...]$48 = 62
356 // lldbr-check:(isize) tt = 62
357 // lldb-command:continue
359 #![allow(unused_variables)]
360 #![feature(box_patterns)]
361 #![feature(omit_gdb_pretty_printer_section)]
362 #![omit_gdb_pretty_printer_section]
364 use self::Univariant::Unit;
375 struct TupleStruct (f64, isize);
378 fn simple_tuple((a, b): (isize, bool)) {
382 fn nested_tuple((a, (b, c)): (isize, (u16, u16))) {
386 fn destructure_only_first_level((a, b): (isize, (u32, u32))) {
390 fn struct_as_tuple_element((h, i, j): (i16, Struct, i16)) {
394 fn struct_pattern(Struct { a: k, b: l }: Struct) {
398 fn ignored_tuple_element((m, _, n): (isize, u16, i32)) {
402 fn ignored_struct_field(Struct { b: o, .. }: Struct) {
406 fn one_struct_destructured_one_not((Struct { a: p, b: q }, r): (Struct, Struct)) {
410 fn different_order_of_struct_fields(Struct { b: s, a: t }: Struct ) {
414 fn complex_nesting(((u, v ), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue ):
415 ((i16, i32), ((i64, (i32, Struct, )), Struct ), u16))
420 fn managed_box(&aa: &(isize, isize)) {
424 fn borrowed_pointer(&bb: &(isize, isize)) {
428 fn contained_borrowed_pointer((&cc, _): (&isize, isize)) {
432 fn unique_pointer(box dd: Box<(isize, isize, isize)>) {
436 fn ref_binding(ref ee: (isize, isize, isize)) {
440 fn ref_binding_in_tuple((ref ff, gg): (isize, (isize, isize))) {
444 fn ref_binding_in_struct(Struct { b: ref hh, .. }: Struct) {
448 fn univariant_enum(Unit(ii): Univariant) {
452 fn univariant_enum_with_ref_binding(Unit(ref jj): Univariant) {
456 fn tuple_struct(TupleStruct(kk, ll): TupleStruct) {
460 fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
464 fn multiple_arguments((oo, pp): (isize, isize), qq : isize) {
469 simple_tuple((1, false));
470 nested_tuple((2, (3, 4)));
471 destructure_only_first_level((5, (6, 7)));
472 struct_as_tuple_element((8, Struct { a: 9, b: 10 }, 11));
473 struct_pattern(Struct { a: 12, b: 13 });
474 ignored_tuple_element((14, 15, 16));
475 ignored_struct_field(Struct { a: 17, b: 18 });
476 one_struct_destructured_one_not((Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 }));
477 different_order_of_struct_fields(Struct { a: 23, b: 24 });
478 complex_nesting(((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33));
479 managed_box(&(34, 35));
480 borrowed_pointer(&(36, 37));
481 contained_borrowed_pointer((&38, 39));
482 unique_pointer(Box::new((40, 41, 42)));
483 ref_binding((43, 44, 45));
484 ref_binding_in_tuple((46, (47, 48)));
485 ref_binding_in_struct(Struct { a: 49, b: 50 });
486 univariant_enum(Unit(51));
487 univariant_enum_with_ref_binding(Unit(52));
488 tuple_struct(TupleStruct(53.0, 54));
489 tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
490 multiple_arguments((57, 58), 59);
492 fn nested_function(rr: isize, (ss, tt): (isize, isize)) {
496 nested_function(60, (61, 62));