]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/lexical-scope-in-unconditional-loop.rs
Imported Upstream version 1.0.0-alpha.2
[rustc.git] / src / test / debuginfo / lexical-scope-in-unconditional-loop.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 // lldb-check:[...]$0 = 0
82 // lldb-command:continue
83
84 // lldb-command:print x
85 // lldb-check:[...]$1 = 1
86 // lldb-command:continue
87
88 // lldb-command:print x
89 // lldb-check:[...]$2 = 101
90 // lldb-command:continue
91
92 // lldb-command:print x
93 // lldb-check:[...]$3 = 101
94 // lldb-command:continue
95
96 // lldb-command:print x
97 // lldb-check:[...]$4 = -987
98 // lldb-command:continue
99
100 // lldb-command:print x
101 // lldb-check:[...]$5 = 101
102 // lldb-command:continue
103
104
105 // SECOND ITERATION
106 // lldb-command:print x
107 // lldb-check:[...]$6 = 1
108 // lldb-command:continue
109
110 // lldb-command:print x
111 // lldb-check:[...]$7 = 2
112 // lldb-command:continue
113
114 // lldb-command:print x
115 // lldb-check:[...]$8 = 102
116 // lldb-command:continue
117
118 // lldb-command:print x
119 // lldb-check:[...]$9 = 102
120 // lldb-command:continue
121
122 // lldb-command:print x
123 // lldb-check:[...]$10 = -987
124 // lldb-command:continue
125
126 // lldb-command:print x
127 // lldb-check:[...]$11 = 102
128 // lldb-command:continue
129
130 // lldb-command:print x
131 // lldb-check:[...]$12 = 2
132 // lldb-command:continue
133
134 #![omit_gdb_pretty_printer_section]
135
136 fn main() {
137
138 let mut x = 0;
139
140 loop {
141 if x >= 2 {
142 break;
143 }
144
145 zzz(); // #break
146 sentinel();
147
148 x += 1;
149 zzz(); // #break
150 sentinel();
151
152 // Shadow x
153 let x = x + 100;
154 zzz(); // #break
155 sentinel();
156
157 // open scope within loop's top level scope
158 {
159 zzz(); // #break
160 sentinel();
161
162 let x = -987;
163
164 zzz(); // #break
165 sentinel();
166 }
167
168 // Check that we get the x before the inner scope again
169 zzz(); // #break
170 sentinel();
171 }
172
173 zzz(); // #break
174 sentinel();
175 }
176
177 fn zzz() {()}
178 fn sentinel() {()}