Skip to content

Commit 875a30c

Browse files
debuginfo: Add test case for destructured for-loop variable.
1 parent 07f1031 commit 875a30c

File tree

1 file changed

+219
-0
lines changed

1 file changed

+219
-0
lines changed
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
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+
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
13+
14+
// compile-flags:-g
15+
16+
// === GDB TESTS ===================================================================================
17+
18+
// gdb-command:run
19+
20+
// DESTRUCTURED STRUCT
21+
// gdb-command:print x
22+
// gdb-check:$1 = 400
23+
// gdb-command:print y
24+
// gdb-check:$2 = 401.5
25+
// gdb-command:print z
26+
// gdb-check:$3 = true
27+
// gdb-command:continue
28+
29+
// DESTRUCTURED TUPLE
30+
// gdb-command:print/x _i8
31+
// gdb-check:$4 = 0x6f
32+
// gdb-command:print/x _u8
33+
// gdb-check:$5 = 0x70
34+
// gdb-command:print _i16
35+
// gdb-check:$6 = -113
36+
// gdb-command:print _u16
37+
// gdb-check:$7 = 114
38+
// gdb-command:print _i32
39+
// gdb-check:$8 = -115
40+
// gdb-command:print _u32
41+
// gdb-check:$9 = 116
42+
// gdb-command:print _i64
43+
// gdb-check:$10 = -117
44+
// gdb-command:print _u64
45+
// gdb-check:$11 = 118
46+
// gdb-command:print _f32
47+
// gdb-check:$12 = 119.5
48+
// gdb-command:print _f64
49+
// gdb-check:$13 = 120.5
50+
// gdb-command:continue
51+
52+
// MORE COMPLEX CASE
53+
// gdb-command:print v1
54+
// gdb-check:$14 = 80000
55+
// gdb-command:print x1
56+
// gdb-check:$15 = 8000
57+
// gdb-command:print *y1
58+
// gdb-check:$16 = 80001.5
59+
// gdb-command:print z1
60+
// gdb-check:$17 = false
61+
// gdb-command:print *x2
62+
// gdb-check:$18 = -30000
63+
// gdb-command:print y2
64+
// gdb-check:$19 = -300001.5
65+
// gdb-command:print *z2
66+
// gdb-check:$20 = true
67+
// gdb-command:print v2
68+
// gdb-check:$21 = 854237.5
69+
// gdb-command:continue
70+
71+
// SIMPLE IDENTIFIER
72+
// gdb-command:print i
73+
// gdb-check:$22 = 1234
74+
// gdb-command:continue
75+
76+
// gdb-command:print simple_struct_ident
77+
// gdb-check:$23 = {x = 3537, y = 35437.5, z = true}
78+
// gdb-command:continue
79+
80+
// gdb-command:print simple_tuple_ident
81+
// gdb-check:$24 = {34903493, 232323}
82+
// gdb-command:continue
83+
84+
// === LLDB TESTS ==================================================================================
85+
86+
// lldb-command:type format add --format hex char
87+
// lldb-command:type format add --format hex 'unsigned char'
88+
89+
// lldb-command:run
90+
91+
// DESTRUCTURED STRUCT
92+
// lldb-command:print x
93+
// lldb-check:[...]$0 = 400
94+
// lldb-command:print y
95+
// lldb-check:[...]$1 = 401.5
96+
// lldb-command:print z
97+
// lldb-check:[...]$2 = true
98+
// lldb-command:continue
99+
100+
// DESTRUCTURED TUPLE
101+
// lldb-command:print _i8
102+
// lldb-check:[...]$3 = 0x6f
103+
// lldb-command:print _u8
104+
// lldb-check:[...]$4 = 0x70
105+
// lldb-command:print _i16
106+
// lldb-check:[...]$5 = -113
107+
// lldb-command:print _u16
108+
// lldb-check:[...]$6 = 114
109+
// lldb-command:print _i32
110+
// lldb-check:[...]$7 = -115
111+
// lldb-command:print _u32
112+
// lldb-check:[...]$8 = 116
113+
// lldb-command:print _i64
114+
// lldb-check:[...]$9 = -117
115+
// lldb-command:print _u64
116+
// lldb-check:[...]$10 = 118
117+
// lldb-command:print _f32
118+
// lldb-check:[...]$11 = 119.5
119+
// lldb-command:print _f64
120+
// lldb-check:[...]$12 = 120.5
121+
// lldb-command:continue
122+
123+
// MORE COMPLEX CASE
124+
// lldb-command:print v1
125+
// lldb-check:[...]$13 = 80000
126+
// lldb-command:print x1
127+
// lldb-check:[...]$14 = 8000
128+
// lldb-command:print *y1
129+
// lldb-check:[...]$15 = 80001.5
130+
// lldb-command:print z1
131+
// lldb-check:[...]$16 = false
132+
// lldb-command:print *x2
133+
// lldb-check:[...]$17 = -30000
134+
// lldb-command:print y2
135+
// lldb-check:[...]$18 = -300001.5
136+
// lldb-command:print *z2
137+
// lldb-check:[...]$19 = true
138+
// lldb-command:print v2
139+
// lldb-check:[...]$20 = 854237.5
140+
// lldb-command:continue
141+
142+
// SIMPLE IDENTIFIER
143+
// lldb-command:print i
144+
// lldb-check:[...]$21 = 1234
145+
// lldb-command:continue
146+
147+
// lldb-command:print simple_struct_ident
148+
// lldb-check:[...]$22 = Struct { x: 3537, y: 35437.5, z: true }
149+
// lldb-command:continue
150+
151+
// lldb-command:print simple_tuple_ident
152+
// lldb-check:[...]$23 = (34903493, 232323)
153+
// lldb-command:continue
154+
155+
struct Struct {
156+
x: i16,
157+
y: f32,
158+
z: bool
159+
}
160+
161+
fn main() {
162+
163+
let s = Struct {
164+
x: 400,
165+
y: 401.5,
166+
z: true
167+
};
168+
169+
for &Struct { x, y, z } in [s].iter() {
170+
zzz(); // #break
171+
}
172+
173+
let tuple: (i8, u8, i16, u16, i32, u32, i64, u64, f32, f64) =
174+
(0x6f, 0x70, -113, 114, -115, 116, -117, 118, 119.5, 120.5);
175+
176+
for &(_i8, _u8, _i16, _u16, _i32, _u32, _i64, _u64, _f32, _f64) in [tuple].iter() {
177+
zzz(); // #break
178+
}
179+
180+
let more_complex: (i32, &Struct, Struct, Box<f64>) =
181+
(80000,
182+
&Struct {
183+
x: 8000,
184+
y: 80001.5,
185+
z: false
186+
},
187+
Struct {
188+
x: -30000,
189+
y: -300001.5,
190+
z: true
191+
},
192+
box 854237.5);
193+
194+
for &(v1,
195+
&Struct { x: x1, y: ref y1, z: z1 },
196+
Struct { x: ref x2, y: y2, z: ref z2 },
197+
box v2) in [more_complex].iter() {
198+
zzz(); // #break
199+
}
200+
201+
for i in range(1234, 1235i) {
202+
zzz(); // #break
203+
}
204+
205+
for simple_struct_ident in
206+
vec![Struct {
207+
x: 3537,
208+
y: 35437.5,
209+
z: true
210+
}].into_iter() {
211+
zzz(); // #break
212+
}
213+
214+
for simple_tuple_ident in vec![(34903493u32, 232323i64)].into_iter() {
215+
zzz(); // #break
216+
}
217+
}
218+
219+
fn zzz() {()}

0 commit comments

Comments
 (0)