]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/lexical-scope-with-macro.rs
Auto merge of #54718 - froydnj:aarch64-ci, r=alexcrichton
[rust.git] / src / test / debuginfo / lexical-scope-with-macro.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 // ignore-lldb FIXME #48807
13
14 // compile-flags:-g -Zdebug-macros
15
16 // === GDB TESTS ===================================================================================
17
18 // gdb-command:run
19
20 // gdb-command:print a
21 // gdb-check:$1 = 10
22 // gdb-command:print b
23 // gdb-check:$2 = 34
24 // gdb-command:continue
25
26 // gdb-command:print a
27 // gdb-check:$3 = 890242
28 // gdb-command:print b
29 // gdb-check:$4 = 34
30 // gdb-command:continue
31
32 // gdb-command:print a
33 // gdb-check:$5 = 10
34 // gdb-command:print b
35 // gdb-check:$6 = 34
36 // gdb-command:continue
37
38 // gdb-command:print a
39 // gdb-check:$7 = 102
40 // gdb-command:print b
41 // gdb-check:$8 = 34
42 // gdb-command:continue
43
44 // gdb-command:print a
45 // gdb-check:$9 = 110
46 // gdb-command:print b
47 // gdb-check:$10 = 34
48 // gdb-command:continue
49
50 // gdb-command:print a
51 // gdb-check:$11 = 10
52 // gdb-command:print b
53 // gdb-check:$12 = 34
54 // gdb-command:continue
55
56 // gdb-command:print a
57 // gdb-check:$13 = 10
58 // gdb-command:print b
59 // gdb-check:$14 = 34
60 // gdb-command:print c
61 // gdb-check:$15 = 400
62 // gdb-command:continue
63
64
65 // === LLDB TESTS ==================================================================================
66
67 // lldb-command:run
68
69 // lldb-command:print a
70 // lldbg-check:[...]$0 = 10
71 // lldbr-check:(i32) a = 10
72 // lldb-command:print b
73 // lldbg-check:[...]$1 = 34
74 // lldbr-check:(i32) b = 34
75 // lldb-command:continue
76
77 // lldb-command:print a
78 // lldbg-check:[...]$2 = 890242
79 // lldbr-check:(i32) a = 10
80 // lldb-command:print b
81 // lldbg-check:[...]$3 = 34
82 // lldbr-check:(i32) b = 34
83 // lldb-command:continue
84
85 // lldb-command:print a
86 // lldbg-check:[...]$4 = 10
87 // lldbr-check:(i32) a = 10
88 // lldb-command:print b
89 // lldbg-check:[...]$5 = 34
90 // lldbr-check:(i32) b = 34
91 // lldb-command:continue
92
93 // lldb-command:print a
94 // lldbg-check:[...]$6 = 102
95 // lldbr-check:(i32) a = 10
96 // lldb-command:print b
97 // lldbg-check:[...]$7 = 34
98 // lldbr-check:(i32) b = 34
99 // lldb-command:continue
100
101 // Don't test this with rust-enabled lldb for now; see issue #48807
102 // lldbg-command:print a
103 // lldbg-check:[...]$8 = 110
104 // lldbg-command:print b
105 // lldbg-check:[...]$9 = 34
106 // lldbg-command:continue
107
108 // lldbg-command:print a
109 // lldbg-check:[...]$10 = 10
110 // lldbg-command:print b
111 // lldbg-check:[...]$11 = 34
112 // lldbg-command:continue
113
114 // lldbg-command:print a
115 // lldbg-check:[...]$12 = 10
116 // lldbg-command:print b
117 // lldbg-check:[...]$13 = 34
118 // lldbg-command:print c
119 // lldbg-check:[...]$14 = 400
120 // lldbg-command:continue
121
122
123 #![feature(omit_gdb_pretty_printer_section)]
124 #![omit_gdb_pretty_printer_section]
125
126 macro_rules! trivial {
127     ($e1:expr) => ($e1)
128 }
129
130 macro_rules! no_new_scope {
131     ($e1:expr) => (($e1 + 2) - 1)
132 }
133
134 macro_rules! new_scope {
135     () => ({
136         let a = 890242;
137         zzz(); // #break
138         sentinel();
139     })
140 }
141
142 macro_rules! shadow_within_macro {
143     ($e1:expr) => ({
144         let a = $e1 + 2;
145
146         zzz(); // #break
147         sentinel();
148
149         let a = $e1 + 10;
150
151         zzz(); // #break
152         sentinel();
153     })
154 }
155
156
157 macro_rules! dup_expr {
158     ($e1:expr) => (($e1) + ($e1))
159 }
160
161
162 fn main() {
163
164     let a = trivial!(10);
165     let b = no_new_scope!(33);
166
167     zzz(); // #break
168     sentinel();
169
170     new_scope!();
171
172     zzz(); // #break
173     sentinel();
174
175     shadow_within_macro!(100);
176
177     zzz(); // #break
178     sentinel();
179
180     let c = dup_expr!(10 * 20);
181
182     zzz(); // #break
183     sentinel();
184 }
185
186 fn zzz() {()}
187 fn sentinel() {()}