]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/lexical-scope-with-macro.rs
New upstream version 1.26.0+dfsg1
[rustc.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-macos 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 // 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 #![feature(omit_gdb_pretty_printer_section)]
115 #![omit_gdb_pretty_printer_section]
116
117 macro_rules! trivial {
118 ($e1:expr) => ($e1)
119 }
120
121 macro_rules! no_new_scope {
122 ($e1:expr) => (($e1 + 2) - 1)
123 }
124
125 macro_rules! new_scope {
126 () => ({
127 let a = 890242;
128 zzz(); // #break
129 sentinel();
130 })
131 }
132
133 macro_rules! shadow_within_macro {
134 ($e1:expr) => ({
135 let a = $e1 + 2;
136
137 zzz(); // #break
138 sentinel();
139
140 let a = $e1 + 10;
141
142 zzz(); // #break
143 sentinel();
144 })
145 }
146
147
148 macro_rules! dup_expr {
149 ($e1:expr) => (($e1) + ($e1))
150 }
151
152
153 fn main() {
154
155 let a = trivial!(10);
156 let b = no_new_scope!(33);
157
158 zzz(); // #break
159 sentinel();
160
161 new_scope!();
162
163 zzz(); // #break
164 sentinel();
165
166 shadow_within_macro!(100);
167
168 zzz(); // #break
169 sentinel();
170
171 let c = dup_expr!(10 * 20);
172
173 zzz(); // #break
174 sentinel();
175 }
176
177 fn zzz() {()}
178 fn sentinel() {()}