]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/macro-stepping.rs
Rollup merge of #51722 - Aaronepower:master, r=Mark-Simulacrum
[rust.git] / src / test / debuginfo / macro-stepping.rs
1 // Copyright 2013-2016 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-windows
12 // ignore-android
13 // ignore-aarch64
14 // min-lldb-version: 310
15 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
16
17 // aux-build:macro-stepping.rs
18
19 #![allow(unused)]
20
21 #[macro_use]
22 extern crate macro_stepping; // exports new_scope!()
23
24 // compile-flags:-g
25
26 // === GDB TESTS ===================================================================================
27
28 // gdb-command:run
29 // gdb-command:next
30 // gdb-command:frame
31 // gdb-check:[...]#loc1[...]
32 // gdb-command:next
33 // gdb-command:frame
34 // gdb-check:[...]#loc2[...]
35 // gdb-command:next
36 // gdb-command:frame
37 // gdb-check:[...]#loc3[...]
38 // gdb-command:next
39 // gdb-command:frame
40 // gdb-check:[...]#loc4[...]
41 // gdb-command:next
42 // gdb-command:frame
43 // gdb-check:[...]#loc5[...]
44 // gdb-command:next
45 // gdb-command:frame
46 // gdb-check:[...]#loc6[...]
47
48 // gdb-command:continue
49 // gdb-command:step
50 // gdb-command:frame
51 // gdb-check:[...]#inc-loc1[...]
52 // gdb-command:next
53 // gdb-command:frame
54 // gdb-check:[...]#inc-loc2[...]
55 // gdb-command:next
56 // gdb-command:frame
57 // gdb-check:[...]#inc-loc3[...]
58
59 // === LLDB TESTS ==================================================================================
60
61 // lldb-command:set set stop-line-count-before 0
62 // lldb-command:set set stop-line-count-after 1
63 // Can't set both to zero or lldb will stop printing source at all.  So it will output the current
64 // line and the next.  We deal with this by having at least 2 lines between the #loc's
65
66 // lldb-command:run
67 // lldb-command:next
68 // lldb-command:frame select
69 // lldb-check:[...]#loc1[...]
70 // lldb-command:next
71 // lldb-command:frame select
72 // lldb-check:[...]#loc2[...]
73 // lldb-command:next
74 // lldb-command:frame select
75 // lldb-check:[...]#loc3[...]
76 // lldb-command:next
77 // lldb-command:frame select
78 // lldb-check:[...]#loc4[...]
79 // lldb-command:next
80 // lldb-command:frame select
81 // lldb-check:[...]#loc5[...]
82
83 // lldb-command:continue
84 // lldb-command:step
85 // lldb-command:frame select
86 // lldb-check:[...]#inc-loc1[...]
87 // lldb-command:next
88 // lldb-command:frame select
89 // lldb-check:[...]#inc-loc2[...]
90 // lldb-command:next
91 // lldb-command:frame select
92 // lldb-check:[...]#inc-loc3[...]
93
94 macro_rules! foo {
95     () => {
96         let a = 1;
97         let b = 2;
98         let c = 3;
99     }
100 }
101
102 macro_rules! foo2 {
103     () => {
104         foo!();
105         let x = 1;
106         foo!();
107     }
108 }
109
110 fn main() {
111     zzz(); // #break
112
113     foo!(); // #loc1
114
115     foo2!(); // #loc2
116
117     let x = vec![42]; // #loc3
118
119     new_scope!(); // #loc4
120
121     println!("Hello {}", // #loc5
122              "world");
123
124     zzz(); // #loc6
125
126     included(); // #break
127 }
128
129 fn zzz() {()}
130
131 include!("macro-stepping.inc");