]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/lexical-scope-with-macro.rs
Rollup merge of #107807 - GuillaumeGomez:fix-small-debug-typo, r=notriddle
[rust.git] / tests / debuginfo / lexical-scope-with-macro.rs
1 // min-lldb-version: 310
2 // ignore-lldb FIXME #48807
3
4 // compile-flags:-g -Zdebug-macros
5
6 // === GDB TESTS ===================================================================================
7
8 // gdb-command:run
9
10 // gdb-command:print a
11 // gdb-check:$1 = 10
12 // gdb-command:print b
13 // gdb-check:$2 = 34
14 // gdb-command:continue
15
16 // gdb-command:print a
17 // gdb-check:$3 = 890242
18 // gdb-command:print b
19 // gdb-check:$4 = 34
20 // gdb-command:continue
21
22 // gdb-command:print a
23 // gdb-check:$5 = 10
24 // gdb-command:print b
25 // gdb-check:$6 = 34
26 // gdb-command:continue
27
28 // gdb-command:print a
29 // gdb-check:$7 = 102
30 // gdb-command:print b
31 // gdb-check:$8 = 34
32 // gdb-command:continue
33
34 // gdb-command:print a
35 // gdb-check:$9 = 110
36 // gdb-command:print b
37 // gdb-check:$10 = 34
38 // gdb-command:continue
39
40 // gdb-command:print a
41 // gdb-check:$11 = 10
42 // gdb-command:print b
43 // gdb-check:$12 = 34
44 // gdb-command:continue
45
46 // gdb-command:print a
47 // gdb-check:$13 = 10
48 // gdb-command:print b
49 // gdb-check:$14 = 34
50 // gdb-command:print c
51 // gdb-check:$15 = 400
52 // gdb-command:continue
53
54
55 // === LLDB TESTS ==================================================================================
56
57 // lldb-command:run
58
59 // lldb-command:print a
60 // lldbg-check:[...]$0 = 10
61 // lldbr-check:(i32) a = 10
62 // lldb-command:print b
63 // lldbg-check:[...]$1 = 34
64 // lldbr-check:(i32) b = 34
65 // lldb-command:continue
66
67 // lldb-command:print a
68 // lldbg-check:[...]$2 = 890242
69 // lldbr-check:(i32) a = 10
70 // lldb-command:print b
71 // lldbg-check:[...]$3 = 34
72 // lldbr-check:(i32) b = 34
73 // lldb-command:continue
74
75 // lldb-command:print a
76 // lldbg-check:[...]$4 = 10
77 // lldbr-check:(i32) a = 10
78 // lldb-command:print b
79 // lldbg-check:[...]$5 = 34
80 // lldbr-check:(i32) b = 34
81 // lldb-command:continue
82
83 // lldb-command:print a
84 // lldbg-check:[...]$6 = 102
85 // lldbr-check:(i32) a = 10
86 // lldb-command:print b
87 // lldbg-check:[...]$7 = 34
88 // lldbr-check:(i32) b = 34
89 // lldb-command:continue
90
91 // Don't test this with rust-enabled lldb for now; see issue #48807
92 // lldbg-command:print a
93 // lldbg-check:[...]$8 = 110
94 // lldbg-command:print b
95 // lldbg-check:[...]$9 = 34
96 // lldbg-command:continue
97
98 // lldbg-command:print a
99 // lldbg-check:[...]$10 = 10
100 // lldbg-command:print b
101 // lldbg-check:[...]$11 = 34
102 // lldbg-command:continue
103
104 // lldbg-command:print a
105 // lldbg-check:[...]$12 = 10
106 // lldbg-command:print b
107 // lldbg-check:[...]$13 = 34
108 // lldbg-command:print c
109 // lldbg-check:[...]$14 = 400
110 // lldbg-command:continue
111
112
113 #![feature(omit_gdb_pretty_printer_section)]
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 = 890242;
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!(10);
155     let b = no_new_scope!(33);
156
157     zzz(); // #break
158     sentinel();
159
160     new_scope!();
161
162     zzz(); // #break
163     sentinel();
164
165     shadow_within_macro!(100);
166
167     zzz(); // #break
168     sentinel();
169
170     let c = dup_expr!(10 * 20);
171
172     zzz(); // #break
173     sentinel();
174 }
175
176 fn zzz() {()}
177 fn sentinel() {()}