]> git.proxmox.com Git - rustc.git/blame - src/test/debuginfo/lexical-scope-in-if.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / debuginfo / lexical-scope-in-if.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// BEFORE if
10// gdb-command:print x
11// gdb-check:$1 = 999
12// gdb-command:print y
13// gdb-check:$2 = -1
14// gdb-command:continue
15
16// AT BEGINNING of 'then' block
17// gdb-command:print x
18// gdb-check:$3 = 999
19// gdb-command:print y
20// gdb-check:$4 = -1
21// gdb-command:continue
22
23// AFTER 1st redeclaration of 'x'
24// gdb-command:print x
25// gdb-check:$5 = 1001
26// gdb-command:print y
27// gdb-check:$6 = -1
28// gdb-command:continue
29
30// AFTER 2st redeclaration of 'x'
31// gdb-command:print x
32// gdb-check:$7 = 1002
33// gdb-command:print y
34// gdb-check:$8 = 1003
35// gdb-command:continue
36
37// AFTER 1st if expression
38// gdb-command:print x
39// gdb-check:$9 = 999
40// gdb-command:print y
41// gdb-check:$10 = -1
42// gdb-command:continue
43
44// BEGINNING of else branch
45// gdb-command:print x
46// gdb-check:$11 = 999
47// gdb-command:print y
48// gdb-check:$12 = -1
49// gdb-command:continue
50
51// BEGINNING of else branch
52// gdb-command:print x
53// gdb-check:$13 = 1004
54// gdb-command:print y
55// gdb-check:$14 = 1005
56// gdb-command:continue
57
58// BEGINNING of else branch
59// gdb-command:print x
60// gdb-check:$15 = 999
61// gdb-command:print y
62// gdb-check:$16 = -1
63// gdb-command:continue
64
65
66// === LLDB TESTS ==================================================================================
67
68// lldb-command:run
69
70// BEFORE if
71// lldb-command:print x
0bf4aa26
XL
72// lldbg-check:[...]$0 = 999
73// lldbr-check:(i32) x = 999
1a4d82fc 74// lldb-command:print y
0bf4aa26
XL
75// lldbg-check:[...]$1 = -1
76// lldbr-check:(i32) y = -1
1a4d82fc
JJ
77// lldb-command:continue
78
79// AT BEGINNING of 'then' block
80// lldb-command:print x
0bf4aa26
XL
81// lldbg-check:[...]$2 = 999
82// lldbr-check:(i32) x = 999
1a4d82fc 83// lldb-command:print y
0bf4aa26
XL
84// lldbg-check:[...]$3 = -1
85// lldbr-check:(i32) y = -1
1a4d82fc
JJ
86// lldb-command:continue
87
88// AFTER 1st redeclaration of 'x'
89// lldb-command:print x
0bf4aa26
XL
90// lldbg-check:[...]$4 = 1001
91// lldbr-check:(i32) x = 1001
1a4d82fc 92// lldb-command:print y
0bf4aa26
XL
93// lldbg-check:[...]$5 = -1
94// lldbr-check:(i32) y = -1
1a4d82fc
JJ
95// lldb-command:continue
96
97// AFTER 2st redeclaration of 'x'
98// lldb-command:print x
0bf4aa26
XL
99// lldbg-check:[...]$6 = 1002
100// lldbr-check:(i32) x = 1002
1a4d82fc 101// lldb-command:print y
0bf4aa26
XL
102// lldbg-check:[...]$7 = 1003
103// lldbr-check:(i32) y = 1003
1a4d82fc
JJ
104// lldb-command:continue
105
106// AFTER 1st if expression
107// lldb-command:print x
0bf4aa26
XL
108// lldbg-check:[...]$8 = 999
109// lldbr-check:(i32) x = 999
1a4d82fc 110// lldb-command:print y
0bf4aa26
XL
111// lldbg-check:[...]$9 = -1
112// lldbr-check:(i32) y = -1
1a4d82fc
JJ
113// lldb-command:continue
114
115// BEGINNING of else branch
116// lldb-command:print x
0bf4aa26
XL
117// lldbg-check:[...]$10 = 999
118// lldbr-check:(i32) x = 999
1a4d82fc 119// lldb-command:print y
0bf4aa26
XL
120// lldbg-check:[...]$11 = -1
121// lldbr-check:(i32) y = -1
1a4d82fc
JJ
122// lldb-command:continue
123
124// BEGINNING of else branch
125// lldb-command:print x
0bf4aa26
XL
126// lldbg-check:[...]$12 = 1004
127// lldbr-check:(i32) x = 1004
1a4d82fc 128// lldb-command:print y
0bf4aa26
XL
129// lldbg-check:[...]$13 = 1005
130// lldbr-check:(i32) y = 1005
1a4d82fc
JJ
131// lldb-command:continue
132
133// BEGINNING of else branch
134// lldb-command:print x
0bf4aa26
XL
135// lldbg-check:[...]$14 = 999
136// lldbr-check:(i32) x = 999
1a4d82fc 137// lldb-command:print y
0bf4aa26
XL
138// lldbg-check:[...]$15 = -1
139// lldbr-check:(i32) y = -1
1a4d82fc
JJ
140// lldb-command:continue
141
b039eaaf 142#![feature(omit_gdb_pretty_printer_section)]
1a4d82fc
JJ
143#![omit_gdb_pretty_printer_section]
144
145fn main() {
146
85aaf69f
SL
147 let x = 999;
148 let y = -1;
1a4d82fc
JJ
149
150 zzz(); // #break
151 sentinel();
152
153 if x < 1000 {
154 zzz(); // #break
155 sentinel();
156
85aaf69f 157 let x = 1001;
1a4d82fc
JJ
158
159 zzz(); // #break
160 sentinel();
161
85aaf69f
SL
162 let x = 1002;
163 let y = 1003;
1a4d82fc
JJ
164 zzz(); // #break
165 sentinel();
166 } else {
167 unreachable!();
168 }
169
170 zzz(); // #break
171 sentinel();
172
173 if x > 1000 {
174 unreachable!();
175 } else {
176 zzz(); // #break
177 sentinel();
178
85aaf69f
SL
179 let x = 1004;
180 let y = 1005;
1a4d82fc
JJ
181 zzz(); // #break
182 sentinel();
183 }
184
185 zzz(); // #break
186 sentinel();
187}
188
189fn zzz() {()}
190fn sentinel() {()}