]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/lexical-scope-in-while.rs
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=QuietMisdreavus
[rust.git] / src / test / debuginfo / lexical-scope-in-while.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 // FIRST ITERATION
20 // gdb-command:print x
21 // gdb-check:$1 = 0
22 // gdb-command:continue
23
24 // gdb-command:print x
25 // gdb-check:$2 = 1
26 // gdb-command:continue
27
28 // gdb-command:print x
29 // gdb-check:$3 = 101
30 // gdb-command:continue
31
32 // gdb-command:print x
33 // gdb-check:$4 = 101
34 // gdb-command:continue
35
36 // gdb-command:print x
37 // gdb-check:$5 = -987
38 // gdb-command:continue
39
40 // gdb-command:print x
41 // gdb-check:$6 = 101
42 // gdb-command:continue
43
44
45 // SECOND ITERATION
46 // gdb-command:print x
47 // gdb-check:$7 = 1
48 // gdb-command:continue
49
50 // gdb-command:print x
51 // gdb-check:$8 = 2
52 // gdb-command:continue
53
54 // gdb-command:print x
55 // gdb-check:$9 = 102
56 // gdb-command:continue
57
58 // gdb-command:print x
59 // gdb-check:$10 = 102
60 // gdb-command:continue
61
62 // gdb-command:print x
63 // gdb-check:$11 = -987
64 // gdb-command:continue
65
66 // gdb-command:print x
67 // gdb-check:$12 = 102
68 // gdb-command:continue
69
70 // gdb-command:print x
71 // gdb-check:$13 = 2
72 // gdb-command:continue
73
74
75 // === LLDB TESTS ==================================================================================
76
77 // lldb-command:run
78
79 // FIRST ITERATION
80 // lldb-command:print x
81 // lldbg-check:[...]$0 = 0
82 // lldbr-check:(i32) x = 0
83 // lldb-command:continue
84
85 // lldb-command:print x
86 // lldbg-check:[...]$1 = 1
87 // lldbr-check:(i32) x = 1
88 // lldb-command:continue
89
90 // lldb-command:print x
91 // lldbg-check:[...]$2 = 101
92 // lldbr-check:(i32) x = 101
93 // lldb-command:continue
94
95 // lldb-command:print x
96 // lldbg-check:[...]$3 = 101
97 // lldbr-check:(i32) x = 101
98 // lldb-command:continue
99
100 // lldb-command:print x
101 // lldbg-check:[...]$4 = -987
102 // lldbr-check:(i32) x = -987
103 // lldb-command:continue
104
105 // lldb-command:print x
106 // lldbg-check:[...]$5 = 101
107 // lldbr-check:(i32) x = 101
108 // lldb-command:continue
109
110
111 // SECOND ITERATION
112 // lldb-command:print x
113 // lldbg-check:[...]$6 = 1
114 // lldbr-check:(i32) x = 1
115 // lldb-command:continue
116
117 // lldb-command:print x
118 // lldbg-check:[...]$7 = 2
119 // lldbr-check:(i32) x = 2
120 // lldb-command:continue
121
122 // lldb-command:print x
123 // lldbg-check:[...]$8 = 102
124 // lldbr-check:(i32) x = 102
125 // lldb-command:continue
126
127 // lldb-command:print x
128 // lldbg-check:[...]$9 = 102
129 // lldbr-check:(i32) x = 102
130 // lldb-command:continue
131
132 // lldb-command:print x
133 // lldbg-check:[...]$10 = -987
134 // lldbr-check:(i32) x = -987
135 // lldb-command:continue
136
137 // lldb-command:print x
138 // lldbg-check:[...]$11 = 102
139 // lldbr-check:(i32) x = 102
140 // lldb-command:continue
141
142 // lldb-command:print x
143 // lldbg-check:[...]$12 = 2
144 // lldbr-check:(i32) x = 2
145 // lldb-command:continue
146
147 #![feature(omit_gdb_pretty_printer_section)]
148 #![omit_gdb_pretty_printer_section]
149
150 fn main() {
151
152     let mut x = 0;
153
154     while x < 2 {
155         zzz(); // #break
156         sentinel();
157
158         x += 1;
159         zzz(); // #break
160         sentinel();
161
162         // Shadow x
163         let x = x + 100;
164         zzz(); // #break
165         sentinel();
166
167         // open scope within loop's top level scope
168         {
169             zzz(); // #break
170             sentinel();
171
172             let x = -987;
173
174             zzz(); // #break
175             sentinel();
176         }
177
178         // Check that we get the x before the inner scope again
179         zzz(); // #break
180         sentinel();
181     }
182
183     zzz(); // #break
184     sentinel();
185 }
186
187 fn zzz() {()}
188 fn sentinel() {()}