]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/lexical-scope-in-if.rs
Rollup merge of #107780 - compiler-errors:instantiate-binder, r=lcnr
[rust.git] / tests / debuginfo / lexical-scope-in-if.rs
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
72 // lldbg-check:[...]$0 = 999
73 // lldbr-check:(i32) x = 999
74 // lldb-command:print y
75 // lldbg-check:[...]$1 = -1
76 // lldbr-check:(i32) y = -1
77 // lldb-command:continue
78
79 // AT BEGINNING of 'then' block
80 // lldb-command:print x
81 // lldbg-check:[...]$2 = 999
82 // lldbr-check:(i32) x = 999
83 // lldb-command:print y
84 // lldbg-check:[...]$3 = -1
85 // lldbr-check:(i32) y = -1
86 // lldb-command:continue
87
88 // AFTER 1st redeclaration of 'x'
89 // lldb-command:print x
90 // lldbg-check:[...]$4 = 1001
91 // lldbr-check:(i32) x = 1001
92 // lldb-command:print y
93 // lldbg-check:[...]$5 = -1
94 // lldbr-check:(i32) y = -1
95 // lldb-command:continue
96
97 // AFTER 2st redeclaration of 'x'
98 // lldb-command:print x
99 // lldbg-check:[...]$6 = 1002
100 // lldbr-check:(i32) x = 1002
101 // lldb-command:print y
102 // lldbg-check:[...]$7 = 1003
103 // lldbr-check:(i32) y = 1003
104 // lldb-command:continue
105
106 // AFTER 1st if expression
107 // lldb-command:print x
108 // lldbg-check:[...]$8 = 999
109 // lldbr-check:(i32) x = 999
110 // lldb-command:print y
111 // lldbg-check:[...]$9 = -1
112 // lldbr-check:(i32) y = -1
113 // lldb-command:continue
114
115 // BEGINNING of else branch
116 // lldb-command:print x
117 // lldbg-check:[...]$10 = 999
118 // lldbr-check:(i32) x = 999
119 // lldb-command:print y
120 // lldbg-check:[...]$11 = -1
121 // lldbr-check:(i32) y = -1
122 // lldb-command:continue
123
124 // BEGINNING of else branch
125 // lldb-command:print x
126 // lldbg-check:[...]$12 = 1004
127 // lldbr-check:(i32) x = 1004
128 // lldb-command:print y
129 // lldbg-check:[...]$13 = 1005
130 // lldbr-check:(i32) y = 1005
131 // lldb-command:continue
132
133 // BEGINNING of else branch
134 // lldb-command:print x
135 // lldbg-check:[...]$14 = 999
136 // lldbr-check:(i32) x = 999
137 // lldb-command:print y
138 // lldbg-check:[...]$15 = -1
139 // lldbr-check:(i32) y = -1
140 // lldb-command:continue
141
142 #![feature(omit_gdb_pretty_printer_section)]
143 #![omit_gdb_pretty_printer_section]
144
145 fn main() {
146
147     let x = 999;
148     let y = -1;
149
150     zzz(); // #break
151     sentinel();
152
153     if x < 1000 {
154         zzz(); // #break
155         sentinel();
156
157         let x = 1001;
158
159         zzz(); // #break
160         sentinel();
161
162         let x = 1002;
163         let y = 1003;
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
179         let x = 1004;
180         let y = 1005;
181         zzz(); // #break
182         sentinel();
183     }
184
185     zzz(); // #break
186     sentinel();
187 }
188
189 fn zzz() {()}
190 fn sentinel() {()}