]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/macro-stepping.rs
52a2a58ed7d27d17bf6445df6eb234e67c0f3af5
[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 // min-lldb-version: 310
14
15 // aux-build:macro-stepping.rs
16
17 #![allow(unused)]
18
19 #[macro_use]
20 extern crate macro_stepping; // exports new_scope!()
21
22 // compile-flags:-g
23
24 // === GDB TESTS ===================================================================================
25
26 // gdb-command:run
27 // gdb-command:next
28 // gdb-command:frame
29 // gdb-check:[...]#loc1[...]
30 // gdb-command:next
31 // gdb-command:frame
32 // gdb-check:[...]#loc2[...]
33 // gdb-command:next
34 // gdb-command:frame
35 // gdb-check:[...]#loc3[...]
36 // gdb-command:next
37 // gdb-command:frame
38 // gdb-check:[...]#loc4[...]
39 // gdb-command:next
40 // gdb-command:frame
41 // gdb-check:[...]#loc5[...]
42 // gdb-command:next
43 // gdb-command:frame
44 // gdb-check:[...]#loc6[...]
45
46 // === LLDB TESTS ==================================================================================
47
48 // lldb-command:set set stop-line-count-before 0
49 // lldb-command:set set stop-line-count-after 1
50 // Can't set both to zero or lldb will stop printing source at all.  So it will output the current
51 // line and the next.  We deal with this by having at least 2 lines between the #loc's
52
53 // lldb-command:run
54 // lldb-command:next
55 // lldb-command:frame select
56 // lldb-check:[...]#loc1[...]
57 // lldb-command:next
58 // lldb-command:frame select
59 // lldb-check:[...]#loc2[...]
60 // lldb-command:next
61 // lldb-command:frame select
62 // lldb-check:[...]#loc3[...]
63 // lldb-command:next
64 // lldb-command:frame select
65 // lldb-check:[...]#loc4[...]
66 // lldb-command:next
67 // lldb-command:frame select
68 // lldb-check:[...]#loc5[...]
69
70 macro_rules! foo {
71     () => {
72         let a = 1;
73         let b = 2;
74         let c = 3;
75     }
76 }
77
78 macro_rules! foo2 {
79     () => {
80         foo!();
81         let x = 1;
82         foo!();
83     }
84 }
85
86 fn main() {
87     zzz(); // #break
88
89     foo!(); // #loc1
90
91     foo2!(); // #loc2
92
93     let x = vec![42]; // #loc3
94
95     new_scope!(); // #loc4
96
97     println!("Hello {}", // #loc5
98              "world");
99
100     zzz(); // #loc6
101 }
102
103 fn zzz() {()}