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