]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/lexical-scope-in-while.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / lexical-scope-in-while.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6
7 // gdb-command:run
8
9 // FIRST ITERATION
10 // gdb-command:print x
11 // gdb-check:$1 = 0
12 // gdb-command:continue
13
14 // gdb-command:print x
15 // gdb-check:$2 = 1
16 // gdb-command:continue
17
18 // gdb-command:print x
19 // gdb-check:$3 = 101
20 // gdb-command:continue
21
22 // gdb-command:print x
23 // gdb-check:$4 = 101
24 // gdb-command:continue
25
26 // gdb-command:print x
27 // gdb-check:$5 = -987
28 // gdb-command:continue
29
30 // gdb-command:print x
31 // gdb-check:$6 = 101
32 // gdb-command:continue
33
34
35 // SECOND ITERATION
36 // gdb-command:print x
37 // gdb-check:$7 = 1
38 // gdb-command:continue
39
40 // gdb-command:print x
41 // gdb-check:$8 = 2
42 // gdb-command:continue
43
44 // gdb-command:print x
45 // gdb-check:$9 = 102
46 // gdb-command:continue
47
48 // gdb-command:print x
49 // gdb-check:$10 = 102
50 // gdb-command:continue
51
52 // gdb-command:print x
53 // gdb-check:$11 = -987
54 // gdb-command:continue
55
56 // gdb-command:print x
57 // gdb-check:$12 = 102
58 // gdb-command:continue
59
60 // gdb-command:print x
61 // gdb-check:$13 = 2
62 // gdb-command:continue
63
64
65 // === LLDB TESTS ==================================================================================
66
67 // lldb-command:run
68
69 // FIRST ITERATION
70 // lldb-command:print x
71 // lldbg-check:[...]$0 = 0
72 // lldbr-check:(i32) x = 0
73 // lldb-command:continue
74
75 // lldb-command:print x
76 // lldbg-check:[...]$1 = 1
77 // lldbr-check:(i32) x = 1
78 // lldb-command:continue
79
80 // lldb-command:print x
81 // lldbg-check:[...]$2 = 101
82 // lldbr-check:(i32) x = 101
83 // lldb-command:continue
84
85 // lldb-command:print x
86 // lldbg-check:[...]$3 = 101
87 // lldbr-check:(i32) x = 101
88 // lldb-command:continue
89
90 // lldb-command:print x
91 // lldbg-check:[...]$4 = -987
92 // lldbr-check:(i32) x = -987
93 // lldb-command:continue
94
95 // lldb-command:print x
96 // lldbg-check:[...]$5 = 101
97 // lldbr-check:(i32) x = 101
98 // lldb-command:continue
99
100
101 // SECOND ITERATION
102 // lldb-command:print x
103 // lldbg-check:[...]$6 = 1
104 // lldbr-check:(i32) x = 1
105 // lldb-command:continue
106
107 // lldb-command:print x
108 // lldbg-check:[...]$7 = 2
109 // lldbr-check:(i32) x = 2
110 // lldb-command:continue
111
112 // lldb-command:print x
113 // lldbg-check:[...]$8 = 102
114 // lldbr-check:(i32) x = 102
115 // lldb-command:continue
116
117 // lldb-command:print x
118 // lldbg-check:[...]$9 = 102
119 // lldbr-check:(i32) x = 102
120 // lldb-command:continue
121
122 // lldb-command:print x
123 // lldbg-check:[...]$10 = -987
124 // lldbr-check:(i32) x = -987
125 // lldb-command:continue
126
127 // lldb-command:print x
128 // lldbg-check:[...]$11 = 102
129 // lldbr-check:(i32) x = 102
130 // lldb-command:continue
131
132 // lldb-command:print x
133 // lldbg-check:[...]$12 = 2
134 // lldbr-check:(i32) x = 2
135 // lldb-command:continue
136
137 #![feature(omit_gdb_pretty_printer_section)]
138 #![omit_gdb_pretty_printer_section]
139
140 fn main() {
141
142     let mut x = 0;
143
144     while x < 2 {
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() {()}