]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/lexical-scope-in-while.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[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 // 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 #![feature(omit_gdb_pretty_printer_section)]
135 #![omit_gdb_pretty_printer_section]
136
137 fn main() {
138
139     let mut x = 0;
140
141     while x < 2 {
142         zzz(); // #break
143         sentinel();
144
145         x += 1;
146         zzz(); // #break
147         sentinel();
148
149         // Shadow x
150         let x = x + 100;
151         zzz(); // #break
152         sentinel();
153
154         // open scope within loop's top level scope
155         {
156             zzz(); // #break
157             sentinel();
158
159             let x = -987;
160
161             zzz(); // #break
162             sentinel();
163         }
164
165         // Check that we get the x before the inner scope again
166         zzz(); // #break
167         sentinel();
168     }
169
170     zzz(); // #break
171     sentinel();
172 }
173
174 fn zzz() {()}
175 fn sentinel() {()}