]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/lexical-scope-with-macro.rs
rollup merge of #20482: kmcallister/macro-reform
[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 // ignore-android: FIXME(#10381)
12 // min-lldb-version: 310
13
14 // compile-flags:-g
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 // lldb-check:[...]$0 = 10
71 // lldb-command:print b
72 // lldb-check:[...]$1 = 34
73 // lldb-command:continue
74
75 // lldb-command:print a
76 // lldb-check:[...]$2 = 890242
77 // lldb-command:print b
78 // lldb-check:[...]$3 = 34
79 // lldb-command:continue
80
81 // lldb-command:print a
82 // lldb-check:[...]$4 = 10
83 // lldb-command:print b
84 // lldb-check:[...]$5 = 34
85 // lldb-command:continue
86
87 // lldb-command:print a
88 // lldb-check:[...]$6 = 102
89 // lldb-command:print b
90 // lldb-check:[...]$7 = 34
91 // lldb-command:continue
92
93 // lldb-command:print a
94 // lldb-check:[...]$8 = 110
95 // lldb-command:print b
96 // lldb-check:[...]$9 = 34
97 // lldb-command:continue
98
99 // lldb-command:print a
100 // lldb-check:[...]$10 = 10
101 // lldb-command:print b
102 // lldb-check:[...]$11 = 34
103 // lldb-command:continue
104
105 // lldb-command:print a
106 // lldb-check:[...]$12 = 10
107 // lldb-command:print b
108 // lldb-check:[...]$13 = 34
109 // lldb-command:print c
110 // lldb-check:[...]$14 = 400
111 // lldb-command:continue
112
113
114 #![omit_gdb_pretty_printer_section]
115
116 macro_rules! trivial {
117     ($e1:expr) => ($e1)
118 }
119
120 macro_rules! no_new_scope {
121     ($e1:expr) => (($e1 + 2) - 1)
122 }
123
124 macro_rules! new_scope {
125     () => ({
126         let a = 890242i;
127         zzz(); // #break
128         sentinel();
129     })
130 }
131
132 macro_rules! shadow_within_macro {
133     ($e1:expr) => ({
134         let a = $e1 + 2;
135
136         zzz(); // #break
137         sentinel();
138
139         let a = $e1 + 10;
140
141         zzz(); // #break
142         sentinel();
143     })
144 }
145
146
147 macro_rules! dup_expr {
148     ($e1:expr) => (($e1) + ($e1))
149 }
150
151
152 fn main() {
153
154     let a = trivial!(10i);
155     let b = no_new_scope!(33i);
156
157     zzz(); // #break
158     sentinel();
159
160     new_scope!();
161
162     zzz(); // #break
163     sentinel();
164
165     shadow_within_macro!(100i);
166
167     zzz(); // #break
168     sentinel();
169
170     let c = dup_expr!(10i * 20);
171
172     zzz(); // #break
173     sentinel();
174 }
175
176 fn zzz() {()}
177 fn sentinel() {()}